Remove uses of null
in services
This commit is contained in:
parent
f5a52ee7db
commit
f7ff3eb562
3 changed files with 5 additions and 18 deletions
|
@ -1,16 +1,9 @@
|
|||
///<reference path='references.ts' />
|
||||
/* tslint:disable:no-null-keyword */
|
||||
|
||||
/* @internal */
|
||||
namespace ts.formatting {
|
||||
export class RuleOperation {
|
||||
public Context: RuleOperationContext;
|
||||
public Action: RuleAction;
|
||||
|
||||
constructor() {
|
||||
this.Context = null;
|
||||
this.Action = null;
|
||||
}
|
||||
constructor(public Context: RuleOperationContext, public Action: RuleAction) {}
|
||||
|
||||
public toString(): string {
|
||||
return "[context=" + this.Context + "," +
|
||||
|
@ -22,10 +15,7 @@ namespace ts.formatting {
|
|||
}
|
||||
|
||||
static create2(context: RuleOperationContext, action: RuleAction) {
|
||||
const result = new RuleOperation();
|
||||
result.Context = context;
|
||||
result.Action = action;
|
||||
return result;
|
||||
return new RuleOperation(context, action);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
///<reference path='references.ts' />
|
||||
/* tslint:disable:no-null-keyword */
|
||||
|
||||
/* @internal */
|
||||
namespace ts.formatting {
|
||||
|
@ -62,14 +61,14 @@ namespace ts.formatting {
|
|||
public GetRule(context: FormattingContext): Rule {
|
||||
const bucketIndex = this.GetRuleBucketIndex(context.currentTokenSpan.kind, context.nextTokenSpan.kind);
|
||||
const bucket = this.map[bucketIndex];
|
||||
if (bucket != null) {
|
||||
if (bucket) {
|
||||
for (const rule of bucket.Rules()) {
|
||||
if (rule.Operation.Context.InContext(context)) {
|
||||
return rule;
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
/// <reference path="references.ts"/>
|
||||
/* tslint:disable:no-null-keyword */
|
||||
|
||||
/* @internal */
|
||||
namespace ts.formatting {
|
||||
|
@ -26,8 +25,7 @@ namespace ts.formatting {
|
|||
}
|
||||
|
||||
public ensureUpToDate(options: ts.FormatCodeOptions) {
|
||||
// TODO: Should this be '==='?
|
||||
if (this.options == null || !ts.compareDataObjects(this.options, options)) {
|
||||
if (!this.options || !ts.compareDataObjects(this.options, options)) {
|
||||
const activeRules = this.createActiveRules(options);
|
||||
const rulesMap = RulesMap.create(activeRules);
|
||||
|
||||
|
|
Loading…
Reference in a new issue