| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine.parser; | 8 library engine.parser; |
| 9 | 9 |
| 10 import 'java_core.dart'; | 10 import 'java_core.dart'; |
| (...skipping 2031 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2042 Token period = null; | 2042 Token period = null; |
| 2043 SimpleIdentifier name = null; | 2043 SimpleIdentifier name = null; |
| 2044 if (_matches(TokenType.PERIOD)) { | 2044 if (_matches(TokenType.PERIOD)) { |
| 2045 period = andAdvance; | 2045 period = andAdvance; |
| 2046 name = parseSimpleIdentifier(); | 2046 name = parseSimpleIdentifier(); |
| 2047 } | 2047 } |
| 2048 return new ConstructorName(type, period, name); | 2048 return new ConstructorName(type, period, name); |
| 2049 } | 2049 } |
| 2050 | 2050 |
| 2051 /** | 2051 /** |
| 2052 * Parse an expression that does not contain any cascades. | 2052 * Parse an expression that might contain a cascade. |
| 2053 * | 2053 * |
| 2054 * <pre> | 2054 * <pre> |
| 2055 * expression ::= | 2055 * expression ::= |
| 2056 * assignableExpression assignmentOperator expression | 2056 * assignableExpression assignmentOperator expression |
| 2057 * | conditionalExpression cascadeSection* | 2057 * | conditionalExpression cascadeSection* |
| 2058 * | throwExpression | 2058 * | throwExpression |
| 2059 * </pre> | 2059 * </pre> |
| 2060 * | 2060 * |
| 2061 * @return the expression that was parsed | 2061 * @return the expression that was parsed |
| 2062 */ | 2062 */ |
| (...skipping 1459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3522 * Parse an assignable selector. | 3522 * Parse an assignable selector. |
| 3523 * | 3523 * |
| 3524 * <pre> | 3524 * <pre> |
| 3525 * assignableSelector ::= | 3525 * assignableSelector ::= |
| 3526 * '[' expression ']' | 3526 * '[' expression ']' |
| 3527 * | '.' identifier | 3527 * | '.' identifier |
| 3528 * </pre> | 3528 * </pre> |
| 3529 * | 3529 * |
| 3530 * @param prefix the expression preceding the selector | 3530 * @param prefix the expression preceding the selector |
| 3531 * @param optional `true` if the selector is optional | 3531 * @param optional `true` if the selector is optional |
| 3532 * @return the assignable selector that was parsed | 3532 * @return the assignable selector that was parsed, or the original prefix if
there was no |
| 3533 * assignable selector |
| 3533 */ | 3534 */ |
| 3534 Expression _parseAssignableSelector(Expression prefix, bool optional) { | 3535 Expression _parseAssignableSelector(Expression prefix, bool optional) { |
| 3535 if (_matches(TokenType.OPEN_SQUARE_BRACKET)) { | 3536 if (_matches(TokenType.OPEN_SQUARE_BRACKET)) { |
| 3536 Token leftBracket = andAdvance; | 3537 Token leftBracket = andAdvance; |
| 3537 bool wasInInitializer = _inInitializer; | 3538 bool wasInInitializer = _inInitializer; |
| 3538 _inInitializer = false; | 3539 _inInitializer = false; |
| 3539 try { | 3540 try { |
| 3540 Expression index = parseExpression2(); | 3541 Expression index = parseExpression2(); |
| 3541 Token rightBracket = _expect(TokenType.CLOSE_SQUARE_BRACKET); | 3542 Token rightBracket = _expect(TokenType.CLOSE_SQUARE_BRACKET); |
| 3542 return new IndexExpression.forTarget(prefix, leftBracket, index, rightBr
acket); | 3543 return new IndexExpression.forTarget(prefix, leftBracket, index, rightBr
acket); |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3660 Token rightBracket = _expect(TokenType.CLOSE_SQUARE_BRACKET); | 3661 Token rightBracket = _expect(TokenType.CLOSE_SQUARE_BRACKET); |
| 3661 expression = new IndexExpression.forCascade(period, leftBracket, index,
rightBracket); | 3662 expression = new IndexExpression.forCascade(period, leftBracket, index,
rightBracket); |
| 3662 period = null; | 3663 period = null; |
| 3663 } finally { | 3664 } finally { |
| 3664 _inInitializer = wasInInitializer; | 3665 _inInitializer = wasInInitializer; |
| 3665 } | 3666 } |
| 3666 } else { | 3667 } else { |
| 3667 _reportErrorForToken(ParserErrorCode.MISSING_IDENTIFIER, _currentToken, [_
currentToken.lexeme]); | 3668 _reportErrorForToken(ParserErrorCode.MISSING_IDENTIFIER, _currentToken, [_
currentToken.lexeme]); |
| 3668 functionName = _createSyntheticIdentifier(); | 3669 functionName = _createSyntheticIdentifier(); |
| 3669 } | 3670 } |
| 3671 assert((expression == null && functionName != null) || (expression != null &
& functionName == null)); |
| 3670 if (_currentToken.type == TokenType.OPEN_PAREN) { | 3672 if (_currentToken.type == TokenType.OPEN_PAREN) { |
| 3671 while (_currentToken.type == TokenType.OPEN_PAREN) { | 3673 while (_currentToken.type == TokenType.OPEN_PAREN) { |
| 3672 if (functionName != null) { | 3674 if (functionName != null) { |
| 3673 expression = new MethodInvocation(expression, period, functionName, pa
rseArgumentList()); | 3675 expression = new MethodInvocation(expression, period, functionName, pa
rseArgumentList()); |
| 3674 period = null; | 3676 period = null; |
| 3675 functionName = null; | 3677 functionName = null; |
| 3676 } else if (expression == null) { | 3678 } else if (expression == null) { |
| 3677 // It should not be possible to get here. | 3679 // It should not be possible to get here. |
| 3678 expression = new MethodInvocation(expression, period, _createSynthetic
Identifier(), parseArgumentList()); | 3680 expression = new MethodInvocation(expression, period, _createSynthetic
Identifier(), parseArgumentList()); |
| 3679 } else { | 3681 } else { |
| 3680 expression = new FunctionExpressionInvocation(expression, parseArgumen
tList()); | 3682 expression = new FunctionExpressionInvocation(expression, parseArgumen
tList()); |
| 3681 } | 3683 } |
| 3682 } | 3684 } |
| 3683 } else if (functionName != null) { | 3685 } else if (functionName != null) { |
| 3684 expression = new PropertyAccess(expression, period, functionName); | 3686 expression = new PropertyAccess(expression, period, functionName); |
| 3685 period = null; | 3687 period = null; |
| 3686 } | 3688 } |
| 3689 assert(expression != null); |
| 3687 bool progress = true; | 3690 bool progress = true; |
| 3688 while (progress) { | 3691 while (progress) { |
| 3689 progress = false; | 3692 progress = false; |
| 3690 Expression selector = _parseAssignableSelector(expression, true); | 3693 Expression selector = _parseAssignableSelector(expression, true); |
| 3691 if (!identical(selector, expression)) { | 3694 if (!identical(selector, expression)) { |
| 3692 expression = selector; | 3695 expression = selector; |
| 3693 progress = true; | 3696 progress = true; |
| 3694 while (_currentToken.type == TokenType.OPEN_PAREN) { | 3697 while (_currentToken.type == TokenType.OPEN_PAREN) { |
| 3695 if (expression is PropertyAccess) { | 3698 if (expression is PropertyAccess) { |
| 3696 PropertyAccess propertyAccess = expression as PropertyAccess; | 3699 PropertyAccess propertyAccess = expression as PropertyAccess; |
| (...skipping 5380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 9077 return trampoline(target, arguments[0], arguments[1]); | 9080 return trampoline(target, arguments[0], arguments[1]); |
| 9078 case 3: | 9081 case 3: |
| 9079 return trampoline(target, arguments[0], arguments[1], arguments[2]); | 9082 return trampoline(target, arguments[0], arguments[1], arguments[2]); |
| 9080 case 4: | 9083 case 4: |
| 9081 return trampoline(target, arguments[0], arguments[1], arguments[2], argu
ments[3]); | 9084 return trampoline(target, arguments[0], arguments[1], arguments[2], argu
ments[3]); |
| 9082 default: | 9085 default: |
| 9083 throw new IllegalArgumentException("Not implemented for > 4 arguments"); | 9086 throw new IllegalArgumentException("Not implemented for > 4 arguments"); |
| 9084 } | 9087 } |
| 9085 } | 9088 } |
| 9086 } | 9089 } |
| OLD | NEW |