Skip to content

Commit 2177f77

Browse files
removed currentSourceStatementDepth and currentSourceStatementHasParameterDecorators
1 parent 9757397 commit 2177f77

1 file changed

Lines changed: 4 additions & 37 deletions

File tree

src/parser.ts

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,6 @@ export class Parser extends DiagnosticEmitter {
118118
sources: Source[];
119119
/** Current overridden module name. */
120120
currentModuleName: string | null = null;
121-
/** Nesting depth of source-level statements while parsing. */
122-
currentSourceStatementDepth: i32 = 0;
123-
/** Indicates whether the current source-level statement should be revisited for post-transform parameter-decorator validation. */
124-
currentSourceStatementHasParameterDecorators: bool = false;
125121

126122
/** Constructs a new parser. */
127123
constructor(
@@ -201,10 +197,6 @@ export class Parser extends DiagnosticEmitter {
201197
tn: Tokenizer,
202198
namespace: NamespaceDeclaration | null = null
203199
): Statement | null {
204-
let isSourceStatement = this.currentSourceStatementDepth++ == 0;
205-
if (isSourceStatement) {
206-
this.currentSourceStatementHasParameterDecorators = false;
207-
}
208200
let flags = namespace ? namespace.flags & CommonFlags.Ambient : CommonFlags.None;
209201
let startPos = -1;
210202

@@ -442,16 +434,6 @@ export class Parser extends DiagnosticEmitter {
442434
}
443435
}
444436
}
445-
--this.currentSourceStatementDepth;
446-
if (isSourceStatement && statement != null && this.currentSourceStatementHasParameterDecorators) {
447-
let source = assert(this.currentSource);
448-
let parameterDecoratorStatements = source.parameterDecoratorStatements;
449-
if (!parameterDecoratorStatements) {
450-
source.parameterDecoratorStatements = [ statement ];
451-
} else {
452-
parameterDecoratorStatements.push(statement);
453-
}
454-
}
455437
return statement;
456438
}
457439

@@ -904,7 +886,7 @@ export class Parser extends DiagnosticEmitter {
904886
false,
905887
tn.range(startPos, tn.pos)
906888
);
907-
this.noteFunctionTypeParameterDecorators(functionType);
889+
// this.noteFunctionTypeParameterDecorators(functionType);
908890
return functionType;
909891
}
910892

@@ -986,21 +968,6 @@ export class Parser extends DiagnosticEmitter {
986968
}
987969
}
988970

989-
/** Records source-level statements whose function signatures preserved parameter decorators for post-transform validation. */
990-
private noteFunctionTypeParameterDecorators(signature: FunctionTypeNode): void {
991-
if (signature.explicitThisDecorators) {
992-
this.currentSourceStatementHasParameterDecorators = true;
993-
return;
994-
}
995-
let parameters = signature.parameters;
996-
for (let i = 0, k = parameters.length; i < k; ++i) {
997-
if (parameters[i].decorators) {
998-
this.currentSourceStatementHasParameterDecorators = true;
999-
return;
1000-
}
1001-
}
1002-
}
1003-
1004971
parseVariable(
1005972
tn: Tokenizer,
1006973
flags: CommonFlags,
@@ -1624,7 +1591,7 @@ export class Parser extends DiagnosticEmitter {
16241591
false,
16251592
tn.range(signatureStart, tn.pos)
16261593
);
1627-
this.noteFunctionTypeParameterDecorators(signature);
1594+
// this.noteFunctionTypeParameterDecorators(signature);
16281595

16291596
let body: Statement | null = null;
16301597
if (tn.skip(Token.OpenBrace)) {
@@ -1750,7 +1717,7 @@ export class Parser extends DiagnosticEmitter {
17501717
false,
17511718
tn.range(signatureStart, tn.pos)
17521719
);
1753-
this.noteFunctionTypeParameterDecorators(signature);
1720+
// this.noteFunctionTypeParameterDecorators(signature);
17541721

17551722
let body: Statement | null = null;
17561723
if (arrowKind) {
@@ -2392,7 +2359,7 @@ export class Parser extends DiagnosticEmitter {
23922359
false,
23932360
tn.range(signatureStart, tn.pos)
23942361
);
2395-
this.noteFunctionTypeParameterDecorators(signature);
2362+
// this.noteFunctionTypeParameterDecorators(signature);
23962363

23972364
let body: Statement | null = null;
23982365
if (tn.skip(Token.OpenBrace)) {

0 commit comments

Comments
 (0)