Tests for operator expressions

This commit is contained in:
Ron Buckton
2016-11-26 05:26:09 -05:00
parent dba5c2bf87
commit 33e22ba456
5 changed files with 201 additions and 11 deletions
+6 -11
View File
@@ -4231,6 +4231,8 @@ namespace ts {
const fullStart = scanner.getStartPos();
parseExpected(SyntaxKind.OpenParenToken);
reScanTildeToken();
reScanGreaterToken();
let operator = token();
switch (operator) {
case SyntaxKind.AsteriskAsteriskToken:
@@ -4245,7 +4247,7 @@ namespace ts {
case SyntaxKind.LessThanToken:
case SyntaxKind.LessThanEqualsToken:
case SyntaxKind.GreaterThanToken:
case SyntaxKind.GreaterThanGreaterThanEqualsToken:
case SyntaxKind.GreaterThanEqualsToken:
case SyntaxKind.InstanceOfKeyword:
case SyntaxKind.InKeyword:
case SyntaxKind.EqualsEqualsToken:
@@ -4260,17 +4262,10 @@ namespace ts {
case SyntaxKind.ExclamationToken:
case SyntaxKind.VoidKeyword:
case SyntaxKind.TypeOfKeyword:
nextToken();
if (token() === SyntaxKind.CloseParenToken) {
nextToken();
const node = <OperatorExpression>createNode(SyntaxKind.OperatorExpression, fullStart);
node.operator = operator;
return finishNode(node);
}
return undefined;
case SyntaxKind.TildeToken:
operator = reScanTildeToken();
nextToken()
case SyntaxKind.TildePlusToken:
case SyntaxKind.TildeMinusToken:
nextToken();
if (token() === SyntaxKind.CloseParenToken) {
nextToken();
const node = <OperatorExpression>createNode(SyntaxKind.OperatorExpression, fullStart);
+3
View File
@@ -1193,6 +1193,9 @@ namespace ts {
case SyntaxKind.JsxSelfClosingElement:
case SyntaxKind.YieldExpression:
case SyntaxKind.AwaitExpression:
case SyntaxKind.BindExpression:
case SyntaxKind.BindToExpression:
case SyntaxKind.OperatorExpression:
return true;
case SyntaxKind.QualifiedName:
while (node.parent.kind === SyntaxKind.QualifiedName) {