Skip to content

Commit e5ed375

Browse files
committed
2 parents 1e41af3 + 1abc2a7 commit e5ed375

File tree

3 files changed

+5
-18
lines changed

3 files changed

+5
-18
lines changed
Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,9 @@
11
///<reference path='references.ts' />
2-
/* tslint:disable:no-null-keyword */
32

43
/* @internal */
54
namespace 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
}

src/services/formatting/rulesMap.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
///<reference path='references.ts' />
2-
/* tslint:disable:no-null-keyword */
32

43
/* @internal */
54
namespace 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

src/services/formatting/rulesProvider.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/// <reference path="references.ts"/>
2-
/* tslint:disable:no-null-keyword */
32

43
/* @internal */
54
namespace 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

0 commit comments

Comments
 (0)