mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-13 05:37:13 -05:00
Move grammar checking: prefixUnaryExpression; There are still error from incomplete migration
This commit is contained in:
@@ -6599,6 +6599,16 @@ module ts {
|
||||
}
|
||||
|
||||
function checkPrefixUnaryExpression(node: PrefixUnaryExpression): Type {
|
||||
// Grammar checking
|
||||
if (node.parserContextFlags & ParserContextFlags.StrictMode) {
|
||||
// The identifier eval or arguments may not appear as the LeftHandSideExpression of an
|
||||
// Assignment operator(11.13) or of a PostfixExpression(11.3) or as the UnaryExpression
|
||||
// operated upon by a Prefix Increment(11.4.4) or a Prefix Decrement(11.4.5) operator
|
||||
if ((node.operator === SyntaxKind.PlusPlusToken || node.operator === SyntaxKind.MinusMinusToken) && isEvalOrArgumentsIdentifier(node.operand)) {
|
||||
reportGrammarErrorOfInvalidUseInStrictMode(<Identifier>node.operand);
|
||||
}
|
||||
}
|
||||
|
||||
var operandType = checkExpression(node.operand);
|
||||
switch (node.operator) {
|
||||
case SyntaxKind.PlusToken:
|
||||
|
||||
@@ -4661,7 +4661,7 @@ module ts {
|
||||
//case SyntaxKind.NumericLiteral: return checkNumericLiteral(<LiteralExpression>node);
|
||||
//case SyntaxKind.Parameter: return checkParameter(<ParameterDeclaration>node);
|
||||
//case SyntaxKind.PostfixUnaryExpression: return checkPostfixUnaryExpression(<PostfixUnaryExpression>node);
|
||||
case SyntaxKind.PrefixUnaryExpression: return checkPrefixUnaryExpression(<PrefixUnaryExpression>node);
|
||||
//case SyntaxKind.PrefixUnaryExpression: return checkPrefixUnaryExpression(<PrefixUnaryExpression>node);
|
||||
case SyntaxKind.PropertyDeclaration:
|
||||
case SyntaxKind.PropertySignature:
|
||||
return checkProperty(<PropertyDeclaration>node);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
tests/cases/compiler/unaryOperatorsInStrictMode.ts(3,3): error TS1100: Invalid use of 'eval' in strict mode.
|
||||
tests/cases/compiler/unaryOperatorsInStrictMode.ts(4,3): error TS1100: Invalid use of 'eval' in strict mode.
|
||||
tests/cases/compiler/unaryOperatorsInStrictMode.ts(5,3): error TS1100: Invalid use of 'arguments' in strict mode.
|
||||
tests/cases/compiler/unaryOperatorsInStrictMode.ts(6,3): error TS1100: Invalid use of 'arguments' in strict mode.
|
||||
tests/cases/compiler/unaryOperatorsInStrictMode.ts(3,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/compiler/unaryOperatorsInStrictMode.ts(4,3): error TS1100: Invalid use of 'eval' in strict mode.
|
||||
tests/cases/compiler/unaryOperatorsInStrictMode.ts(4,3): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
||||
tests/cases/compiler/unaryOperatorsInStrictMode.ts(5,3): error TS1100: Invalid use of 'arguments' in strict mode.
|
||||
tests/cases/compiler/unaryOperatorsInStrictMode.ts(5,3): error TS2304: Cannot find name 'arguments'.
|
||||
tests/cases/compiler/unaryOperatorsInStrictMode.ts(6,3): error TS1100: Invalid use of 'arguments' in strict mode.
|
||||
tests/cases/compiler/unaryOperatorsInStrictMode.ts(6,3): error TS2304: Cannot find name 'arguments'.
|
||||
tests/cases/compiler/unaryOperatorsInStrictMode.ts(7,1): error TS1100: Invalid use of 'eval' in strict mode.
|
||||
tests/cases/compiler/unaryOperatorsInStrictMode.ts(7,1): error TS2356: An arithmetic operand must be of type 'any', 'number' or an enum type.
|
||||
|
||||
Reference in New Issue
Block a user