File tree 3 files changed +5
-18
lines changed 3 files changed +5
-18
lines changed Original file line number Diff line number Diff line change 1
1
///<reference path='references.ts' />
2
- /* tslint:disable:no-null-keyword */
3
2
4
3
/* @internal */
5
4
namespace ts . formatting {
6
5
export class RuleOperation {
7
- public Context : RuleOperationContext ;
8
- public Action : RuleAction ;
9
-
10
- constructor ( ) {
11
- this . Context = null ;
12
- this . Action = null ;
13
- }
6
+ constructor ( public Context : RuleOperationContext , public Action : RuleAction ) { }
14
7
15
8
public toString ( ) : string {
16
9
return "[context=" + this . Context + "," +
@@ -22,10 +15,7 @@ namespace ts.formatting {
22
15
}
23
16
24
17
static create2 ( context : RuleOperationContext , action : RuleAction ) {
25
- const result = new RuleOperation ( ) ;
26
- result . Context = context ;
27
- result . Action = action ;
28
- return result ;
18
+ return new RuleOperation ( context , action ) ;
29
19
}
30
20
}
31
21
}
Original file line number Diff line number Diff line change 1
1
///<reference path='references.ts' />
2
- /* tslint:disable:no-null-keyword */
3
2
4
3
/* @internal */
5
4
namespace ts . formatting {
@@ -62,14 +61,14 @@ namespace ts.formatting {
62
61
public GetRule ( context : FormattingContext ) : Rule {
63
62
const bucketIndex = this . GetRuleBucketIndex ( context . currentTokenSpan . kind , context . nextTokenSpan . kind ) ;
64
63
const bucket = this . map [ bucketIndex ] ;
65
- if ( bucket != null ) {
64
+ if ( bucket ) {
66
65
for ( const rule of bucket . Rules ( ) ) {
67
66
if ( rule . Operation . Context . InContext ( context ) ) {
68
67
return rule ;
69
68
}
70
69
}
71
70
}
72
- return null ;
71
+ return undefined ;
73
72
}
74
73
}
75
74
Original file line number Diff line number Diff line change 1
1
/// <reference path="references.ts"/>
2
- /* tslint:disable:no-null-keyword */
3
2
4
3
/* @internal */
5
4
namespace ts . formatting {
@@ -26,8 +25,7 @@ namespace ts.formatting {
26
25
}
27
26
28
27
public ensureUpToDate ( options : ts . FormatCodeOptions ) {
29
- // TODO: Should this be '==='?
30
- if ( this . options == null || ! ts . compareDataObjects ( this . options , options ) ) {
28
+ if ( ! this . options || ! ts . compareDataObjects ( this . options , options ) ) {
31
29
const activeRules = this . createActiveRules ( options ) ;
32
30
const rulesMap = RulesMap . create ( activeRules ) ;
33
31
You can’t perform that action at this time.
0 commit comments