From 3c028f03e198d270ab5d3dec6b90efe4714719a9 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Sun, 30 Nov 2014 19:51:42 -0800 Subject: [PATCH] Tighten types in the expression AST. --- src/compiler/types.ts | 12 ++++++------ src/services/syntax/parser.ts | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/compiler/types.ts b/src/compiler/types.ts index 94a3f9c48ee..e342eec58ec 100644 --- a/src/compiler/types.ts +++ b/src/compiler/types.ts @@ -457,7 +457,7 @@ module ts { export interface PrefixUnaryExpression extends UnaryExpression { operator: SyntaxKind; - operand: Expression; + operand: UnaryExpression; } export interface PostfixUnaryExpression extends PostfixExpression { @@ -482,15 +482,15 @@ module ts { } export interface DeleteExpression extends UnaryExpression { - expression: Expression; + expression: UnaryExpression; } export interface TypeOfExpression extends UnaryExpression { - expression: Expression; + expression: UnaryExpression; } export interface VoidExpression extends UnaryExpression { - expression: Expression; + expression: UnaryExpression; } export interface YieldExpression extends Expression { @@ -557,7 +557,7 @@ module ts { } export interface CallExpression extends LeftHandSideExpression { - expression: Expression; + expression: LeftHandSideExpression; typeArguments?: NodeArray; arguments: NodeArray; } @@ -573,7 +573,7 @@ module ts { export interface TypeAssertion extends UnaryExpression { type: TypeNode; - expression: Expression; + expression: UnaryExpression; } export interface Statement extends Node, ModuleElement { diff --git a/src/services/syntax/parser.ts b/src/services/syntax/parser.ts index c4b282380d7..36897ad1c88 100644 --- a/src/services/syntax/parser.ts +++ b/src/services/syntax/parser.ts @@ -999,18 +999,18 @@ module TypeScript.Parser { // Technically a keyword is valid here as all keywords are identifier names. // However, often we'll encounter this in error situations when the keyword // is actually starting another valid construct. - + // // So, we check for the following specific case: - + // // name. // keyword identifierNameOrKeyword - + // // Note: the newlines are important here. For example, if that above code // were rewritten into: - + // // name.keyword // identifierNameOrKeyword - + // // Then we would consider it valid. That's because ASI would take effect and // the code would be implicitly: "name.keyword; identifierNameOrKeyword". // In the first case though, ASI will not take effect because there is not a