| 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 "dart:math" as math; | 10 import "dart:math" as math; |
| (...skipping 3436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3447 /** | 3447 /** |
| 3448 * Return the content of a string with the given literal representation. The | 3448 * Return the content of a string with the given literal representation. The |
| 3449 * [lexeme] is the literal representation of the string. The flag [isFirst] is | 3449 * [lexeme] is the literal representation of the string. The flag [isFirst] is |
| 3450 * `true` if this is the first token in a string literal. The flag [isLast] is | 3450 * `true` if this is the first token in a string literal. The flag [isLast] is |
| 3451 * `true` if this is the last token in a string literal. | 3451 * `true` if this is the last token in a string literal. |
| 3452 */ | 3452 */ |
| 3453 String _computeStringValue(String lexeme, bool isFirst, bool isLast) { | 3453 String _computeStringValue(String lexeme, bool isFirst, bool isLast) { |
| 3454 StringLexemeHelper helper = new StringLexemeHelper(lexeme, isFirst, isLast); | 3454 StringLexemeHelper helper = new StringLexemeHelper(lexeme, isFirst, isLast); |
| 3455 int start = helper.start; | 3455 int start = helper.start; |
| 3456 int end = helper.end; | 3456 int end = helper.end; |
| 3457 if (end - start + 1 < 0) { | 3457 bool stringEndsAfterStart = end >= start; |
| 3458 assert(stringEndsAfterStart); |
| 3459 if (!stringEndsAfterStart) { |
| 3458 AnalysisEngine.instance.logger.logError( | 3460 AnalysisEngine.instance.logger.logError( |
| 3459 "Internal error: computeStringValue($lexeme, $isFirst, $isLast)"); | 3461 "Internal error: computeStringValue($lexeme, $isFirst, $isLast)"); |
| 3460 return ""; | 3462 return ""; |
| 3461 } | 3463 } |
| 3462 if (helper.isRaw) { | 3464 if (helper.isRaw) { |
| 3463 return lexeme.substring(start, end); | 3465 return lexeme.substring(start, end); |
| 3464 } | 3466 } |
| 3465 StringBuffer buffer = new StringBuffer(); | 3467 StringBuffer buffer = new StringBuffer(); |
| 3466 int index = start; | 3468 int index = start; |
| 3467 while (index < end) { | 3469 while (index < end) { |
| (...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4221 bool wasInInitializer = _inInitializer; | 4223 bool wasInInitializer = _inInitializer; |
| 4222 _inInitializer = false; | 4224 _inInitializer = false; |
| 4223 try { | 4225 try { |
| 4224 Expression index = parseExpression2(); | 4226 Expression index = parseExpression2(); |
| 4225 Token rightBracket = _expect(TokenType.CLOSE_SQUARE_BRACKET); | 4227 Token rightBracket = _expect(TokenType.CLOSE_SQUARE_BRACKET); |
| 4226 return new IndexExpression.forTarget( | 4228 return new IndexExpression.forTarget( |
| 4227 prefix, leftBracket, index, rightBracket); | 4229 prefix, leftBracket, index, rightBracket); |
| 4228 } finally { | 4230 } finally { |
| 4229 _inInitializer = wasInInitializer; | 4231 _inInitializer = wasInInitializer; |
| 4230 } | 4232 } |
| 4231 } else if (_matches(TokenType.PERIOD) || _matches(TokenType.QUESTION_PERIOD)
) { | 4233 } else if (_matches(TokenType.PERIOD) || |
| 4234 _matches(TokenType.QUESTION_PERIOD)) { |
| 4232 Token operator = getAndAdvance(); | 4235 Token operator = getAndAdvance(); |
| 4233 return new PropertyAccess(prefix, operator, parseSimpleIdentifier()); | 4236 return new PropertyAccess(prefix, operator, parseSimpleIdentifier()); |
| 4234 } else { | 4237 } else { |
| 4235 if (!optional) { | 4238 if (!optional) { |
| 4236 // Report the missing selector. | 4239 // Report the missing selector. |
| 4237 _reportErrorForCurrentToken( | 4240 _reportErrorForCurrentToken( |
| 4238 ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR); | 4241 ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR); |
| 4239 } | 4242 } |
| 4240 return prefix; | 4243 return prefix; |
| 4241 } | 4244 } |
| (...skipping 3573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7815 Token token = _skipSimpleIdentifier(startToken); | 7818 Token token = _skipSimpleIdentifier(startToken); |
| 7816 if (token == null) { | 7819 if (token == null) { |
| 7817 return null; | 7820 return null; |
| 7818 } else if (!_tokenMatches(token, TokenType.PERIOD)) { | 7821 } else if (!_tokenMatches(token, TokenType.PERIOD)) { |
| 7819 return token; | 7822 return token; |
| 7820 } | 7823 } |
| 7821 token = token.next; | 7824 token = token.next; |
| 7822 Token nextToken = _skipSimpleIdentifier(token); | 7825 Token nextToken = _skipSimpleIdentifier(token); |
| 7823 if (nextToken != null) { | 7826 if (nextToken != null) { |
| 7824 return nextToken; | 7827 return nextToken; |
| 7825 } else if (_tokenMatches(token, TokenType.CLOSE_PAREN) | 7828 } else if (_tokenMatches(token, TokenType.CLOSE_PAREN) || |
| 7826 || _tokenMatches(token, TokenType.COMMA)) { | 7829 _tokenMatches(token, TokenType.COMMA)) { |
| 7827 // If the `id.` is followed by something that cannot produce a valid | 7830 // If the `id.` is followed by something that cannot produce a valid |
| 7828 // structure then assume this is a prefixed identifier but missing the | 7831 // structure then assume this is a prefixed identifier but missing the |
| 7829 // trailing identifier | 7832 // trailing identifier |
| 7830 return token; | 7833 return token; |
| 7831 } | 7834 } |
| 7832 return null; | 7835 return null; |
| 7833 } | 7836 } |
| 7834 | 7837 |
| 7835 /** | 7838 /** |
| 7836 * Parse a return type, starting at the [startToken], without actually | 7839 * Parse a return type, starting at the [startToken], without actually |
| (...skipping 2706 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10543 } | 10546 } |
| 10544 | 10547 |
| 10545 /** | 10548 /** |
| 10546 * Copy resolution data from the [fromNode] to the [toNode]. | 10549 * Copy resolution data from the [fromNode] to the [toNode]. |
| 10547 */ | 10550 */ |
| 10548 static void copyResolutionData(AstNode fromNode, AstNode toNode) { | 10551 static void copyResolutionData(AstNode fromNode, AstNode toNode) { |
| 10549 ResolutionCopier copier = new ResolutionCopier(); | 10552 ResolutionCopier copier = new ResolutionCopier(); |
| 10550 copier._isEqualNodes(fromNode, toNode); | 10553 copier._isEqualNodes(fromNode, toNode); |
| 10551 } | 10554 } |
| 10552 } | 10555 } |
| OLD | NEW |