File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11///<reference path='references.ts' />
2- /* tslint:disable:no-null-keyword */
32
43/* @internal */
54namespace ts . formatting {
65 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 ) { }
147
158 public toString ( ) : string {
169 return "[context=" + this . Context + "," +
@@ -22,10 +15,7 @@ namespace ts.formatting {
2215 }
2316
2417 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 ) ;
2919 }
3020 }
3121}
Original file line number Diff line number Diff line change 11///<reference path='references.ts' />
2- /* tslint:disable:no-null-keyword */
32
43/* @internal */
54namespace ts . formatting {
@@ -62,14 +61,14 @@ namespace ts.formatting {
6261 public GetRule ( context : FormattingContext ) : Rule {
6362 const bucketIndex = this . GetRuleBucketIndex ( context . currentTokenSpan . kind , context . nextTokenSpan . kind ) ;
6463 const bucket = this . map [ bucketIndex ] ;
65- if ( bucket != null ) {
64+ if ( bucket ) {
6665 for ( const rule of bucket . Rules ( ) ) {
6766 if ( rule . Operation . Context . InContext ( context ) ) {
6867 return rule ;
6968 }
7069 }
7170 }
72- return null ;
71+ return undefined ;
7372 }
7473 }
7574
Original file line number Diff line number Diff line change 11/// <reference path="references.ts"/>
2- /* tslint:disable:no-null-keyword */
32
43/* @internal */
54namespace ts . formatting {
@@ -26,8 +25,7 @@ namespace ts.formatting {
2625 }
2726
2827 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 ) ) {
3129 const activeRules = this . createActiveRules ( options ) ;
3230 const rulesMap = RulesMap . create ( activeRules ) ;
3331
You can’t perform that action at this time.
0 commit comments