Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Side by Side Diff: pkg/analyzer/lib/src/generated/parser.dart

Issue 221483002: Fix for translation of \!= to \!identical(), but use == and \!= for Enum. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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';
11 import 'java_engine.dart'; 11 import 'java_engine.dart';
12 import 'instrumentation.dart'; 12 import 'instrumentation.dart';
13 import 'error.dart'; 13 import 'error.dart';
14 import 'source.dart'; 14 import 'source.dart';
15 import 'scanner.dart'; 15 import 'scanner.dart';
16 import 'ast.dart'; 16 import 'ast.dart';
17 import 'utilities_dart.dart'; 17 import 'utilities_dart.dart';
18 import 'engine.dart' show AnalysisEngine; 18 import 'engine.dart' show AnalysisEngine;
19 import 'utilities_collection.dart' show TokenMap; 19 import 'utilities_collection.dart' show TokenMap;
20 20
21 /** 21 /**
22 * Instances of the class `CommentAndMetadata` implement a simple data-holder fo r a method 22 * Instances of the class `CommentAndMetadata` implement a simple data-holder fo r a method
23 * that needs to return multiple values. 23 * that needs to return multiple values.
24 */ 24 */
25 class CommentAndMetadata { 25 class CommentAndMetadata {
26 /** 26 /**
27 * The documentation comment that was parsed, or `null` if none was given. 27 * The documentation comment that was parsed, or `null` if none was given.
28 */ 28 */
29 Comment comment; 29 final Comment comment;
30 30
31 /** 31 /**
32 * The metadata that was parsed. 32 * The metadata that was parsed.
33 */ 33 */
34 List<Annotation> metadata; 34 final List<Annotation> metadata;
35 35
36 /** 36 /**
37 * Initialize a newly created holder with the given data. 37 * Initialize a newly created holder with the given data.
38 * 38 *
39 * @param comment the documentation comment that was parsed 39 * @param comment the documentation comment that was parsed
40 * @param metadata the metadata that was parsed 40 * @param metadata the metadata that was parsed
41 */ 41 */
42 CommentAndMetadata(Comment comment, List<Annotation> metadata) { 42 CommentAndMetadata(this.comment, this.metadata);
43 this.comment = comment;
44 this.metadata = metadata;
45 }
46 } 43 }
47 44
48 /** 45 /**
49 * Instances of the class `FinalConstVarOrType` implement a simple data-holder f or a method 46 * Instances of the class `FinalConstVarOrType` implement a simple data-holder f or a method
50 * that needs to return multiple values. 47 * that needs to return multiple values.
51 */ 48 */
52 class FinalConstVarOrType { 49 class FinalConstVarOrType {
53 /** 50 /**
54 * The 'final', 'const' or 'var' keyword, or `null` if none was given. 51 * The 'final', 'const' or 'var' keyword, or `null` if none was given.
55 */ 52 */
56 Token keyword; 53 final Token keyword;
57 54
58 /** 55 /**
59 * The type, of `null` if no type was specified. 56 * The type, of `null` if no type was specified.
60 */ 57 */
61 TypeName type; 58 final TypeName type;
62 59
63 /** 60 /**
64 * Initialize a newly created holder with the given data. 61 * Initialize a newly created holder with the given data.
65 * 62 *
66 * @param keyword the 'final', 'const' or 'var' keyword 63 * @param keyword the 'final', 'const' or 'var' keyword
67 * @param type the type 64 * @param type the type
68 */ 65 */
69 FinalConstVarOrType(Token keyword, TypeName type) { 66 FinalConstVarOrType(this.keyword, this.type);
70 this.keyword = keyword;
71 this.type = type;
72 }
73 } 67 }
74 68
75 /** 69 /**
76 * Instances of the class `Modifiers` implement a simple data-holder for a metho d that needs 70 * Instances of the class `Modifiers` implement a simple data-holder for a metho d that needs
77 * to return multiple values. 71 * to return multiple values.
78 */ 72 */
79 class Modifiers { 73 class Modifiers {
80 /** 74 /**
81 * The token representing the keyword 'abstract', or `null` if the keyword was not found. 75 * The token representing the keyword 'abstract', or `null` if the keyword was not found.
82 */ 76 */
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 * Instances of the class `IncrementalParseDispatcher` implement a dispatcher th at will invoke 144 * Instances of the class `IncrementalParseDispatcher` implement a dispatcher th at will invoke
151 * the right parse method when re-parsing a specified child of the visited node. All of the methods 145 * the right parse method when re-parsing a specified child of the visited node. All of the methods
152 * in this class assume that the parser is positioned to parse the replacement f or the node. All of 146 * in this class assume that the parser is positioned to parse the replacement f or the node. All of
153 * the methods will throw an [IncrementalParseException] if the node could not b e parsed for 147 * the methods will throw an [IncrementalParseException] if the node could not b e parsed for
154 * some reason. 148 * some reason.
155 */ 149 */
156 class IncrementalParseDispatcher implements AstVisitor<AstNode> { 150 class IncrementalParseDispatcher implements AstVisitor<AstNode> {
157 /** 151 /**
158 * The parser used to parse the replacement for the node. 152 * The parser used to parse the replacement for the node.
159 */ 153 */
160 Parser _parser; 154 final Parser _parser;
161 155
162 /** 156 /**
163 * The node that is to be replaced. 157 * The node that is to be replaced.
164 */ 158 */
165 AstNode _oldNode; 159 final AstNode _oldNode;
166 160
167 /** 161 /**
168 * Initialize a newly created dispatcher to parse a single node that will repl ace the given node. 162 * Initialize a newly created dispatcher to parse a single node that will repl ace the given node.
169 * 163 *
170 * @param parser the parser used to parse the replacement for the node 164 * @param parser the parser used to parse the replacement for the node
171 * @param oldNode the node that is to be replaced 165 * @param oldNode the node that is to be replaced
172 */ 166 */
173 IncrementalParseDispatcher(Parser parser, AstNode oldNode) { 167 IncrementalParseDispatcher(this._parser, this._oldNode);
174 this._parser = parser;
175 this._oldNode = oldNode;
176 }
177 168
178 @override 169 @override
179 AstNode visitAdjacentStrings(AdjacentStrings node) { 170 AstNode visitAdjacentStrings(AdjacentStrings node) {
180 if (node.strings.contains(_oldNode)) { 171 if (node.strings.contains(_oldNode)) {
181 return _parser.parseStringLiteral(); 172 return _parser.parseStringLiteral();
182 } 173 }
183 return _notAChild(node); 174 return _notAChild(node);
184 } 175 }
185 176
186 @override 177 @override
(...skipping 1055 matching lines...) Expand 10 before | Expand all | Expand 10 after
1242 } 1233 }
1243 1234
1244 /** 1235 /**
1245 * Instances of the class `IncrementalParser` re-parse a single AST structure wi thin a larger 1236 * Instances of the class `IncrementalParser` re-parse a single AST structure wi thin a larger
1246 * AST structure. 1237 * AST structure.
1247 */ 1238 */
1248 class IncrementalParser { 1239 class IncrementalParser {
1249 /** 1240 /**
1250 * The source being parsed. 1241 * The source being parsed.
1251 */ 1242 */
1252 Source _source; 1243 final Source _source;
1253 1244
1254 /** 1245 /**
1255 * A map from old tokens to new tokens used during the cloning process. 1246 * A map from old tokens to new tokens used during the cloning process.
1256 */ 1247 */
1257 TokenMap _tokenMap; 1248 final TokenMap _tokenMap;
1258 1249
1259 /** 1250 /**
1260 * The error listener that will be informed of any errors that are found durin g the parse. 1251 * The error listener that will be informed of any errors that are found durin g the parse.
1261 */ 1252 */
1262 AnalysisErrorListener _errorListener; 1253 final AnalysisErrorListener _errorListener;
1263 1254
1264 /** 1255 /**
1265 * The node in the AST structure that contains the revised content. 1256 * The node in the AST structure that contains the revised content.
1266 */ 1257 */
1267 AstNode _updatedNode; 1258 AstNode _updatedNode;
1268 1259
1269 /** 1260 /**
1270 * Initialize a newly created incremental parser to parse a portion of the con tent of the given 1261 * Initialize a newly created incremental parser to parse a portion of the con tent of the given
1271 * source. 1262 * source.
1272 * 1263 *
1273 * @param source the source being parsed 1264 * @param source the source being parsed
1274 * @param tokenMap a map from old tokens to new tokens used during the cloning process 1265 * @param tokenMap a map from old tokens to new tokens used during the cloning process
1275 * @param errorListener the error listener that will be informed of any errors that are found 1266 * @param errorListener the error listener that will be informed of any errors that are found
1276 * during the parse 1267 * during the parse
1277 */ 1268 */
1278 IncrementalParser(Source source, TokenMap tokenMap, AnalysisErrorListener erro rListener) { 1269 IncrementalParser(this._source, this._tokenMap, this._errorListener);
1279 this._source = source;
1280 this._tokenMap = tokenMap;
1281 this._errorListener = errorListener;
1282 }
1283 1270
1284 /** 1271 /**
1285 * Return the node in the AST structure that contains the revised content. 1272 * Return the node in the AST structure that contains the revised content.
1286 * 1273 *
1287 * @return the updated node 1274 * @return the updated node
1288 */ 1275 */
1289 AstNode get updatedNode => _updatedNode; 1276 AstNode get updatedNode => _updatedNode;
1290 1277
1291 /** 1278 /**
1292 * Given a range of tokens that were re-scanned, re-parse the minimum number o f tokens to produce 1279 * Given a range of tokens that were re-scanned, re-parse the minimum number o f tokens to produce
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1432 InsufficientContextException.con2(Exception cause) : super.con2(cause); 1419 InsufficientContextException.con2(Exception cause) : super.con2(cause);
1433 } 1420 }
1434 1421
1435 /** 1422 /**
1436 * Instances of the class `Parser` are used to parse tokens into an AST structur e. 1423 * Instances of the class `Parser` are used to parse tokens into an AST structur e.
1437 */ 1424 */
1438 class Parser { 1425 class Parser {
1439 /** 1426 /**
1440 * The source being parsed. 1427 * The source being parsed.
1441 */ 1428 */
1442 Source _source; 1429 final Source _source;
1443 1430
1444 /** 1431 /**
1445 * The error listener that will be informed of any errors that are found durin g the parse. 1432 * The error listener that will be informed of any errors that are found durin g the parse.
1446 */ 1433 */
1447 AnalysisErrorListener _errorListener; 1434 final AnalysisErrorListener _errorListener;
1448 1435
1449 /** 1436 /**
1450 * An [errorListener] lock, if more than `0`, then errors are not reported. 1437 * An [errorListener] lock, if more than `0`, then errors are not reported.
1451 */ 1438 */
1452 int _errorListenerLock = 0; 1439 int _errorListenerLock = 0;
1453 1440
1454 /** 1441 /**
1455 * A flag indicating whether parser is to parse function bodies. 1442 * A flag indicating whether parser is to parse function bodies.
1456 */ 1443 */
1457 bool _parseFunctionBodies = true; 1444 bool _parseFunctionBodies = true;
(...skipping 23 matching lines...) Expand all
1481 1468
1482 static String _SHOW = "show"; 1469 static String _SHOW = "show";
1483 1470
1484 /** 1471 /**
1485 * Initialize a newly created parser. 1472 * Initialize a newly created parser.
1486 * 1473 *
1487 * @param source the source being parsed 1474 * @param source the source being parsed
1488 * @param errorListener the error listener that will be informed of any errors that are found 1475 * @param errorListener the error listener that will be informed of any errors that are found
1489 * during the parse 1476 * during the parse
1490 */ 1477 */
1491 Parser(Source source, AnalysisErrorListener errorListener) { 1478 Parser(this._source, this._errorListener);
1492 this._source = source;
1493 this._errorListener = errorListener;
1494 }
1495 1479
1496 /** 1480 /**
1497 * Parse a compilation unit, starting with the given token. 1481 * Parse a compilation unit, starting with the given token.
1498 * 1482 *
1499 * @param token the first token of the compilation unit 1483 * @param token the first token of the compilation unit
1500 * @return the compilation unit that was parsed 1484 * @return the compilation unit that was parsed
1501 */ 1485 */
1502 CompilationUnit parseCompilationUnit(Token token) { 1486 CompilationUnit parseCompilationUnit(Token token) {
1503 InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engi ne.Parser.parseCompilationUnit"); 1487 InstrumentationBuilder instrumentation = Instrumentation.builder2("dart.engi ne.Parser.parseCompilationUnit");
1504 try { 1488 try {
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
2039 } else if (_matchesKeyword(Keyword.RETHROW)) { 2023 } else if (_matchesKeyword(Keyword.RETHROW)) {
2040 return _parseRethrowExpression(); 2024 return _parseRethrowExpression();
2041 } 2025 }
2042 // 2026 //
2043 // assignableExpression is a subset of conditionalExpression, so we can pars e a conditional 2027 // assignableExpression is a subset of conditionalExpression, so we can pars e a conditional
2044 // expression and then determine whether it is followed by an assignmentOper ator, checking for 2028 // expression and then determine whether it is followed by an assignmentOper ator, checking for
2045 // conformance to the restricted grammar after making that determination. 2029 // conformance to the restricted grammar after making that determination.
2046 // 2030 //
2047 Expression expression = parseConditionalExpression(); 2031 Expression expression = parseConditionalExpression();
2048 TokenType tokenType = _currentToken.type; 2032 TokenType tokenType = _currentToken.type;
2049 if (identical(tokenType, TokenType.PERIOD_PERIOD)) { 2033 if (tokenType == TokenType.PERIOD_PERIOD) {
2050 List<Expression> cascadeSections = new List<Expression>(); 2034 List<Expression> cascadeSections = new List<Expression>();
2051 while (identical(tokenType, TokenType.PERIOD_PERIOD)) { 2035 while (tokenType == TokenType.PERIOD_PERIOD) {
2052 Expression section = _parseCascadeSection(); 2036 Expression section = _parseCascadeSection();
2053 if (section != null) { 2037 if (section != null) {
2054 cascadeSections.add(section); 2038 cascadeSections.add(section);
2055 } 2039 }
2056 tokenType = _currentToken.type; 2040 tokenType = _currentToken.type;
2057 } 2041 }
2058 return new CascadeExpression(expression, cascadeSections); 2042 return new CascadeExpression(expression, cascadeSections);
2059 } else if (tokenType.isAssignmentOperator) { 2043 } else if (tokenType.isAssignmentOperator) {
2060 Token operator = andAdvance; 2044 Token operator = andAdvance;
2061 _ensureAssignable(expression); 2045 _ensureAssignable(expression);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
2205 leftCurlyBracket = andAdvance; 2189 leftCurlyBracket = andAdvance;
2206 currentParameters = namedParameters; 2190 currentParameters = namedParameters;
2207 kind = ParameterKind.NAMED; 2191 kind = ParameterKind.NAMED;
2208 } 2192 }
2209 // 2193 //
2210 // Parse and record the parameter. 2194 // Parse and record the parameter.
2211 // 2195 //
2212 FormalParameter parameter = _parseFormalParameter(kind); 2196 FormalParameter parameter = _parseFormalParameter(kind);
2213 parameters.add(parameter); 2197 parameters.add(parameter);
2214 currentParameters.add(parameter); 2198 currentParameters.add(parameter);
2215 if (identical(kind, ParameterKind.REQUIRED) && wasOptionalParameter) { 2199 if (kind == ParameterKind.REQUIRED && wasOptionalParameter) {
2216 _reportErrorForNode(ParserErrorCode.NORMAL_BEFORE_OPTIONAL_PARAMETERS, p arameter, []); 2200 _reportErrorForNode(ParserErrorCode.NORMAL_BEFORE_OPTIONAL_PARAMETERS, p arameter, []);
2217 } 2201 }
2218 // 2202 //
2219 // Handle the end of parameter groups. 2203 // Handle the end of parameter groups.
2220 // 2204 //
2221 // TODO(brianwilkerson) Improve the detection and reporting of missing and mismatched delimiters. 2205 // TODO(brianwilkerson) Improve the detection and reporting of missing and mismatched delimiters.
2222 if (_matches(TokenType.CLOSE_SQUARE_BRACKET)) { 2206 if (_matches(TokenType.CLOSE_SQUARE_BRACKET)) {
2223 rightSquareBracket = andAdvance; 2207 rightSquareBracket = andAdvance;
2224 currentParameters = normalParameters; 2208 currentParameters = normalParameters;
2225 if (leftSquareBracket == null) { 2209 if (leftSquareBracket == null) {
(...skipping 13 matching lines...) Expand all
2239 if (leftSquareBracket != null) { 2223 if (leftSquareBracket != null) {
2240 _reportErrorForCurrentToken(ParserErrorCode.WRONG_TERMINATOR_FOR_PAR AMETER_GROUP, ["]"]); 2224 _reportErrorForCurrentToken(ParserErrorCode.WRONG_TERMINATOR_FOR_PAR AMETER_GROUP, ["]"]);
2241 rightSquareBracket = rightCurlyBracket; 2225 rightSquareBracket = rightCurlyBracket;
2242 rightCurlyBracket = null; 2226 rightCurlyBracket = null;
2243 } else { 2227 } else {
2244 _reportErrorForCurrentToken(ParserErrorCode.UNEXPECTED_TERMINATOR_FO R_PARAMETER_GROUP, ["{"]); 2228 _reportErrorForCurrentToken(ParserErrorCode.UNEXPECTED_TERMINATOR_FO R_PARAMETER_GROUP, ["{"]);
2245 } 2229 }
2246 } 2230 }
2247 kind = ParameterKind.REQUIRED; 2231 kind = ParameterKind.REQUIRED;
2248 } 2232 }
2249 } while (!_matches(TokenType.CLOSE_PAREN) && initialToken != _currentToken); 2233 } while (!_matches(TokenType.CLOSE_PAREN) && !identical(initialToken, _curre ntToken));
2250 Token rightParenthesis = _expect(TokenType.CLOSE_PAREN); 2234 Token rightParenthesis = _expect(TokenType.CLOSE_PAREN);
2251 // 2235 //
2252 // Check that the groups were closed correctly. 2236 // Check that the groups were closed correctly.
2253 // 2237 //
2254 if (leftSquareBracket != null && rightSquareBracket == null) { 2238 if (leftSquareBracket != null && rightSquareBracket == null) {
2255 _reportErrorForCurrentToken(ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMET ER_GROUP, ["]"]); 2239 _reportErrorForCurrentToken(ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMET ER_GROUP, ["]"]);
2256 } 2240 }
2257 if (leftCurlyBracket != null && rightCurlyBracket == null) { 2241 if (leftCurlyBracket != null && rightCurlyBracket == null) {
2258 _reportErrorForCurrentToken(ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMET ER_GROUP, ["}"]); 2242 _reportErrorForCurrentToken(ParserErrorCode.MISSING_TERMINATOR_FOR_PARAMET ER_GROUP, ["}"]);
2259 } 2243 }
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
2785 return false; 2769 return false;
2786 } 2770 }
2787 2771
2788 /** 2772 /**
2789 * Create a synthetic identifier. 2773 * Create a synthetic identifier.
2790 * 2774 *
2791 * @return the synthetic identifier that was created 2775 * @return the synthetic identifier that was created
2792 */ 2776 */
2793 SimpleIdentifier _createSyntheticIdentifier() { 2777 SimpleIdentifier _createSyntheticIdentifier() {
2794 Token syntheticToken; 2778 Token syntheticToken;
2795 if (identical(_currentToken.type, TokenType.KEYWORD)) { 2779 if (_currentToken.type == TokenType.KEYWORD) {
2796 // Consider current keyword token as an identifier. 2780 // Consider current keyword token as an identifier.
2797 // It is not always true, e.g. "^is T" where "^" is place the place for sy nthetic identifier. 2781 // It is not always true, e.g. "^is T" where "^" is place the place for sy nthetic identifier.
2798 // By creating SyntheticStringToken we can distinguish a real identifier f rom synthetic. 2782 // By creating SyntheticStringToken we can distinguish a real identifier f rom synthetic.
2799 // In the code completion behavior will depend on a cursor position - befo re or on "is". 2783 // In the code completion behavior will depend on a cursor position - befo re or on "is".
2800 syntheticToken = _injectToken(new SyntheticStringToken(TokenType.IDENTIFIE R, _currentToken.lexeme, _currentToken.offset)); 2784 syntheticToken = _injectToken(new SyntheticStringToken(TokenType.IDENTIFIE R, _currentToken.lexeme, _currentToken.offset));
2801 } else { 2785 } else {
2802 syntheticToken = _createSyntheticToken(TokenType.IDENTIFIER); 2786 syntheticToken = _createSyntheticToken(TokenType.IDENTIFIER);
2803 } 2787 }
2804 return new SimpleIdentifier(syntheticToken); 2788 return new SimpleIdentifier(syntheticToken);
2805 } 2789 }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
2855 * 2839 *
2856 * @param type the type of token that is expected 2840 * @param type the type of token that is expected
2857 * @return the token that matched the given type 2841 * @return the token that matched the given type
2858 */ 2842 */
2859 Token _expect(TokenType type) { 2843 Token _expect(TokenType type) {
2860 if (_matches(type)) { 2844 if (_matches(type)) {
2861 return andAdvance; 2845 return andAdvance;
2862 } 2846 }
2863 // Remove uses of this method in favor of matches? 2847 // Remove uses of this method in favor of matches?
2864 // Pass in the error code to use to report the error? 2848 // Pass in the error code to use to report the error?
2865 if (identical(type, TokenType.SEMICOLON)) { 2849 if (type == TokenType.SEMICOLON) {
2866 _reportErrorForToken(ParserErrorCode.EXPECTED_TOKEN, _currentToken.previou s, [type.lexeme]); 2850 _reportErrorForToken(ParserErrorCode.EXPECTED_TOKEN, _currentToken.previou s, [type.lexeme]);
2867 } else { 2851 } else {
2868 _reportErrorForCurrentToken(ParserErrorCode.EXPECTED_TOKEN, [type.lexeme]) ; 2852 _reportErrorForCurrentToken(ParserErrorCode.EXPECTED_TOKEN, [type.lexeme]) ;
2869 } 2853 }
2870 return _currentToken; 2854 return _currentToken;
2871 } 2855 }
2872 2856
2873 /** 2857 /**
2874 * If the current token has the type [TokenType#GT], return it after advancing to the next 2858 * If the current token has the type [TokenType#GT], return it after advancing to the next
2875 * token. Otherwise report an error and return the current token without advan cing. 2859 * token. Otherwise report an error and return the current token without advan cing.
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
3149 Token token = _skipTypeName(_currentToken); 3133 Token token = _skipTypeName(_currentToken);
3150 if (token == null) { 3134 if (token == null) {
3151 // There was no type name, so this can't be a declaration. 3135 // There was no type name, so this can't be a declaration.
3152 return false; 3136 return false;
3153 } 3137 }
3154 token = _skipSimpleIdentifier(token); 3138 token = _skipSimpleIdentifier(token);
3155 if (token == null) { 3139 if (token == null) {
3156 return false; 3140 return false;
3157 } 3141 }
3158 TokenType type = token.type; 3142 TokenType type = token.type;
3159 return identical(type, TokenType.EQ) || identical(type, TokenType.COMMA) || identical(type, TokenType.SEMICOLON) || _tokenMatchesKeyword(token, Keyword.IN); 3143 return type == TokenType.EQ || type == TokenType.COMMA || type == TokenType. SEMICOLON || _tokenMatchesKeyword(token, Keyword.IN);
3160 } 3144 }
3161 3145
3162 /** 3146 /**
3163 * Given that we have just found bracketed text within a comment, look to see whether that text is 3147 * Given that we have just found bracketed text within a comment, look to see whether that text is
3164 * (a) followed by a parenthesized link address, (b) followed by a colon, or ( c) followed by 3148 * (a) followed by a parenthesized link address, (b) followed by a colon, or ( c) followed by
3165 * optional whitespace and another square bracket. 3149 * optional whitespace and another square bracket.
3166 * 3150 *
3167 * This method uses the syntax described by the <a 3151 * This method uses the syntax described by the <a
3168 * href="http://daringfireball.net/projects/markdown/syntax">markdown</a> proj ect. 3152 * href="http://daringfireball.net/projects/markdown/syntax">markdown</a> proj ect.
3169 * 3153 *
(...skipping 26 matching lines...) Expand all
3196 * 3180 *
3197 * @param startToken the token that might be the start of an operator declarat ion 3181 * @param startToken the token that might be the start of an operator declarat ion
3198 * @return `true` if the given token appears to be the beginning of an operato r declaration 3182 * @return `true` if the given token appears to be the beginning of an operato r declaration
3199 */ 3183 */
3200 bool _isOperator(Token startToken) { 3184 bool _isOperator(Token startToken) {
3201 // Accept any operator here, even if it is not user definable. 3185 // Accept any operator here, even if it is not user definable.
3202 if (!startToken.isOperator) { 3186 if (!startToken.isOperator) {
3203 return false; 3187 return false;
3204 } 3188 }
3205 // Token "=" means that it is actually field initializer. 3189 // Token "=" means that it is actually field initializer.
3206 if (identical(startToken.type, TokenType.EQ)) { 3190 if (startToken.type == TokenType.EQ) {
3207 return false; 3191 return false;
3208 } 3192 }
3209 // Consume all operator tokens. 3193 // Consume all operator tokens.
3210 Token token = startToken.next; 3194 Token token = startToken.next;
3211 while (token.isOperator) { 3195 while (token.isOperator) {
3212 token = token.next; 3196 token = token.next;
3213 } 3197 }
3214 // Formal parameter list is expect now. 3198 // Formal parameter list is expect now.
3215 return _tokenMatches(token, TokenType.OPEN_PAREN); 3199 return _tokenMatches(token, TokenType.OPEN_PAREN);
3216 } 3200 }
3217 3201
3218 /** 3202 /**
3219 * Return `true` if the current token appears to be the beginning of a switch member. 3203 * Return `true` if the current token appears to be the beginning of a switch member.
3220 * 3204 *
3221 * @return `true` if the current token appears to be the beginning of a switch member 3205 * @return `true` if the current token appears to be the beginning of a switch member
3222 */ 3206 */
3223 bool _isSwitchMember() { 3207 bool _isSwitchMember() {
3224 Token token = _currentToken; 3208 Token token = _currentToken;
3225 while (_tokenMatches(token, TokenType.IDENTIFIER) && _tokenMatches(token.nex t, TokenType.COLON)) { 3209 while (_tokenMatches(token, TokenType.IDENTIFIER) && _tokenMatches(token.nex t, TokenType.COLON)) {
3226 token = token.next.next; 3210 token = token.next.next;
3227 } 3211 }
3228 if (identical(token.type, TokenType.KEYWORD)) { 3212 if (token.type == TokenType.KEYWORD) {
3229 Keyword keyword = (token as KeywordToken).keyword; 3213 Keyword keyword = (token as KeywordToken).keyword;
3230 return identical(keyword, Keyword.CASE) || identical(keyword, Keyword.DEFA ULT); 3214 return keyword == Keyword.CASE || keyword == Keyword.DEFAULT;
3231 } 3215 }
3232 return false; 3216 return false;
3233 } 3217 }
3234 3218
3235 /** 3219 /**
3236 * Return `true` if the given token appears to be the first token of a type na me that is 3220 * Return `true` if the given token appears to be the first token of a type na me that is
3237 * followed by a variable or field formal parameter. 3221 * followed by a variable or field formal parameter.
3238 * 3222 *
3239 * @param startToken the first token of the sequence being checked 3223 * @param startToken the first token of the sequence being checked
3240 * @return `true` if there is a type name and variable starting at the given t oken 3224 * @return `true` if there is a type name and variable starting at the given t oken
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
3284 } 3268 }
3285 3269
3286 /** 3270 /**
3287 * Return `true` if the current token has the given type. Note that the method 3271 * Return `true` if the current token has the given type. Note that the method
3288 * [matchesGt] should be used if the argument to this method would be 3272 * [matchesGt] should be used if the argument to this method would be
3289 * [TokenType#GT]. 3273 * [TokenType#GT].
3290 * 3274 *
3291 * @param type the type of token that can optionally appear in the current loc ation 3275 * @param type the type of token that can optionally appear in the current loc ation
3292 * @return `true` if the current token has the given type 3276 * @return `true` if the current token has the given type
3293 */ 3277 */
3294 bool _matches(TokenType type) => identical(_currentToken.type, type); 3278 bool _matches(TokenType type) => _currentToken.type == type;
3295 3279
3296 /** 3280 /**
3297 * Return `true` if the current token has a type of [TokenType#GT]. Note that this 3281 * Return `true` if the current token has a type of [TokenType#GT]. Note that this
3298 * method, unlike other variants, will modify the token stream if possible to match desired type. 3282 * method, unlike other variants, will modify the token stream if possible to match desired type.
3299 * In particular, if the next token is either a '>>' or '>>>', the token strea m will be re-written 3283 * In particular, if the next token is either a '>>' or '>>>', the token strea m will be re-written
3300 * and `true` will be returned. 3284 * and `true` will be returned.
3301 * 3285 *
3302 * @return `true` if the current token has a type of [TokenType#GT] 3286 * @return `true` if the current token has a type of [TokenType#GT]
3303 */ 3287 */
3304 bool _matchesGt() { 3288 bool _matchesGt() {
3305 TokenType currentType = _currentToken.type; 3289 TokenType currentType = _currentToken.type;
3306 if (identical(currentType, TokenType.GT)) { 3290 if (currentType == TokenType.GT) {
3307 return true; 3291 return true;
3308 } else if (identical(currentType, TokenType.GT_GT)) { 3292 } else if (currentType == TokenType.GT_GT) {
3309 int offset = _currentToken.offset; 3293 int offset = _currentToken.offset;
3310 Token first = new Token(TokenType.GT, offset); 3294 Token first = new Token(TokenType.GT, offset);
3311 Token second = new Token(TokenType.GT, offset + 1); 3295 Token second = new Token(TokenType.GT, offset + 1);
3312 second.setNext(_currentToken.next); 3296 second.setNext(_currentToken.next);
3313 first.setNext(second); 3297 first.setNext(second);
3314 _currentToken.previous.setNext(first); 3298 _currentToken.previous.setNext(first);
3315 _currentToken = first; 3299 _currentToken = first;
3316 return true; 3300 return true;
3317 } else if (identical(currentType, TokenType.GT_EQ)) { 3301 } else if (currentType == TokenType.GT_EQ) {
3318 int offset = _currentToken.offset; 3302 int offset = _currentToken.offset;
3319 Token first = new Token(TokenType.GT, offset); 3303 Token first = new Token(TokenType.GT, offset);
3320 Token second = new Token(TokenType.EQ, offset + 1); 3304 Token second = new Token(TokenType.EQ, offset + 1);
3321 second.setNext(_currentToken.next); 3305 second.setNext(_currentToken.next);
3322 first.setNext(second); 3306 first.setNext(second);
3323 _currentToken.previous.setNext(first); 3307 _currentToken.previous.setNext(first);
3324 _currentToken = first; 3308 _currentToken = first;
3325 return true; 3309 return true;
3326 } else if (identical(currentType, TokenType.GT_GT_EQ)) { 3310 } else if (currentType == TokenType.GT_GT_EQ) {
3327 int offset = _currentToken.offset; 3311 int offset = _currentToken.offset;
3328 Token first = new Token(TokenType.GT, offset); 3312 Token first = new Token(TokenType.GT, offset);
3329 Token second = new Token(TokenType.GT, offset + 1); 3313 Token second = new Token(TokenType.GT, offset + 1);
3330 Token third = new Token(TokenType.EQ, offset + 2); 3314 Token third = new Token(TokenType.EQ, offset + 2);
3331 third.setNext(_currentToken.next); 3315 third.setNext(_currentToken.next);
3332 second.setNext(third); 3316 second.setNext(third);
3333 first.setNext(second); 3317 first.setNext(second);
3334 _currentToken.previous.setNext(first); 3318 _currentToken.previous.setNext(first);
3335 _currentToken = first; 3319 _currentToken = first;
3336 return true; 3320 return true;
(...skipping 16 matching lines...) Expand all
3353 * @return `true` if the current token matches the given keyword 3337 * @return `true` if the current token matches the given keyword
3354 */ 3338 */
3355 bool _matchesKeyword(Keyword keyword) => _tokenMatchesKeyword(_currentToken, k eyword); 3339 bool _matchesKeyword(Keyword keyword) => _tokenMatchesKeyword(_currentToken, k eyword);
3356 3340
3357 /** 3341 /**
3358 * Return `true` if the current token matches the given identifier. 3342 * Return `true` if the current token matches the given identifier.
3359 * 3343 *
3360 * @param identifier the identifier that can optionally appear in the current location 3344 * @param identifier the identifier that can optionally appear in the current location
3361 * @return `true` if the current token matches the given identifier 3345 * @return `true` if the current token matches the given identifier
3362 */ 3346 */
3363 bool _matchesString(String identifier) => identical(_currentToken.type, TokenT ype.IDENTIFIER) && _currentToken.lexeme == identifier; 3347 bool _matchesString(String identifier) => _currentToken.type == TokenType.IDEN TIFIER && _currentToken.lexeme == identifier;
3364 3348
3365 /** 3349 /**
3366 * If the current token has the given type, then advance to the next token and return `true` 3350 * If the current token has the given type, then advance to the next token and return `true`
3367 * . Otherwise, return `false` without advancing. This method should not be in voked with an 3351 * . Otherwise, return `false` without advancing. This method should not be in voked with an
3368 * argument value of [TokenType#GT]. 3352 * argument value of [TokenType#GT].
3369 * 3353 *
3370 * @param type the type of token that can optionally appear in the current loc ation 3354 * @param type the type of token that can optionally appear in the current loc ation
3371 * @return `true` if the current token has the given type 3355 * @return `true` if the current token has the given type
3372 */ 3356 */
3373 bool _optional(TokenType type) { 3357 bool _optional(TokenType type) {
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
3624 * </pre> 3608 * </pre>
3625 * 3609 *
3626 * @return the expression representing the cascaded method invocation 3610 * @return the expression representing the cascaded method invocation
3627 */ 3611 */
3628 Expression _parseCascadeSection() { 3612 Expression _parseCascadeSection() {
3629 Token period = _expect(TokenType.PERIOD_PERIOD); 3613 Token period = _expect(TokenType.PERIOD_PERIOD);
3630 Expression expression = null; 3614 Expression expression = null;
3631 SimpleIdentifier functionName = null; 3615 SimpleIdentifier functionName = null;
3632 if (_matchesIdentifier()) { 3616 if (_matchesIdentifier()) {
3633 functionName = parseSimpleIdentifier(); 3617 functionName = parseSimpleIdentifier();
3634 } else if (identical(_currentToken.type, TokenType.OPEN_SQUARE_BRACKET)) { 3618 } else if (_currentToken.type == TokenType.OPEN_SQUARE_BRACKET) {
3635 Token leftBracket = andAdvance; 3619 Token leftBracket = andAdvance;
3636 Expression index = parseExpression2(); 3620 Expression index = parseExpression2();
3637 Token rightBracket = _expect(TokenType.CLOSE_SQUARE_BRACKET); 3621 Token rightBracket = _expect(TokenType.CLOSE_SQUARE_BRACKET);
3638 expression = new IndexExpression.forCascade(period, leftBracket, index, ri ghtBracket); 3622 expression = new IndexExpression.forCascade(period, leftBracket, index, ri ghtBracket);
3639 period = null; 3623 period = null;
3640 } else { 3624 } else {
3641 _reportErrorForToken(ParserErrorCode.MISSING_IDENTIFIER, _currentToken, [_ currentToken.lexeme]); 3625 _reportErrorForToken(ParserErrorCode.MISSING_IDENTIFIER, _currentToken, [_ currentToken.lexeme]);
3642 functionName = _createSyntheticIdentifier(); 3626 functionName = _createSyntheticIdentifier();
3643 } 3627 }
3644 if (identical(_currentToken.type, TokenType.OPEN_PAREN)) { 3628 if (_currentToken.type == TokenType.OPEN_PAREN) {
3645 while (identical(_currentToken.type, TokenType.OPEN_PAREN)) { 3629 while (_currentToken.type == TokenType.OPEN_PAREN) {
3646 if (functionName != null) { 3630 if (functionName != null) {
3647 expression = new MethodInvocation(expression, period, functionName, pa rseArgumentList()); 3631 expression = new MethodInvocation(expression, period, functionName, pa rseArgumentList());
3648 period = null; 3632 period = null;
3649 functionName = null; 3633 functionName = null;
3650 } else if (expression == null) { 3634 } else if (expression == null) {
3651 // It should not be possible to get here. 3635 // It should not be possible to get here.
3652 expression = new MethodInvocation(expression, period, _createSynthetic Identifier(), parseArgumentList()); 3636 expression = new MethodInvocation(expression, period, _createSynthetic Identifier(), parseArgumentList());
3653 } else { 3637 } else {
3654 expression = new FunctionExpressionInvocation(expression, parseArgumen tList()); 3638 expression = new FunctionExpressionInvocation(expression, parseArgumen tList());
3655 } 3639 }
3656 } 3640 }
3657 } else if (functionName != null) { 3641 } else if (functionName != null) {
3658 expression = new PropertyAccess(expression, period, functionName); 3642 expression = new PropertyAccess(expression, period, functionName);
3659 period = null; 3643 period = null;
3660 } 3644 }
3661 bool progress = true; 3645 bool progress = true;
3662 while (progress) { 3646 while (progress) {
3663 progress = false; 3647 progress = false;
3664 Expression selector = _parseAssignableSelector(expression, true); 3648 Expression selector = _parseAssignableSelector(expression, true);
3665 if (selector != expression) { 3649 if (!identical(selector, expression)) {
3666 expression = selector; 3650 expression = selector;
3667 progress = true; 3651 progress = true;
3668 while (identical(_currentToken.type, TokenType.OPEN_PAREN)) { 3652 while (_currentToken.type == TokenType.OPEN_PAREN) {
3669 if (expression is PropertyAccess) { 3653 if (expression is PropertyAccess) {
3670 PropertyAccess propertyAccess = expression as PropertyAccess; 3654 PropertyAccess propertyAccess = expression as PropertyAccess;
3671 expression = new MethodInvocation(propertyAccess.target, propertyAcc ess.operator, propertyAccess.propertyName, parseArgumentList()); 3655 expression = new MethodInvocation(propertyAccess.target, propertyAcc ess.operator, propertyAccess.propertyName, parseArgumentList());
3672 } else { 3656 } else {
3673 expression = new FunctionExpressionInvocation(expression, parseArgum entList()); 3657 expression = new FunctionExpressionInvocation(expression, parseArgum entList());
3674 } 3658 }
3675 } 3659 }
3676 } 3660 }
3677 } 3661 }
3678 if (_currentToken.type.isAssignmentOperator) { 3662 if (_currentToken.type.isAssignmentOperator) {
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
4246 Token keyword = null; 4230 Token keyword = null;
4247 Token period = null; 4231 Token period = null;
4248 if (_matchesKeyword(Keyword.THIS)) { 4232 if (_matchesKeyword(Keyword.THIS)) {
4249 keyword = andAdvance; 4233 keyword = andAdvance;
4250 period = _expect(TokenType.PERIOD); 4234 period = _expect(TokenType.PERIOD);
4251 } 4235 }
4252 SimpleIdentifier fieldName = parseSimpleIdentifier(); 4236 SimpleIdentifier fieldName = parseSimpleIdentifier();
4253 Token equals = _expect(TokenType.EQ); 4237 Token equals = _expect(TokenType.EQ);
4254 Expression expression = parseConditionalExpression(); 4238 Expression expression = parseConditionalExpression();
4255 TokenType tokenType = _currentToken.type; 4239 TokenType tokenType = _currentToken.type;
4256 if (identical(tokenType, TokenType.PERIOD_PERIOD)) { 4240 if (tokenType == TokenType.PERIOD_PERIOD) {
4257 List<Expression> cascadeSections = new List<Expression>(); 4241 List<Expression> cascadeSections = new List<Expression>();
4258 while (identical(tokenType, TokenType.PERIOD_PERIOD)) { 4242 while (tokenType == TokenType.PERIOD_PERIOD) {
4259 Expression section = _parseCascadeSection(); 4243 Expression section = _parseCascadeSection();
4260 if (section != null) { 4244 if (section != null) {
4261 cascadeSections.add(section); 4245 cascadeSections.add(section);
4262 } 4246 }
4263 tokenType = _currentToken.type; 4247 tokenType = _currentToken.type;
4264 } 4248 }
4265 expression = new CascadeExpression(expression, cascadeSections); 4249 expression = new CascadeExpression(expression, cascadeSections);
4266 } 4250 }
4267 return new ConstructorFieldInitializer(keyword, period, fieldName, equals, e xpression); 4251 return new ConstructorFieldInitializer(keyword, period, fieldName, equals, e xpression);
4268 } 4252 }
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
4331 * multiLineComment? 4315 * multiLineComment?
4332 * | singleLineComment* 4316 * | singleLineComment*
4333 * </pre> 4317 * </pre>
4334 * 4318 *
4335 * @return the documentation comment that was parsed, or `null` if there was n o comment 4319 * @return the documentation comment that was parsed, or `null` if there was n o comment
4336 */ 4320 */
4337 Comment _parseDocumentationComment() { 4321 Comment _parseDocumentationComment() {
4338 List<Token> commentTokens = new List<Token>(); 4322 List<Token> commentTokens = new List<Token>();
4339 Token commentToken = _currentToken.precedingComments; 4323 Token commentToken = _currentToken.precedingComments;
4340 while (commentToken != null) { 4324 while (commentToken != null) {
4341 if (identical(commentToken.type, TokenType.SINGLE_LINE_COMMENT)) { 4325 if (commentToken.type == TokenType.SINGLE_LINE_COMMENT) {
4342 if (StringUtilities.startsWith3(commentToken.lexeme, 0, 0x2F, 0x2F, 0x2F )) { 4326 if (StringUtilities.startsWith3(commentToken.lexeme, 0, 0x2F, 0x2F, 0x2F )) {
4343 if (commentTokens.length == 1 && StringUtilities.startsWith3(commentTo kens[0].lexeme, 0, 0x2F, 0x2A, 0x2A)) { 4327 if (commentTokens.length == 1 && StringUtilities.startsWith3(commentTo kens[0].lexeme, 0, 0x2F, 0x2A, 0x2A)) {
4344 commentTokens.clear(); 4328 commentTokens.clear();
4345 } 4329 }
4346 commentTokens.add(commentToken); 4330 commentTokens.add(commentToken);
4347 } 4331 }
4348 } else { 4332 } else {
4349 if (StringUtilities.startsWith3(commentToken.lexeme, 0, 0x2F, 0x2A, 0x2A )) { 4333 if (StringUtilities.startsWith3(commentToken.lexeme, 0, 0x2F, 0x2A, 0x2A )) {
4350 commentTokens.clear(); 4334 commentTokens.clear();
4351 commentTokens.add(commentToken); 4335 commentTokens.add(commentToken);
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
4516 * 4500 *
4517 * @param kind the kind of parameter being expected based on the presence or a bsence of group 4501 * @param kind the kind of parameter being expected based on the presence or a bsence of group
4518 * delimiters 4502 * delimiters
4519 * @return the formal parameter that was parsed 4503 * @return the formal parameter that was parsed
4520 */ 4504 */
4521 FormalParameter _parseFormalParameter(ParameterKind kind) { 4505 FormalParameter _parseFormalParameter(ParameterKind kind) {
4522 NormalFormalParameter parameter = parseNormalFormalParameter(); 4506 NormalFormalParameter parameter = parseNormalFormalParameter();
4523 if (_matches(TokenType.EQ)) { 4507 if (_matches(TokenType.EQ)) {
4524 Token seperator = andAdvance; 4508 Token seperator = andAdvance;
4525 Expression defaultValue = parseExpression2(); 4509 Expression defaultValue = parseExpression2();
4526 if (identical(kind, ParameterKind.NAMED)) { 4510 if (kind == ParameterKind.NAMED) {
4527 _reportErrorForToken(ParserErrorCode.WRONG_SEPARATOR_FOR_NAMED_PARAMETER , seperator, []); 4511 _reportErrorForToken(ParserErrorCode.WRONG_SEPARATOR_FOR_NAMED_PARAMETER , seperator, []);
4528 } else if (identical(kind, ParameterKind.REQUIRED)) { 4512 } else if (kind == ParameterKind.REQUIRED) {
4529 _reportErrorForNode(ParserErrorCode.POSITIONAL_PARAMETER_OUTSIDE_GROUP, parameter, []); 4513 _reportErrorForNode(ParserErrorCode.POSITIONAL_PARAMETER_OUTSIDE_GROUP, parameter, []);
4530 } 4514 }
4531 return new DefaultFormalParameter(parameter, kind, seperator, defaultValue ); 4515 return new DefaultFormalParameter(parameter, kind, seperator, defaultValue );
4532 } else if (_matches(TokenType.COLON)) { 4516 } else if (_matches(TokenType.COLON)) {
4533 Token seperator = andAdvance; 4517 Token seperator = andAdvance;
4534 Expression defaultValue = parseExpression2(); 4518 Expression defaultValue = parseExpression2();
4535 if (identical(kind, ParameterKind.POSITIONAL)) { 4519 if (kind == ParameterKind.POSITIONAL) {
4536 _reportErrorForToken(ParserErrorCode.WRONG_SEPARATOR_FOR_POSITIONAL_PARA METER, seperator, []); 4520 _reportErrorForToken(ParserErrorCode.WRONG_SEPARATOR_FOR_POSITIONAL_PARA METER, seperator, []);
4537 } else if (identical(kind, ParameterKind.REQUIRED)) { 4521 } else if (kind == ParameterKind.REQUIRED) {
4538 _reportErrorForNode(ParserErrorCode.NAMED_PARAMETER_OUTSIDE_GROUP, param eter, []); 4522 _reportErrorForNode(ParserErrorCode.NAMED_PARAMETER_OUTSIDE_GROUP, param eter, []);
4539 } 4523 }
4540 return new DefaultFormalParameter(parameter, kind, seperator, defaultValue ); 4524 return new DefaultFormalParameter(parameter, kind, seperator, defaultValue );
4541 } else if (kind != ParameterKind.REQUIRED) { 4525 } else if (kind != ParameterKind.REQUIRED) {
4542 return new DefaultFormalParameter(parameter, kind, null, null); 4526 return new DefaultFormalParameter(parameter, kind, null, null);
4543 } 4527 }
4544 return parameter; 4528 return parameter;
4545 } 4529 }
4546 4530
4547 /** 4531 /**
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
4779 * 4763 *
4780 * @param commentAndMetadata the documentation comment and metadata to be asso ciated with the 4764 * @param commentAndMetadata the documentation comment and metadata to be asso ciated with the
4781 * declaration 4765 * declaration
4782 * @param returnType the return type, or `null` if there is no return type 4766 * @param returnType the return type, or `null` if there is no return type
4783 * @return the function declaration statement that was parsed 4767 * @return the function declaration statement that was parsed
4784 */ 4768 */
4785 Statement _parseFunctionDeclarationStatementAfterReturnType(CommentAndMetadata commentAndMetadata, TypeName returnType) { 4769 Statement _parseFunctionDeclarationStatementAfterReturnType(CommentAndMetadata commentAndMetadata, TypeName returnType) {
4786 FunctionDeclaration declaration = _parseFunctionDeclaration(commentAndMetada ta, null, returnType); 4770 FunctionDeclaration declaration = _parseFunctionDeclaration(commentAndMetada ta, null, returnType);
4787 Token propertyKeyword = declaration.propertyKeyword; 4771 Token propertyKeyword = declaration.propertyKeyword;
4788 if (propertyKeyword != null) { 4772 if (propertyKeyword != null) {
4789 if (identical((propertyKeyword as KeywordToken).keyword, Keyword.GET)) { 4773 if ((propertyKeyword as KeywordToken).keyword == Keyword.GET) {
4790 _reportErrorForToken(ParserErrorCode.GETTER_IN_FUNCTION, propertyKeyword , []); 4774 _reportErrorForToken(ParserErrorCode.GETTER_IN_FUNCTION, propertyKeyword , []);
4791 } else { 4775 } else {
4792 _reportErrorForToken(ParserErrorCode.SETTER_IN_FUNCTION, propertyKeyword , []); 4776 _reportErrorForToken(ParserErrorCode.SETTER_IN_FUNCTION, propertyKeyword , []);
4793 } 4777 }
4794 } 4778 }
4795 return new FunctionDeclarationStatement(declaration); 4779 return new FunctionDeclarationStatement(declaration);
4796 } 4780 }
4797 4781
4798 /** 4782 /**
4799 * Parse a function type alias. 4783 * Parse a function type alias.
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
5360 * </pre> 5344 * </pre>
5361 * 5345 *
5362 * @return the non-labeled statement that was parsed 5346 * @return the non-labeled statement that was parsed
5363 */ 5347 */
5364 Statement _parseNonLabeledStatement() { 5348 Statement _parseNonLabeledStatement() {
5365 // TODO(brianwilkerson) Pass the comment and metadata on where appropriate. 5349 // TODO(brianwilkerson) Pass the comment and metadata on where appropriate.
5366 CommentAndMetadata commentAndMetadata = _parseCommentAndMetadata(); 5350 CommentAndMetadata commentAndMetadata = _parseCommentAndMetadata();
5367 if (_matches(TokenType.OPEN_CURLY_BRACKET)) { 5351 if (_matches(TokenType.OPEN_CURLY_BRACKET)) {
5368 if (_tokenMatches(_peek(), TokenType.STRING)) { 5352 if (_tokenMatches(_peek(), TokenType.STRING)) {
5369 Token afterString = _skipStringLiteral(_currentToken.next); 5353 Token afterString = _skipStringLiteral(_currentToken.next);
5370 if (afterString != null && identical(afterString.type, TokenType.COLON)) { 5354 if (afterString != null && afterString.type == TokenType.COLON) {
5371 return new ExpressionStatement(parseExpression2(), _expect(TokenType.S EMICOLON)); 5355 return new ExpressionStatement(parseExpression2(), _expect(TokenType.S EMICOLON));
5372 } 5356 }
5373 } 5357 }
5374 return parseBlock(); 5358 return parseBlock();
5375 } else if (_matches(TokenType.KEYWORD) && !(_currentToken as KeywordToken).k eyword.isPseudoKeyword) { 5359 } else if (_matches(TokenType.KEYWORD) && !(_currentToken as KeywordToken).k eyword.isPseudoKeyword) {
5376 Keyword keyword = (_currentToken as KeywordToken).keyword; 5360 Keyword keyword = (_currentToken as KeywordToken).keyword;
5377 // TODO(jwren) compute some metrics to figure out a better order for this if-then sequence to optimize performance 5361 // TODO(jwren) compute some metrics to figure out a better order for this if-then sequence to optimize performance
5378 if (identical(keyword, Keyword.ASSERT)) { 5362 if (keyword == Keyword.ASSERT) {
5379 return _parseAssertStatement(); 5363 return _parseAssertStatement();
5380 } else if (identical(keyword, Keyword.BREAK)) { 5364 } else if (keyword == Keyword.BREAK) {
5381 return _parseBreakStatement(); 5365 return _parseBreakStatement();
5382 } else if (identical(keyword, Keyword.CONTINUE)) { 5366 } else if (keyword == Keyword.CONTINUE) {
5383 return _parseContinueStatement(); 5367 return _parseContinueStatement();
5384 } else if (identical(keyword, Keyword.DO)) { 5368 } else if (keyword == Keyword.DO) {
5385 return _parseDoStatement(); 5369 return _parseDoStatement();
5386 } else if (identical(keyword, Keyword.FOR)) { 5370 } else if (keyword == Keyword.FOR) {
5387 return _parseForStatement(); 5371 return _parseForStatement();
5388 } else if (identical(keyword, Keyword.IF)) { 5372 } else if (keyword == Keyword.IF) {
5389 return _parseIfStatement(); 5373 return _parseIfStatement();
5390 } else if (identical(keyword, Keyword.RETHROW)) { 5374 } else if (keyword == Keyword.RETHROW) {
5391 return new ExpressionStatement(_parseRethrowExpression(), _expect(TokenT ype.SEMICOLON)); 5375 return new ExpressionStatement(_parseRethrowExpression(), _expect(TokenT ype.SEMICOLON));
5392 } else if (identical(keyword, Keyword.RETURN)) { 5376 } else if (keyword == Keyword.RETURN) {
5393 return _parseReturnStatement(); 5377 return _parseReturnStatement();
5394 } else if (identical(keyword, Keyword.SWITCH)) { 5378 } else if (keyword == Keyword.SWITCH) {
5395 return _parseSwitchStatement(); 5379 return _parseSwitchStatement();
5396 } else if (identical(keyword, Keyword.THROW)) { 5380 } else if (keyword == Keyword.THROW) {
5397 return new ExpressionStatement(_parseThrowExpression(), _expect(TokenTyp e.SEMICOLON)); 5381 return new ExpressionStatement(_parseThrowExpression(), _expect(TokenTyp e.SEMICOLON));
5398 } else if (identical(keyword, Keyword.TRY)) { 5382 } else if (keyword == Keyword.TRY) {
5399 return _parseTryStatement(); 5383 return _parseTryStatement();
5400 } else if (identical(keyword, Keyword.WHILE)) { 5384 } else if (keyword == Keyword.WHILE) {
5401 return _parseWhileStatement(); 5385 return _parseWhileStatement();
5402 } else if (identical(keyword, Keyword.VAR) || identical(keyword, Keyword.F INAL)) { 5386 } else if (keyword == Keyword.VAR || keyword == Keyword.FINAL) {
5403 return _parseVariableDeclarationStatementAfterMetadata(commentAndMetadat a); 5387 return _parseVariableDeclarationStatementAfterMetadata(commentAndMetadat a);
5404 } else if (identical(keyword, Keyword.VOID)) { 5388 } else if (keyword == Keyword.VOID) {
5405 TypeName returnType = parseReturnType(); 5389 TypeName returnType = parseReturnType();
5406 if (_matchesIdentifier() && _peek().matchesAny([ 5390 if (_matchesIdentifier() && _peek().matchesAny([
5407 TokenType.OPEN_PAREN, 5391 TokenType.OPEN_PAREN,
5408 TokenType.OPEN_CURLY_BRACKET, 5392 TokenType.OPEN_CURLY_BRACKET,
5409 TokenType.FUNCTION])) { 5393 TokenType.FUNCTION])) {
5410 return _parseFunctionDeclarationStatementAfterReturnType(commentAndMet adata, returnType); 5394 return _parseFunctionDeclarationStatementAfterReturnType(commentAndMet adata, returnType);
5411 } else { 5395 } else {
5412 // 5396 //
5413 // We have found an error of some kind. Try to recover. 5397 // We have found an error of some kind. Try to recover.
5414 // 5398 //
5415 if (_matchesIdentifier()) { 5399 if (_matchesIdentifier()) {
5416 if (_peek().matchesAny([TokenType.EQ, TokenType.COMMA, TokenType.SEM ICOLON])) { 5400 if (_peek().matchesAny([TokenType.EQ, TokenType.COMMA, TokenType.SEM ICOLON])) {
5417 // 5401 //
5418 // We appear to have a variable declaration with a type of "void". 5402 // We appear to have a variable declaration with a type of "void".
5419 // 5403 //
5420 _reportErrorForNode(ParserErrorCode.VOID_VARIABLE, returnType, []) ; 5404 _reportErrorForNode(ParserErrorCode.VOID_VARIABLE, returnType, []) ;
5421 return _parseVariableDeclarationStatementAfterMetadata(commentAndM etadata); 5405 return _parseVariableDeclarationStatementAfterMetadata(commentAndM etadata);
5422 } 5406 }
5423 } else if (_matches(TokenType.CLOSE_CURLY_BRACKET)) { 5407 } else if (_matches(TokenType.CLOSE_CURLY_BRACKET)) {
5424 // 5408 //
5425 // We appear to have found an incomplete statement at the end of a b lock. Parse it as a 5409 // We appear to have found an incomplete statement at the end of a b lock. Parse it as a
5426 // variable declaration. 5410 // variable declaration.
5427 // 5411 //
5428 return _parseVariableDeclarationStatementAfterType(commentAndMetadat a, null, returnType); 5412 return _parseVariableDeclarationStatementAfterType(commentAndMetadat a, null, returnType);
5429 } 5413 }
5430 _reportErrorForCurrentToken(ParserErrorCode.MISSING_STATEMENT, []); 5414 _reportErrorForCurrentToken(ParserErrorCode.MISSING_STATEMENT, []);
5431 // TODO(brianwilkerson) Recover from this error. 5415 // TODO(brianwilkerson) Recover from this error.
5432 return new EmptyStatement(_createSyntheticToken(TokenType.SEMICOLON)); 5416 return new EmptyStatement(_createSyntheticToken(TokenType.SEMICOLON));
5433 } 5417 }
5434 } else if (identical(keyword, Keyword.CONST)) { 5418 } else if (keyword == Keyword.CONST) {
5435 if (_peek().matchesAny([ 5419 if (_peek().matchesAny([
5436 TokenType.LT, 5420 TokenType.LT,
5437 TokenType.OPEN_CURLY_BRACKET, 5421 TokenType.OPEN_CURLY_BRACKET,
5438 TokenType.OPEN_SQUARE_BRACKET, 5422 TokenType.OPEN_SQUARE_BRACKET,
5439 TokenType.INDEX])) { 5423 TokenType.INDEX])) {
5440 return new ExpressionStatement(parseExpression2(), _expect(TokenType.S EMICOLON)); 5424 return new ExpressionStatement(parseExpression2(), _expect(TokenType.S EMICOLON));
5441 } else if (_tokenMatches(_peek(), TokenType.IDENTIFIER)) { 5425 } else if (_tokenMatches(_peek(), TokenType.IDENTIFIER)) {
5442 Token afterType = _skipTypeName(_peek()); 5426 Token afterType = _skipTypeName(_peek());
5443 if (afterType != null) { 5427 if (afterType != null) {
5444 if (_tokenMatches(afterType, TokenType.OPEN_PAREN) || (_tokenMatches (afterType, TokenType.PERIOD) && _tokenMatches(afterType.next, TokenType.IDENTIF IER) && _tokenMatches(afterType.next.next, TokenType.OPEN_PAREN))) { 5428 if (_tokenMatches(afterType, TokenType.OPEN_PAREN) || (_tokenMatches (afterType, TokenType.PERIOD) && _tokenMatches(afterType.next, TokenType.IDENTIF IER) && _tokenMatches(afterType.next.next, TokenType.OPEN_PAREN))) {
5445 return new ExpressionStatement(parseExpression2(), _expect(TokenTy pe.SEMICOLON)); 5429 return new ExpressionStatement(parseExpression2(), _expect(TokenTy pe.SEMICOLON));
5446 } 5430 }
5447 } 5431 }
5448 } 5432 }
5449 return _parseVariableDeclarationStatementAfterMetadata(commentAndMetadat a); 5433 return _parseVariableDeclarationStatementAfterMetadata(commentAndMetadat a);
5450 } else if (identical(keyword, Keyword.NEW) || identical(keyword, Keyword.T RUE) || identical(keyword, Keyword.FALSE) || identical(keyword, Keyword.NULL) || identical(keyword, Keyword.SUPER) || identical(keyword, Keyword.THIS)) { 5434 } else if (keyword == Keyword.NEW || keyword == Keyword.TRUE || keyword == Keyword.FALSE || keyword == Keyword.NULL || keyword == Keyword.SUPER || keyword == Keyword.THIS) {
5451 return new ExpressionStatement(parseExpression2(), _expect(TokenType.SEM ICOLON)); 5435 return new ExpressionStatement(parseExpression2(), _expect(TokenType.SEM ICOLON));
5452 } else { 5436 } else {
5453 // 5437 //
5454 // We have found an error of some kind. Try to recover. 5438 // We have found an error of some kind. Try to recover.
5455 // 5439 //
5456 _reportErrorForCurrentToken(ParserErrorCode.MISSING_STATEMENT, []); 5440 _reportErrorForCurrentToken(ParserErrorCode.MISSING_STATEMENT, []);
5457 return new EmptyStatement(_createSyntheticToken(TokenType.SEMICOLON)); 5441 return new EmptyStatement(_createSyntheticToken(TokenType.SEMICOLON));
5458 } 5442 }
5459 } else if (_matches(TokenType.SEMICOLON)) { 5443 } else if (_matches(TokenType.SEMICOLON)) {
5460 return _parseEmptyStatement(); 5444 return _parseEmptyStatement();
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after
6227 if (_matchesKeyword(Keyword.SUPER)) { 6211 if (_matchesKeyword(Keyword.SUPER)) {
6228 if (_tokenMatches(_peek(), TokenType.OPEN_SQUARE_BRACKET) || _tokenMatch es(_peek(), TokenType.PERIOD)) { 6212 if (_tokenMatches(_peek(), TokenType.OPEN_SQUARE_BRACKET) || _tokenMatch es(_peek(), TokenType.PERIOD)) {
6229 // --> "prefixOperator 'super' assignableSelector selector*" 6213 // --> "prefixOperator 'super' assignableSelector selector*"
6230 return new PrefixExpression(operator, _parseUnaryExpression()); 6214 return new PrefixExpression(operator, _parseUnaryExpression());
6231 } 6215 }
6232 // 6216 //
6233 // Even though it is not valid to use an incrementing operator ('++' or '--') before 'super', 6217 // Even though it is not valid to use an incrementing operator ('++' or '--') before 'super',
6234 // we can (and therefore must) interpret "--super" as semantically equiv alent to "-(-super)". 6218 // we can (and therefore must) interpret "--super" as semantically equiv alent to "-(-super)".
6235 // Unfortunately, we cannot do the same for "++super" because "+super" i s also not valid. 6219 // Unfortunately, we cannot do the same for "++super" because "+super" i s also not valid.
6236 // 6220 //
6237 if (identical(operator.type, TokenType.MINUS_MINUS)) { 6221 if (operator.type == TokenType.MINUS_MINUS) {
6238 int offset = operator.offset; 6222 int offset = operator.offset;
6239 Token firstOperator = new Token(TokenType.MINUS, offset); 6223 Token firstOperator = new Token(TokenType.MINUS, offset);
6240 Token secondOperator = new Token(TokenType.MINUS, offset + 1); 6224 Token secondOperator = new Token(TokenType.MINUS, offset + 1);
6241 secondOperator.setNext(_currentToken); 6225 secondOperator.setNext(_currentToken);
6242 firstOperator.setNext(secondOperator); 6226 firstOperator.setNext(secondOperator);
6243 operator.previous.setNext(firstOperator); 6227 operator.previous.setNext(firstOperator);
6244 return new PrefixExpression(firstOperator, new PrefixExpression(second Operator, new SuperExpression(andAdvance))); 6228 return new PrefixExpression(firstOperator, new PrefixExpression(second Operator, new SuperExpression(andAdvance)));
6245 } else { 6229 } else {
6246 // Invalid operator before 'super' 6230 // Invalid operator before 'super'
6247 _reportErrorForCurrentToken(ParserErrorCode.INVALID_OPERATOR_FOR_SUPER , [operator.lexeme]); 6231 _reportErrorForCurrentToken(ParserErrorCode.INVALID_OPERATOR_FOR_SUPER , [operator.lexeme]);
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
6683 * in a valid string literal. 6667 * in a valid string literal.
6684 * 6668 *
6685 * This method must be kept in sync with [parseStringInterpolation]. 6669 * This method must be kept in sync with [parseStringInterpolation].
6686 * 6670 *
6687 * @param startToken the token at which parsing is to begin 6671 * @param startToken the token at which parsing is to begin
6688 * @return the string literal that was parsed 6672 * @return the string literal that was parsed
6689 */ 6673 */
6690 Token _skipStringInterpolation(Token startToken) { 6674 Token _skipStringInterpolation(Token startToken) {
6691 Token token = startToken; 6675 Token token = startToken;
6692 TokenType type = token.type; 6676 TokenType type = token.type;
6693 while (identical(type, TokenType.STRING_INTERPOLATION_EXPRESSION) || identic al(type, TokenType.STRING_INTERPOLATION_IDENTIFIER)) { 6677 while (type == TokenType.STRING_INTERPOLATION_EXPRESSION || type == TokenTyp e.STRING_INTERPOLATION_IDENTIFIER) {
6694 if (identical(type, TokenType.STRING_INTERPOLATION_EXPRESSION)) { 6678 if (type == TokenType.STRING_INTERPOLATION_EXPRESSION) {
6695 token = token.next; 6679 token = token.next;
6696 type = token.type; 6680 type = token.type;
6697 // 6681 //
6698 // Rather than verify that the following tokens represent a valid expres sion, we simply skip 6682 // Rather than verify that the following tokens represent a valid expres sion, we simply skip
6699 // tokens until we reach the end of the interpolation, being careful to handle nested string 6683 // tokens until we reach the end of the interpolation, being careful to handle nested string
6700 // literals. 6684 // literals.
6701 // 6685 //
6702 int bracketNestingLevel = 1; 6686 int bracketNestingLevel = 1;
6703 while (bracketNestingLevel > 0) { 6687 while (bracketNestingLevel > 0) {
6704 if (identical(type, TokenType.EOF)) { 6688 if (type == TokenType.EOF) {
6705 return null; 6689 return null;
6706 } else if (identical(type, TokenType.OPEN_CURLY_BRACKET)) { 6690 } else if (type == TokenType.OPEN_CURLY_BRACKET) {
6707 bracketNestingLevel++; 6691 bracketNestingLevel++;
6708 } else if (identical(type, TokenType.CLOSE_CURLY_BRACKET)) { 6692 } else if (type == TokenType.CLOSE_CURLY_BRACKET) {
6709 bracketNestingLevel--; 6693 bracketNestingLevel--;
6710 } else if (identical(type, TokenType.STRING)) { 6694 } else if (type == TokenType.STRING) {
6711 token = _skipStringLiteral(token); 6695 token = _skipStringLiteral(token);
6712 if (token == null) { 6696 if (token == null) {
6713 return null; 6697 return null;
6714 } 6698 }
6715 } else { 6699 } else {
6716 token = token.next; 6700 token = token.next;
6717 } 6701 }
6718 type = token.type; 6702 type = token.type;
6719 } 6703 }
6720 token = token.next; 6704 token = token.next;
6721 type = token.type; 6705 type = token.type;
6722 } else { 6706 } else {
6723 token = token.next; 6707 token = token.next;
6724 if (token.type != TokenType.IDENTIFIER) { 6708 if (token.type != TokenType.IDENTIFIER) {
6725 return null; 6709 return null;
6726 } 6710 }
6727 token = token.next; 6711 token = token.next;
6728 } 6712 }
6729 type = token.type; 6713 type = token.type;
6730 if (identical(type, TokenType.STRING)) { 6714 if (type == TokenType.STRING) {
6731 token = token.next; 6715 token = token.next;
6732 type = token.type; 6716 type = token.type;
6733 } 6717 }
6734 } 6718 }
6735 return token; 6719 return token;
6736 } 6720 }
6737 6721
6738 /** 6722 /**
6739 * Parse a string literal, starting at the given token, without actually creat ing a string literal 6723 * Parse a string literal, starting at the given token, without actually creat ing a string literal
6740 * or changing the current token. Return the token following the string litera l that was parsed, 6724 * or changing the current token. Return the token following the string litera l that was parsed,
6741 * or `null` if the given token is not the first token in a valid string liter al. 6725 * or `null` if the given token is not the first token in a valid string liter al.
6742 * 6726 *
6743 * This method must be kept in sync with [parseStringLiteral]. 6727 * This method must be kept in sync with [parseStringLiteral].
6744 * 6728 *
6745 * <pre> 6729 * <pre>
6746 * stringLiteral ::= 6730 * stringLiteral ::=
6747 * MULTI_LINE_STRING+ 6731 * MULTI_LINE_STRING+
6748 * | SINGLE_LINE_STRING+ 6732 * | SINGLE_LINE_STRING+
6749 * </pre> 6733 * </pre>
6750 * 6734 *
6751 * @param startToken the token at which parsing is to begin 6735 * @param startToken the token at which parsing is to begin
6752 * @return the token following the string literal that was parsed 6736 * @return the token following the string literal that was parsed
6753 */ 6737 */
6754 Token _skipStringLiteral(Token startToken) { 6738 Token _skipStringLiteral(Token startToken) {
6755 Token token = startToken; 6739 Token token = startToken;
6756 while (token != null && _tokenMatches(token, TokenType.STRING)) { 6740 while (token != null && _tokenMatches(token, TokenType.STRING)) {
6757 token = token.next; 6741 token = token.next;
6758 TokenType type = token.type; 6742 TokenType type = token.type;
6759 if (identical(type, TokenType.STRING_INTERPOLATION_EXPRESSION) || identica l(type, TokenType.STRING_INTERPOLATION_IDENTIFIER)) { 6743 if (type == TokenType.STRING_INTERPOLATION_EXPRESSION || type == TokenType .STRING_INTERPOLATION_IDENTIFIER) {
6760 token = _skipStringInterpolation(token); 6744 token = _skipStringInterpolation(token);
6761 } 6745 }
6762 } 6746 }
6763 if (identical(token, startToken)) { 6747 if (identical(token, startToken)) {
6764 return null; 6748 return null;
6765 } 6749 }
6766 return token; 6750 return token;
6767 } 6751 }
6768 6752
6769 /** 6753 /**
(...skipping 22 matching lines...) Expand all
6792 token = _skipTypeName(token.next); 6776 token = _skipTypeName(token.next);
6793 if (token == null) { 6777 if (token == null) {
6794 return null; 6778 return null;
6795 } 6779 }
6796 while (_tokenMatches(token, TokenType.COMMA)) { 6780 while (_tokenMatches(token, TokenType.COMMA)) {
6797 token = _skipTypeName(token.next); 6781 token = _skipTypeName(token.next);
6798 if (token == null) { 6782 if (token == null) {
6799 return null; 6783 return null;
6800 } 6784 }
6801 } 6785 }
6802 if (identical(token.type, TokenType.GT)) { 6786 if (token.type == TokenType.GT) {
6803 return token.next; 6787 return token.next;
6804 } else if (identical(token.type, TokenType.GT_GT)) { 6788 } else if (token.type == TokenType.GT_GT) {
6805 Token second = new Token(TokenType.GT, token.offset + 1); 6789 Token second = new Token(TokenType.GT, token.offset + 1);
6806 second.setNextWithoutSettingPrevious(token.next); 6790 second.setNextWithoutSettingPrevious(token.next);
6807 return second; 6791 return second;
6808 } 6792 }
6809 return null; 6793 return null;
6810 } 6794 }
6811 6795
6812 /** 6796 /**
6813 * Parse a type name, starting at the given token, without actually creating a type name or 6797 * Parse a type name, starting at the given token, without actually creating a type name or
6814 * changing the current token. Return the token following the type name that w as parsed, or 6798 * changing the current token. Return the token following the type name that w as parsed, or
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
6892 return next; 6876 return next;
6893 } 6877 }
6894 6878
6895 /** 6879 /**
6896 * Return `true` if the given token has the given type. 6880 * Return `true` if the given token has the given type.
6897 * 6881 *
6898 * @param token the token being tested 6882 * @param token the token being tested
6899 * @param type the type of token that is being tested for 6883 * @param type the type of token that is being tested for
6900 * @return `true` if the given token has the given type 6884 * @return `true` if the given token has the given type
6901 */ 6885 */
6902 bool _tokenMatches(Token token, TokenType type) => identical(token.type, type) ; 6886 bool _tokenMatches(Token token, TokenType type) => token.type == type;
6903 6887
6904 /** 6888 /**
6905 * Return `true` if the given token is a valid identifier. Valid identifiers i nclude 6889 * Return `true` if the given token is a valid identifier. Valid identifiers i nclude
6906 * built-in identifiers (pseudo-keywords). 6890 * built-in identifiers (pseudo-keywords).
6907 * 6891 *
6908 * @return `true` if the given token is a valid identifier 6892 * @return `true` if the given token is a valid identifier
6909 */ 6893 */
6910 bool _tokenMatchesIdentifier(Token token) => _tokenMatches(token, TokenType.ID ENTIFIER) || (_tokenMatches(token, TokenType.KEYWORD) && (token as KeywordToken) .keyword.isPseudoKeyword); 6894 bool _tokenMatchesIdentifier(Token token) => _tokenMatches(token, TokenType.ID ENTIFIER) || (_tokenMatches(token, TokenType.KEYWORD) && (token as KeywordToken) .keyword.isPseudoKeyword);
6911 6895
6912 /** 6896 /**
6913 * Return `true` if the given token matches the given keyword. 6897 * Return `true` if the given token matches the given keyword.
6914 * 6898 *
6915 * @param token the token being tested 6899 * @param token the token being tested
6916 * @param keyword the keyword that is being tested for 6900 * @param keyword the keyword that is being tested for
6917 * @return `true` if the given token matches the given keyword 6901 * @return `true` if the given token matches the given keyword
6918 */ 6902 */
6919 bool _tokenMatchesKeyword(Token token, Keyword keyword) => identical(token.typ e, TokenType.KEYWORD) && identical((token as KeywordToken).keyword, keyword); 6903 bool _tokenMatchesKeyword(Token token, Keyword keyword) => token.type == Token Type.KEYWORD && (token as KeywordToken).keyword == keyword;
6920 6904
6921 /** 6905 /**
6922 * Translate the characters at the given index in the given string, appending the translated 6906 * Translate the characters at the given index in the given string, appending the translated
6923 * character to the given builder. The index is assumed to be valid. 6907 * character to the given builder. The index is assumed to be valid.
6924 * 6908 *
6925 * @param builder the builder to which the translated character is to be appen ded 6909 * @param builder the builder to which the translated character is to be appen ded
6926 * @param lexeme the string containing the character(s) to be translated 6910 * @param lexeme the string containing the character(s) to be translated
6927 * @param index the index of the character to be translated 6911 * @param index the index of the character to be translated
6928 * @return the index of the next character to be translated 6912 * @return the index of the next character to be translated
6929 */ 6913 */
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
7344 int get length => 0; 7328 int get length => 0;
7345 } 7329 }
7346 7330
7347 /** 7331 /**
7348 * The enumeration `ParserErrorCode` defines the error codes used for errors det ected by the 7332 * The enumeration `ParserErrorCode` defines the error codes used for errors det ected by the
7349 * parser. The convention for this class is for the name of the error code to in dicate the problem 7333 * parser. The convention for this class is for the name of the error code to in dicate the problem
7350 * that caused the error to be generated and for the error message to explain wh at is wrong and, 7334 * that caused the error to be generated and for the error message to explain wh at is wrong and,
7351 * when appropriate, how the problem can be corrected. 7335 * when appropriate, how the problem can be corrected.
7352 */ 7336 */
7353 class ParserErrorCode extends Enum<ParserErrorCode> implements ErrorCode { 7337 class ParserErrorCode extends Enum<ParserErrorCode> implements ErrorCode {
7354 static final ParserErrorCode ABSTRACT_CLASS_MEMBER = new ParserErrorCode.con3( 'ABSTRACT_CLASS_MEMBER', 0, "Members of classes cannot be declared to be 'abstra ct'"); 7338 static const ParserErrorCode ABSTRACT_CLASS_MEMBER = const ParserErrorCode.con 3('ABSTRACT_CLASS_MEMBER', 0, "Members of classes cannot be declared to be 'abst ract'");
7355 7339
7356 static final ParserErrorCode ABSTRACT_STATIC_METHOD = new ParserErrorCode.con3 ('ABSTRACT_STATIC_METHOD', 1, "Static methods cannot be declared to be 'abstract '"); 7340 static const ParserErrorCode ABSTRACT_STATIC_METHOD = const ParserErrorCode.co n3('ABSTRACT_STATIC_METHOD', 1, "Static methods cannot be declared to be 'abstra ct'");
7357 7341
7358 static final ParserErrorCode ABSTRACT_TOP_LEVEL_FUNCTION = new ParserErrorCode .con3('ABSTRACT_TOP_LEVEL_FUNCTION', 2, "Top-level functions cannot be declared to be 'abstract'"); 7342 static const ParserErrorCode ABSTRACT_TOP_LEVEL_FUNCTION = const ParserErrorCo de.con3('ABSTRACT_TOP_LEVEL_FUNCTION', 2, "Top-level functions cannot be declare d to be 'abstract'");
7359 7343
7360 static final ParserErrorCode ABSTRACT_TOP_LEVEL_VARIABLE = new ParserErrorCode .con3('ABSTRACT_TOP_LEVEL_VARIABLE', 3, "Top-level variables cannot be declared to be 'abstract'"); 7344 static const ParserErrorCode ABSTRACT_TOP_LEVEL_VARIABLE = const ParserErrorCo de.con3('ABSTRACT_TOP_LEVEL_VARIABLE', 3, "Top-level variables cannot be declare d to be 'abstract'");
7361 7345
7362 static final ParserErrorCode ABSTRACT_TYPEDEF = new ParserErrorCode.con3('ABST RACT_TYPEDEF', 4, "Type aliases cannot be declared to be 'abstract'"); 7346 static const ParserErrorCode ABSTRACT_TYPEDEF = const ParserErrorCode.con3('AB STRACT_TYPEDEF', 4, "Type aliases cannot be declared to be 'abstract'");
7363 7347
7364 static final ParserErrorCode ASSERT_DOES_NOT_TAKE_ASSIGNMENT = new ParserError Code.con3('ASSERT_DOES_NOT_TAKE_ASSIGNMENT', 5, "Assert cannot be called on an a ssignment"); 7348 static const ParserErrorCode ASSERT_DOES_NOT_TAKE_ASSIGNMENT = const ParserErr orCode.con3('ASSERT_DOES_NOT_TAKE_ASSIGNMENT', 5, "Assert cannot be called on an assignment");
7365 7349
7366 static final ParserErrorCode ASSERT_DOES_NOT_TAKE_CASCADE = new ParserErrorCod e.con3('ASSERT_DOES_NOT_TAKE_CASCADE', 6, "Assert cannot be called on cascade"); 7350 static const ParserErrorCode ASSERT_DOES_NOT_TAKE_CASCADE = const ParserErrorC ode.con3('ASSERT_DOES_NOT_TAKE_CASCADE', 6, "Assert cannot be called on cascade" );
7367 7351
7368 static final ParserErrorCode ASSERT_DOES_NOT_TAKE_THROW = new ParserErrorCode. con3('ASSERT_DOES_NOT_TAKE_THROW', 7, "Assert cannot be called on throws"); 7352 static const ParserErrorCode ASSERT_DOES_NOT_TAKE_THROW = const ParserErrorCod e.con3('ASSERT_DOES_NOT_TAKE_THROW', 7, "Assert cannot be called on throws");
7369 7353
7370 static final ParserErrorCode ASSERT_DOES_NOT_TAKE_RETHROW = new ParserErrorCod e.con3('ASSERT_DOES_NOT_TAKE_RETHROW', 8, "Assert cannot be called on rethrows") ; 7354 static const ParserErrorCode ASSERT_DOES_NOT_TAKE_RETHROW = const ParserErrorC ode.con3('ASSERT_DOES_NOT_TAKE_RETHROW', 8, "Assert cannot be called on rethrows ");
7371 7355
7372 static final ParserErrorCode BREAK_OUTSIDE_OF_LOOP = new ParserErrorCode.con3( 'BREAK_OUTSIDE_OF_LOOP', 9, "A break statement cannot be used outside of a loop or switch statement"); 7356 static const ParserErrorCode BREAK_OUTSIDE_OF_LOOP = const ParserErrorCode.con 3('BREAK_OUTSIDE_OF_LOOP', 9, "A break statement cannot be used outside of a loo p or switch statement");
7373 7357
7374 static final ParserErrorCode CONST_AND_FINAL = new ParserErrorCode.con3('CONST _AND_FINAL', 10, "Members cannot be declared to be both 'const' and 'final'"); 7358 static const ParserErrorCode CONST_AND_FINAL = const ParserErrorCode.con3('CON ST_AND_FINAL', 10, "Members cannot be declared to be both 'const' and 'final'");
7375 7359
7376 static final ParserErrorCode CONST_AND_VAR = new ParserErrorCode.con3('CONST_A ND_VAR', 11, "Members cannot be declared to be both 'const' and 'var'"); 7360 static const ParserErrorCode CONST_AND_VAR = const ParserErrorCode.con3('CONST _AND_VAR', 11, "Members cannot be declared to be both 'const' and 'var'");
7377 7361
7378 static final ParserErrorCode CONST_CLASS = new ParserErrorCode.con3('CONST_CLA SS', 12, "Classes cannot be declared to be 'const'"); 7362 static const ParserErrorCode CONST_CLASS = const ParserErrorCode.con3('CONST_C LASS', 12, "Classes cannot be declared to be 'const'");
7379 7363
7380 static final ParserErrorCode CONST_CONSTRUCTOR_WITH_BODY = new ParserErrorCode .con3('CONST_CONSTRUCTOR_WITH_BODY', 13, "'const' constructors cannot have a bod y"); 7364 static const ParserErrorCode CONST_CONSTRUCTOR_WITH_BODY = const ParserErrorCo de.con3('CONST_CONSTRUCTOR_WITH_BODY', 13, "'const' constructors cannot have a b ody");
7381 7365
7382 static final ParserErrorCode CONST_FACTORY = new ParserErrorCode.con3('CONST_F ACTORY', 14, "Only redirecting factory constructors can be declared to be 'const '"); 7366 static const ParserErrorCode CONST_FACTORY = const ParserErrorCode.con3('CONST _FACTORY', 14, "Only redirecting factory constructors can be declared to be 'con st'");
7383 7367
7384 static final ParserErrorCode CONST_METHOD = new ParserErrorCode.con3('CONST_ME THOD', 15, "Getters, setters and methods cannot be declared to be 'const'"); 7368 static const ParserErrorCode CONST_METHOD = const ParserErrorCode.con3('CONST_ METHOD', 15, "Getters, setters and methods cannot be declared to be 'const'");
7385 7369
7386 static final ParserErrorCode CONST_TYPEDEF = new ParserErrorCode.con3('CONST_T YPEDEF', 16, "Type aliases cannot be declared to be 'const'"); 7370 static const ParserErrorCode CONST_TYPEDEF = const ParserErrorCode.con3('CONST _TYPEDEF', 16, "Type aliases cannot be declared to be 'const'");
7387 7371
7388 static final ParserErrorCode CONSTRUCTOR_WITH_RETURN_TYPE = new ParserErrorCod e.con3('CONSTRUCTOR_WITH_RETURN_TYPE', 17, "Constructors cannot have a return ty pe"); 7372 static const ParserErrorCode CONSTRUCTOR_WITH_RETURN_TYPE = const ParserErrorC ode.con3('CONSTRUCTOR_WITH_RETURN_TYPE', 17, "Constructors cannot have a return type");
7389 7373
7390 static final ParserErrorCode CONTINUE_OUTSIDE_OF_LOOP = new ParserErrorCode.co n3('CONTINUE_OUTSIDE_OF_LOOP', 18, "A continue statement cannot be used outside of a loop or switch statement"); 7374 static const ParserErrorCode CONTINUE_OUTSIDE_OF_LOOP = const ParserErrorCode. con3('CONTINUE_OUTSIDE_OF_LOOP', 18, "A continue statement cannot be used outsid e of a loop or switch statement");
7391 7375
7392 static final ParserErrorCode CONTINUE_WITHOUT_LABEL_IN_CASE = new ParserErrorC ode.con3('CONTINUE_WITHOUT_LABEL_IN_CASE', 19, "A continue statement in a switch statement must have a label as a target"); 7376 static const ParserErrorCode CONTINUE_WITHOUT_LABEL_IN_CASE = const ParserErro rCode.con3('CONTINUE_WITHOUT_LABEL_IN_CASE', 19, "A continue statement in a swit ch statement must have a label as a target");
7393 7377
7394 static final ParserErrorCode DEPRECATED_ARGUMENT_DEFINITION_TEST = new ParserE rrorCode.con3('DEPRECATED_ARGUMENT_DEFINITION_TEST', 20, "The argument definitio n test ('?' operator) has been deprecated"); 7378 static const ParserErrorCode DEPRECATED_ARGUMENT_DEFINITION_TEST = const Parse rErrorCode.con3('DEPRECATED_ARGUMENT_DEFINITION_TEST', 20, "The argument definit ion test ('?' operator) has been deprecated");
7395 7379
7396 static final ParserErrorCode DEPRECATED_CLASS_TYPE_ALIAS = new ParserErrorCode .con3('DEPRECATED_CLASS_TYPE_ALIAS', 21, "The 'typedef' mixin application was re placed with 'class'"); 7380 static const ParserErrorCode DEPRECATED_CLASS_TYPE_ALIAS = const ParserErrorCo de.con3('DEPRECATED_CLASS_TYPE_ALIAS', 21, "The 'typedef' mixin application was replaced with 'class'");
7397 7381
7398 static final ParserErrorCode DIRECTIVE_AFTER_DECLARATION = new ParserErrorCode .con3('DIRECTIVE_AFTER_DECLARATION', 22, "Directives must appear before any decl arations"); 7382 static const ParserErrorCode DIRECTIVE_AFTER_DECLARATION = const ParserErrorCo de.con3('DIRECTIVE_AFTER_DECLARATION', 22, "Directives must appear before any de clarations");
7399 7383
7400 static final ParserErrorCode DUPLICATE_LABEL_IN_SWITCH_STATEMENT = new ParserE rrorCode.con3('DUPLICATE_LABEL_IN_SWITCH_STATEMENT', 23, "The label %s was alrea dy used in this switch statement"); 7384 static const ParserErrorCode DUPLICATE_LABEL_IN_SWITCH_STATEMENT = const Parse rErrorCode.con3('DUPLICATE_LABEL_IN_SWITCH_STATEMENT', 23, "The label %s was alr eady used in this switch statement");
7401 7385
7402 static final ParserErrorCode DUPLICATED_MODIFIER = new ParserErrorCode.con3('D UPLICATED_MODIFIER', 24, "The modifier '%s' was already specified."); 7386 static const ParserErrorCode DUPLICATED_MODIFIER = const ParserErrorCode.con3( 'DUPLICATED_MODIFIER', 24, "The modifier '%s' was already specified.");
7403 7387
7404 static final ParserErrorCode EQUALITY_CANNOT_BE_EQUALITY_OPERAND = new ParserE rrorCode.con3('EQUALITY_CANNOT_BE_EQUALITY_OPERAND', 25, "Equality expression ca nnot be operand of another equality expression."); 7388 static const ParserErrorCode EQUALITY_CANNOT_BE_EQUALITY_OPERAND = const Parse rErrorCode.con3('EQUALITY_CANNOT_BE_EQUALITY_OPERAND', 25, "Equality expression cannot be operand of another equality expression.");
7405 7389
7406 static final ParserErrorCode EXPECTED_CASE_OR_DEFAULT = new ParserErrorCode.co n3('EXPECTED_CASE_OR_DEFAULT', 26, "Expected 'case' or 'default'"); 7390 static const ParserErrorCode EXPECTED_CASE_OR_DEFAULT = const ParserErrorCode. con3('EXPECTED_CASE_OR_DEFAULT', 26, "Expected 'case' or 'default'");
7407 7391
7408 static final ParserErrorCode EXPECTED_CLASS_MEMBER = new ParserErrorCode.con3( 'EXPECTED_CLASS_MEMBER', 27, "Expected a class member"); 7392 static const ParserErrorCode EXPECTED_CLASS_MEMBER = const ParserErrorCode.con 3('EXPECTED_CLASS_MEMBER', 27, "Expected a class member");
7409 7393
7410 static final ParserErrorCode EXPECTED_EXECUTABLE = new ParserErrorCode.con3('E XPECTED_EXECUTABLE', 28, "Expected a method, getter, setter or operator declarat ion"); 7394 static const ParserErrorCode EXPECTED_EXECUTABLE = const ParserErrorCode.con3( 'EXPECTED_EXECUTABLE', 28, "Expected a method, getter, setter or operator declar ation");
7411 7395
7412 static final ParserErrorCode EXPECTED_LIST_OR_MAP_LITERAL = new ParserErrorCod e.con3('EXPECTED_LIST_OR_MAP_LITERAL', 29, "Expected a list or map literal"); 7396 static const ParserErrorCode EXPECTED_LIST_OR_MAP_LITERAL = const ParserErrorC ode.con3('EXPECTED_LIST_OR_MAP_LITERAL', 29, "Expected a list or map literal");
7413 7397
7414 static final ParserErrorCode EXPECTED_STRING_LITERAL = new ParserErrorCode.con 3('EXPECTED_STRING_LITERAL', 30, "Expected a string literal"); 7398 static const ParserErrorCode EXPECTED_STRING_LITERAL = const ParserErrorCode.c on3('EXPECTED_STRING_LITERAL', 30, "Expected a string literal");
7415 7399
7416 static final ParserErrorCode EXPECTED_TOKEN = new ParserErrorCode.con3('EXPECT ED_TOKEN', 31, "Expected to find '%s'"); 7400 static const ParserErrorCode EXPECTED_TOKEN = const ParserErrorCode.con3('EXPE CTED_TOKEN', 31, "Expected to find '%s'");
7417 7401
7418 static final ParserErrorCode EXPECTED_TYPE_NAME = new ParserErrorCode.con3('EX PECTED_TYPE_NAME', 32, "Expected a type name"); 7402 static const ParserErrorCode EXPECTED_TYPE_NAME = const ParserErrorCode.con3(' EXPECTED_TYPE_NAME', 32, "Expected a type name");
7419 7403
7420 static final ParserErrorCode EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE = new Parse rErrorCode.con3('EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE', 33, "Export directives must preceed part directives"); 7404 static const ParserErrorCode EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE = const Par serErrorCode.con3('EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE', 33, "Export directive s must preceed part directives");
7421 7405
7422 static final ParserErrorCode EXTERNAL_AFTER_CONST = new ParserErrorCode.con3(' EXTERNAL_AFTER_CONST', 34, "The modifier 'external' should be before the modifie r 'const'"); 7406 static const ParserErrorCode EXTERNAL_AFTER_CONST = const ParserErrorCode.con3 ('EXTERNAL_AFTER_CONST', 34, "The modifier 'external' should be before the modif ier 'const'");
7423 7407
7424 static final ParserErrorCode EXTERNAL_AFTER_FACTORY = new ParserErrorCode.con3 ('EXTERNAL_AFTER_FACTORY', 35, "The modifier 'external' should be before the mod ifier 'factory'"); 7408 static const ParserErrorCode EXTERNAL_AFTER_FACTORY = const ParserErrorCode.co n3('EXTERNAL_AFTER_FACTORY', 35, "The modifier 'external' should be before the m odifier 'factory'");
7425 7409
7426 static final ParserErrorCode EXTERNAL_AFTER_STATIC = new ParserErrorCode.con3( 'EXTERNAL_AFTER_STATIC', 36, "The modifier 'external' should be before the modif ier 'static'"); 7410 static const ParserErrorCode EXTERNAL_AFTER_STATIC = const ParserErrorCode.con 3('EXTERNAL_AFTER_STATIC', 36, "The modifier 'external' should be before the mod ifier 'static'");
7427 7411
7428 static final ParserErrorCode EXTERNAL_CLASS = new ParserErrorCode.con3('EXTERN AL_CLASS', 37, "Classes cannot be declared to be 'external'"); 7412 static const ParserErrorCode EXTERNAL_CLASS = const ParserErrorCode.con3('EXTE RNAL_CLASS', 37, "Classes cannot be declared to be 'external'");
7429 7413
7430 static final ParserErrorCode EXTERNAL_CONSTRUCTOR_WITH_BODY = new ParserErrorC ode.con3('EXTERNAL_CONSTRUCTOR_WITH_BODY', 38, "External constructors cannot hav e a body"); 7414 static const ParserErrorCode EXTERNAL_CONSTRUCTOR_WITH_BODY = const ParserErro rCode.con3('EXTERNAL_CONSTRUCTOR_WITH_BODY', 38, "External constructors cannot h ave a body");
7431 7415
7432 static final ParserErrorCode EXTERNAL_FIELD = new ParserErrorCode.con3('EXTERN AL_FIELD', 39, "Fields cannot be declared to be 'external'"); 7416 static const ParserErrorCode EXTERNAL_FIELD = const ParserErrorCode.con3('EXTE RNAL_FIELD', 39, "Fields cannot be declared to be 'external'");
7433 7417
7434 static final ParserErrorCode EXTERNAL_GETTER_WITH_BODY = new ParserErrorCode.c on3('EXTERNAL_GETTER_WITH_BODY', 40, "External getters cannot have a body"); 7418 static const ParserErrorCode EXTERNAL_GETTER_WITH_BODY = const ParserErrorCode .con3('EXTERNAL_GETTER_WITH_BODY', 40, "External getters cannot have a body");
7435 7419
7436 static final ParserErrorCode EXTERNAL_METHOD_WITH_BODY = new ParserErrorCode.c on3('EXTERNAL_METHOD_WITH_BODY', 41, "External methods cannot have a body"); 7420 static const ParserErrorCode EXTERNAL_METHOD_WITH_BODY = const ParserErrorCode .con3('EXTERNAL_METHOD_WITH_BODY', 41, "External methods cannot have a body");
7437 7421
7438 static final ParserErrorCode EXTERNAL_OPERATOR_WITH_BODY = new ParserErrorCode .con3('EXTERNAL_OPERATOR_WITH_BODY', 42, "External operators cannot have a body" ); 7422 static const ParserErrorCode EXTERNAL_OPERATOR_WITH_BODY = const ParserErrorCo de.con3('EXTERNAL_OPERATOR_WITH_BODY', 42, "External operators cannot have a bod y");
7439 7423
7440 static final ParserErrorCode EXTERNAL_SETTER_WITH_BODY = new ParserErrorCode.c on3('EXTERNAL_SETTER_WITH_BODY', 43, "External setters cannot have a body"); 7424 static const ParserErrorCode EXTERNAL_SETTER_WITH_BODY = const ParserErrorCode .con3('EXTERNAL_SETTER_WITH_BODY', 43, "External setters cannot have a body");
7441 7425
7442 static final ParserErrorCode EXTERNAL_TYPEDEF = new ParserErrorCode.con3('EXTE RNAL_TYPEDEF', 44, "Type aliases cannot be declared to be 'external'"); 7426 static const ParserErrorCode EXTERNAL_TYPEDEF = const ParserErrorCode.con3('EX TERNAL_TYPEDEF', 44, "Type aliases cannot be declared to be 'external'");
7443 7427
7444 static final ParserErrorCode FACTORY_TOP_LEVEL_DECLARATION = new ParserErrorCo de.con3('FACTORY_TOP_LEVEL_DECLARATION', 45, "Top-level declarations cannot be d eclared to be 'factory'"); 7428 static const ParserErrorCode FACTORY_TOP_LEVEL_DECLARATION = const ParserError Code.con3('FACTORY_TOP_LEVEL_DECLARATION', 45, "Top-level declarations cannot be declared to be 'factory'");
7445 7429
7446 static final ParserErrorCode FACTORY_WITHOUT_BODY = new ParserErrorCode.con3(' FACTORY_WITHOUT_BODY', 46, "A non-redirecting 'factory' constructor must have a body"); 7430 static const ParserErrorCode FACTORY_WITHOUT_BODY = const ParserErrorCode.con3 ('FACTORY_WITHOUT_BODY', 46, "A non-redirecting 'factory' constructor must have a body");
7447 7431
7448 static final ParserErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = new Parse rErrorCode.con3('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', 47, "Field initializers can only be used in a constructor"); 7432 static const ParserErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = const Par serErrorCode.con3('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', 47, "Field initialize rs can only be used in a constructor");
7449 7433
7450 static final ParserErrorCode FINAL_AND_VAR = new ParserErrorCode.con3('FINAL_A ND_VAR', 48, "Members cannot be declared to be both 'final' and 'var'"); 7434 static const ParserErrorCode FINAL_AND_VAR = const ParserErrorCode.con3('FINAL _AND_VAR', 48, "Members cannot be declared to be both 'final' and 'var'");
7451 7435
7452 static final ParserErrorCode FINAL_CLASS = new ParserErrorCode.con3('FINAL_CLA SS', 49, "Classes cannot be declared to be 'final'"); 7436 static const ParserErrorCode FINAL_CLASS = const ParserErrorCode.con3('FINAL_C LASS', 49, "Classes cannot be declared to be 'final'");
7453 7437
7454 static final ParserErrorCode FINAL_CONSTRUCTOR = new ParserErrorCode.con3('FIN AL_CONSTRUCTOR', 50, "A constructor cannot be declared to be 'final'"); 7438 static const ParserErrorCode FINAL_CONSTRUCTOR = const ParserErrorCode.con3('F INAL_CONSTRUCTOR', 50, "A constructor cannot be declared to be 'final'");
7455 7439
7456 static final ParserErrorCode FINAL_METHOD = new ParserErrorCode.con3('FINAL_ME THOD', 51, "Getters, setters and methods cannot be declared to be 'final'"); 7440 static const ParserErrorCode FINAL_METHOD = const ParserErrorCode.con3('FINAL_ METHOD', 51, "Getters, setters and methods cannot be declared to be 'final'");
7457 7441
7458 static final ParserErrorCode FINAL_TYPEDEF = new ParserErrorCode.con3('FINAL_T YPEDEF', 52, "Type aliases cannot be declared to be 'final'"); 7442 static const ParserErrorCode FINAL_TYPEDEF = const ParserErrorCode.con3('FINAL _TYPEDEF', 52, "Type aliases cannot be declared to be 'final'");
7459 7443
7460 static final ParserErrorCode FUNCTION_TYPED_PARAMETER_VAR = new ParserErrorCod e.con3('FUNCTION_TYPED_PARAMETER_VAR', 53, "Function typed parameters cannot spe cify 'const', 'final' or 'var' instead of return type"); 7444 static const ParserErrorCode FUNCTION_TYPED_PARAMETER_VAR = const ParserErrorC ode.con3('FUNCTION_TYPED_PARAMETER_VAR', 53, "Function typed parameters cannot s pecify 'const', 'final' or 'var' instead of return type");
7461 7445
7462 static final ParserErrorCode GETTER_IN_FUNCTION = new ParserErrorCode.con3('GE TTER_IN_FUNCTION', 54, "Getters cannot be defined within methods or functions"); 7446 static const ParserErrorCode GETTER_IN_FUNCTION = const ParserErrorCode.con3(' GETTER_IN_FUNCTION', 54, "Getters cannot be defined within methods or functions" );
7463 7447
7464 static final ParserErrorCode GETTER_WITH_PARAMETERS = new ParserErrorCode.con3 ('GETTER_WITH_PARAMETERS', 55, "Getter should be declared without a parameter li st"); 7448 static const ParserErrorCode GETTER_WITH_PARAMETERS = const ParserErrorCode.co n3('GETTER_WITH_PARAMETERS', 55, "Getter should be declared without a parameter list");
7465 7449
7466 static final ParserErrorCode ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE = new Parser ErrorCode.con3('ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE', 56, "Illegal assignment t o non-assignable expression"); 7450 static const ParserErrorCode ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE = const Pars erErrorCode.con3('ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE', 56, "Illegal assignment to non-assignable expression");
7467 7451
7468 static final ParserErrorCode IMPLEMENTS_BEFORE_EXTENDS = new ParserErrorCode.c on3('IMPLEMENTS_BEFORE_EXTENDS', 57, "The extends clause must be before the impl ements clause"); 7452 static const ParserErrorCode IMPLEMENTS_BEFORE_EXTENDS = const ParserErrorCode .con3('IMPLEMENTS_BEFORE_EXTENDS', 57, "The extends clause must be before the im plements clause");
7469 7453
7470 static final ParserErrorCode IMPLEMENTS_BEFORE_WITH = new ParserErrorCode.con3 ('IMPLEMENTS_BEFORE_WITH', 58, "The with clause must be before the implements cl ause"); 7454 static const ParserErrorCode IMPLEMENTS_BEFORE_WITH = const ParserErrorCode.co n3('IMPLEMENTS_BEFORE_WITH', 58, "The with clause must be before the implements clause");
7471 7455
7472 static final ParserErrorCode IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE = new Parse rErrorCode.con3('IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE', 59, "Import directives must preceed part directives"); 7456 static const ParserErrorCode IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE = const Par serErrorCode.con3('IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE', 59, "Import directive s must preceed part directives");
7473 7457
7474 static final ParserErrorCode INITIALIZED_VARIABLE_IN_FOR_EACH = new ParserErro rCode.con3('INITIALIZED_VARIABLE_IN_FOR_EACH', 60, "The loop variable in a for-e ach loop cannot be initialized"); 7458 static const ParserErrorCode INITIALIZED_VARIABLE_IN_FOR_EACH = const ParserEr rorCode.con3('INITIALIZED_VARIABLE_IN_FOR_EACH', 60, "The loop variable in a for -each loop cannot be initialized");
7475 7459
7476 static final ParserErrorCode INVALID_CODE_POINT = new ParserErrorCode.con3('IN VALID_CODE_POINT', 61, "The escape sequence '%s' is not a valid code point"); 7460 static const ParserErrorCode INVALID_CODE_POINT = const ParserErrorCode.con3(' INVALID_CODE_POINT', 61, "The escape sequence '%s' is not a valid code point");
7477 7461
7478 static final ParserErrorCode INVALID_COMMENT_REFERENCE = new ParserErrorCode.c on3('INVALID_COMMENT_REFERENCE', 62, "Comment references should contain a possib ly prefixed identifier and can start with 'new', but should not contain anything else"); 7462 static const ParserErrorCode INVALID_COMMENT_REFERENCE = const ParserErrorCode .con3('INVALID_COMMENT_REFERENCE', 62, "Comment references should contain a poss ibly prefixed identifier and can start with 'new', but should not contain anythi ng else");
7479 7463
7480 static final ParserErrorCode INVALID_HEX_ESCAPE = new ParserErrorCode.con3('IN VALID_HEX_ESCAPE', 63, "An escape sequence starting with '\\x' must be followed by 2 hexidecimal digits"); 7464 static const ParserErrorCode INVALID_HEX_ESCAPE = const ParserErrorCode.con3(' INVALID_HEX_ESCAPE', 63, "An escape sequence starting with '\\x' must be followe d by 2 hexidecimal digits");
7481 7465
7482 static final ParserErrorCode INVALID_OPERATOR = new ParserErrorCode.con3('INVA LID_OPERATOR', 64, "The string '%s' is not a valid operator"); 7466 static const ParserErrorCode INVALID_OPERATOR = const ParserErrorCode.con3('IN VALID_OPERATOR', 64, "The string '%s' is not a valid operator");
7483 7467
7484 static final ParserErrorCode INVALID_OPERATOR_FOR_SUPER = new ParserErrorCode. con3('INVALID_OPERATOR_FOR_SUPER', 65, "The operator '%s' cannot be used with 's uper'"); 7468 static const ParserErrorCode INVALID_OPERATOR_FOR_SUPER = const ParserErrorCod e.con3('INVALID_OPERATOR_FOR_SUPER', 65, "The operator '%s' cannot be used with 'super'");
7485 7469
7486 static final ParserErrorCode INVALID_UNICODE_ESCAPE = new ParserErrorCode.con3 ('INVALID_UNICODE_ESCAPE', 66, "An escape sequence starting with '\\u' must be f ollowed by 4 hexidecimal digits or from 1 to 6 digits between '{' and '}'"); 7470 static const ParserErrorCode INVALID_UNICODE_ESCAPE = const ParserErrorCode.co n3('INVALID_UNICODE_ESCAPE', 66, "An escape sequence starting with '\\u' must be followed by 4 hexidecimal digits or from 1 to 6 digits between '{' and '}'");
7487 7471
7488 static final ParserErrorCode LIBRARY_DIRECTIVE_NOT_FIRST = new ParserErrorCode .con3('LIBRARY_DIRECTIVE_NOT_FIRST', 67, "The library directive must appear befo re all other directives"); 7472 static const ParserErrorCode LIBRARY_DIRECTIVE_NOT_FIRST = const ParserErrorCo de.con3('LIBRARY_DIRECTIVE_NOT_FIRST', 67, "The library directive must appear be fore all other directives");
7489 7473
7490 static final ParserErrorCode LOCAL_FUNCTION_DECLARATION_MODIFIER = new ParserE rrorCode.con3('LOCAL_FUNCTION_DECLARATION_MODIFIER', 68, "Local function declara tions cannot specify any modifier"); 7474 static const ParserErrorCode LOCAL_FUNCTION_DECLARATION_MODIFIER = const Parse rErrorCode.con3('LOCAL_FUNCTION_DECLARATION_MODIFIER', 68, "Local function decla rations cannot specify any modifier");
7491 7475
7492 static final ParserErrorCode MISSING_ASSIGNABLE_SELECTOR = new ParserErrorCode .con3('MISSING_ASSIGNABLE_SELECTOR', 69, "Missing selector such as \".<identifie r>\" or \"[0]\""); 7476 static const ParserErrorCode MISSING_ASSIGNABLE_SELECTOR = const ParserErrorCo de.con3('MISSING_ASSIGNABLE_SELECTOR', 69, "Missing selector such as \".<identif ier>\" or \"[0]\"");
7493 7477
7494 static final ParserErrorCode MISSING_CATCH_OR_FINALLY = new ParserErrorCode.co n3('MISSING_CATCH_OR_FINALLY', 70, "A try statement must have either a catch or finally clause"); 7478 static const ParserErrorCode MISSING_CATCH_OR_FINALLY = const ParserErrorCode. con3('MISSING_CATCH_OR_FINALLY', 70, "A try statement must have either a catch o r finally clause");
7495 7479
7496 static final ParserErrorCode MISSING_CLASS_BODY = new ParserErrorCode.con3('MI SSING_CLASS_BODY', 71, "A class definition must have a body, even if it is empty "); 7480 static const ParserErrorCode MISSING_CLASS_BODY = const ParserErrorCode.con3(' MISSING_CLASS_BODY', 71, "A class definition must have a body, even if it is emp ty");
7497 7481
7498 static final ParserErrorCode MISSING_CLOSING_PARENTHESIS = new ParserErrorCode .con3('MISSING_CLOSING_PARENTHESIS', 72, "The closing parenthesis is missing"); 7482 static const ParserErrorCode MISSING_CLOSING_PARENTHESIS = const ParserErrorCo de.con3('MISSING_CLOSING_PARENTHESIS', 72, "The closing parenthesis is missing") ;
7499 7483
7500 static final ParserErrorCode MISSING_CONST_FINAL_VAR_OR_TYPE = new ParserError Code.con3('MISSING_CONST_FINAL_VAR_OR_TYPE', 73, "Variables must be declared usi ng the keywords 'const', 'final', 'var' or a type name"); 7484 static const ParserErrorCode MISSING_CONST_FINAL_VAR_OR_TYPE = const ParserErr orCode.con3('MISSING_CONST_FINAL_VAR_OR_TYPE', 73, "Variables must be declared u sing the keywords 'const', 'final', 'var' or a type name");
7501 7485
7502 static final ParserErrorCode MISSING_EXPRESSION_IN_THROW = new ParserErrorCode .con3('MISSING_EXPRESSION_IN_THROW', 74, "Throw expressions must compute the obj ect to be thrown"); 7486 static const ParserErrorCode MISSING_EXPRESSION_IN_THROW = const ParserErrorCo de.con3('MISSING_EXPRESSION_IN_THROW', 74, "Throw expressions must compute the o bject to be thrown");
7503 7487
7504 static final ParserErrorCode MISSING_FUNCTION_BODY = new ParserErrorCode.con3( 'MISSING_FUNCTION_BODY', 75, "A function body must be provided"); 7488 static const ParserErrorCode MISSING_FUNCTION_BODY = const ParserErrorCode.con 3('MISSING_FUNCTION_BODY', 75, "A function body must be provided");
7505 7489
7506 static final ParserErrorCode MISSING_FUNCTION_PARAMETERS = new ParserErrorCode .con3('MISSING_FUNCTION_PARAMETERS', 76, "Functions must have an explicit list o f parameters"); 7490 static const ParserErrorCode MISSING_FUNCTION_PARAMETERS = const ParserErrorCo de.con3('MISSING_FUNCTION_PARAMETERS', 76, "Functions must have an explicit list of parameters");
7507 7491
7508 static final ParserErrorCode MISSING_IDENTIFIER = new ParserErrorCode.con3('MI SSING_IDENTIFIER', 77, "Expected an identifier"); 7492 static const ParserErrorCode MISSING_IDENTIFIER = const ParserErrorCode.con3(' MISSING_IDENTIFIER', 77, "Expected an identifier");
7509 7493
7510 static final ParserErrorCode MISSING_KEYWORD_OPERATOR = new ParserErrorCode.co n3('MISSING_KEYWORD_OPERATOR', 78, "Operator declarations must be preceeded by t he keyword 'operator'"); 7494 static const ParserErrorCode MISSING_KEYWORD_OPERATOR = const ParserErrorCode. con3('MISSING_KEYWORD_OPERATOR', 78, "Operator declarations must be preceeded by the keyword 'operator'");
7511 7495
7512 static final ParserErrorCode MISSING_NAME_IN_LIBRARY_DIRECTIVE = new ParserErr orCode.con3('MISSING_NAME_IN_LIBRARY_DIRECTIVE', 79, "Library directives must in clude a library name"); 7496 static const ParserErrorCode MISSING_NAME_IN_LIBRARY_DIRECTIVE = const ParserE rrorCode.con3('MISSING_NAME_IN_LIBRARY_DIRECTIVE', 79, "Library directives must include a library name");
7513 7497
7514 static final ParserErrorCode MISSING_NAME_IN_PART_OF_DIRECTIVE = new ParserErr orCode.con3('MISSING_NAME_IN_PART_OF_DIRECTIVE', 80, "Library directives must in clude a library name"); 7498 static const ParserErrorCode MISSING_NAME_IN_PART_OF_DIRECTIVE = const ParserE rrorCode.con3('MISSING_NAME_IN_PART_OF_DIRECTIVE', 80, "Library directives must include a library name");
7515 7499
7516 static final ParserErrorCode MISSING_STATEMENT = new ParserErrorCode.con3('MIS SING_STATEMENT', 81, "Expected a statement"); 7500 static const ParserErrorCode MISSING_STATEMENT = const ParserErrorCode.con3('M ISSING_STATEMENT', 81, "Expected a statement");
7517 7501
7518 static final ParserErrorCode MISSING_TERMINATOR_FOR_PARAMETER_GROUP = new Pars erErrorCode.con3('MISSING_TERMINATOR_FOR_PARAMETER_GROUP', 82, "There is no '%s' to close the parameter group"); 7502 static const ParserErrorCode MISSING_TERMINATOR_FOR_PARAMETER_GROUP = const Pa rserErrorCode.con3('MISSING_TERMINATOR_FOR_PARAMETER_GROUP', 82, "There is no '% s' to close the parameter group");
7519 7503
7520 static final ParserErrorCode MISSING_TYPEDEF_PARAMETERS = new ParserErrorCode. con3('MISSING_TYPEDEF_PARAMETERS', 83, "Type aliases for functions must have an explicit list of parameters"); 7504 static const ParserErrorCode MISSING_TYPEDEF_PARAMETERS = const ParserErrorCod e.con3('MISSING_TYPEDEF_PARAMETERS', 83, "Type aliases for functions must have a n explicit list of parameters");
7521 7505
7522 static final ParserErrorCode MISSING_VARIABLE_IN_FOR_EACH = new ParserErrorCod e.con3('MISSING_VARIABLE_IN_FOR_EACH', 84, "A loop variable must be declared in a for-each loop before the 'in', but none were found"); 7506 static const ParserErrorCode MISSING_VARIABLE_IN_FOR_EACH = const ParserErrorC ode.con3('MISSING_VARIABLE_IN_FOR_EACH', 84, "A loop variable must be declared i n a for-each loop before the 'in', but none were found");
7523 7507
7524 static final ParserErrorCode MIXED_PARAMETER_GROUPS = new ParserErrorCode.con3 ('MIXED_PARAMETER_GROUPS', 85, "Cannot have both positional and named parameters in a single parameter list"); 7508 static const ParserErrorCode MIXED_PARAMETER_GROUPS = const ParserErrorCode.co n3('MIXED_PARAMETER_GROUPS', 85, "Cannot have both positional and named paramete rs in a single parameter list");
7525 7509
7526 static final ParserErrorCode MULTIPLE_EXTENDS_CLAUSES = new ParserErrorCode.co n3('MULTIPLE_EXTENDS_CLAUSES', 86, "Each class definition can have at most one e xtends clause"); 7510 static const ParserErrorCode MULTIPLE_EXTENDS_CLAUSES = const ParserErrorCode. con3('MULTIPLE_EXTENDS_CLAUSES', 86, "Each class definition can have at most one extends clause");
7527 7511
7528 static final ParserErrorCode MULTIPLE_IMPLEMENTS_CLAUSES = new ParserErrorCode .con3('MULTIPLE_IMPLEMENTS_CLAUSES', 87, "Each class definition can have at most one implements clause"); 7512 static const ParserErrorCode MULTIPLE_IMPLEMENTS_CLAUSES = const ParserErrorCo de.con3('MULTIPLE_IMPLEMENTS_CLAUSES', 87, "Each class definition can have at mo st one implements clause");
7529 7513
7530 static final ParserErrorCode MULTIPLE_LIBRARY_DIRECTIVES = new ParserErrorCode .con3('MULTIPLE_LIBRARY_DIRECTIVES', 88, "Only one library directive may be decl ared in a file"); 7514 static const ParserErrorCode MULTIPLE_LIBRARY_DIRECTIVES = const ParserErrorCo de.con3('MULTIPLE_LIBRARY_DIRECTIVES', 88, "Only one library directive may be de clared in a file");
7531 7515
7532 static final ParserErrorCode MULTIPLE_NAMED_PARAMETER_GROUPS = new ParserError Code.con3('MULTIPLE_NAMED_PARAMETER_GROUPS', 89, "Cannot have multiple groups of named parameters in a single parameter list"); 7516 static const ParserErrorCode MULTIPLE_NAMED_PARAMETER_GROUPS = const ParserErr orCode.con3('MULTIPLE_NAMED_PARAMETER_GROUPS', 89, "Cannot have multiple groups of named parameters in a single parameter list");
7533 7517
7534 static final ParserErrorCode MULTIPLE_PART_OF_DIRECTIVES = new ParserErrorCode .con3('MULTIPLE_PART_OF_DIRECTIVES', 90, "Only one part-of directive may be decl ared in a file"); 7518 static const ParserErrorCode MULTIPLE_PART_OF_DIRECTIVES = const ParserErrorCo de.con3('MULTIPLE_PART_OF_DIRECTIVES', 90, "Only one part-of directive may be de clared in a file");
7535 7519
7536 static final ParserErrorCode MULTIPLE_POSITIONAL_PARAMETER_GROUPS = new Parser ErrorCode.con3('MULTIPLE_POSITIONAL_PARAMETER_GROUPS', 91, "Cannot have multiple groups of positional parameters in a single parameter list"); 7520 static const ParserErrorCode MULTIPLE_POSITIONAL_PARAMETER_GROUPS = const Pars erErrorCode.con3('MULTIPLE_POSITIONAL_PARAMETER_GROUPS', 91, "Cannot have multip le groups of positional parameters in a single parameter list");
7537 7521
7538 static final ParserErrorCode MULTIPLE_VARIABLES_IN_FOR_EACH = new ParserErrorC ode.con3('MULTIPLE_VARIABLES_IN_FOR_EACH', 92, "A single loop variable must be d eclared in a for-each loop before the 'in', but %s were found"); 7522 static const ParserErrorCode MULTIPLE_VARIABLES_IN_FOR_EACH = const ParserErro rCode.con3('MULTIPLE_VARIABLES_IN_FOR_EACH', 92, "A single loop variable must be declared in a for-each loop before the 'in', but %s were found");
7539 7523
7540 static final ParserErrorCode MULTIPLE_WITH_CLAUSES = new ParserErrorCode.con3( 'MULTIPLE_WITH_CLAUSES', 93, "Each class definition can have at most one with cl ause"); 7524 static const ParserErrorCode MULTIPLE_WITH_CLAUSES = const ParserErrorCode.con 3('MULTIPLE_WITH_CLAUSES', 93, "Each class definition can have at most one with clause");
7541 7525
7542 static final ParserErrorCode NAMED_FUNCTION_EXPRESSION = new ParserErrorCode.c on3('NAMED_FUNCTION_EXPRESSION', 94, "Function expressions cannot be named"); 7526 static const ParserErrorCode NAMED_FUNCTION_EXPRESSION = const ParserErrorCode .con3('NAMED_FUNCTION_EXPRESSION', 94, "Function expressions cannot be named");
7543 7527
7544 static final ParserErrorCode NAMED_PARAMETER_OUTSIDE_GROUP = new ParserErrorCo de.con3('NAMED_PARAMETER_OUTSIDE_GROUP', 95, "Named parameters must be enclosed in curly braces ('{' and '}')"); 7528 static const ParserErrorCode NAMED_PARAMETER_OUTSIDE_GROUP = const ParserError Code.con3('NAMED_PARAMETER_OUTSIDE_GROUP', 95, "Named parameters must be enclose d in curly braces ('{' and '}')");
7545 7529
7546 static final ParserErrorCode NATIVE_CLAUSE_IN_NON_SDK_CODE = new ParserErrorCo de.con3('NATIVE_CLAUSE_IN_NON_SDK_CODE', 96, "Native clause can only be used in the SDK and code that is loaded through native extensions"); 7530 static const ParserErrorCode NATIVE_CLAUSE_IN_NON_SDK_CODE = const ParserError Code.con3('NATIVE_CLAUSE_IN_NON_SDK_CODE', 96, "Native clause can only be used i n the SDK and code that is loaded through native extensions");
7547 7531
7548 static final ParserErrorCode NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE = new Parser ErrorCode.con3('NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE', 97, "Native functions can only be declared in the SDK and code that is loaded through native extensions") ; 7532 static const ParserErrorCode NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE = const Pars erErrorCode.con3('NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE', 97, "Native functions c an only be declared in the SDK and code that is loaded through native extensions ");
7549 7533
7550 static final ParserErrorCode NON_CONSTRUCTOR_FACTORY = new ParserErrorCode.con 3('NON_CONSTRUCTOR_FACTORY', 98, "Only constructors can be declared to be a 'fac tory'"); 7534 static const ParserErrorCode NON_CONSTRUCTOR_FACTORY = const ParserErrorCode.c on3('NON_CONSTRUCTOR_FACTORY', 98, "Only constructors can be declared to be a 'f actory'");
7551 7535
7552 static final ParserErrorCode NON_IDENTIFIER_LIBRARY_NAME = new ParserErrorCode .con3('NON_IDENTIFIER_LIBRARY_NAME', 99, "The name of a library must be an ident ifier"); 7536 static const ParserErrorCode NON_IDENTIFIER_LIBRARY_NAME = const ParserErrorCo de.con3('NON_IDENTIFIER_LIBRARY_NAME', 99, "The name of a library must be an ide ntifier");
7553 7537
7554 static final ParserErrorCode NON_PART_OF_DIRECTIVE_IN_PART = new ParserErrorCo de.con3('NON_PART_OF_DIRECTIVE_IN_PART', 100, "The part-of directive must be the only directive in a part"); 7538 static const ParserErrorCode NON_PART_OF_DIRECTIVE_IN_PART = const ParserError Code.con3('NON_PART_OF_DIRECTIVE_IN_PART', 100, "The part-of directive must be t he only directive in a part");
7555 7539
7556 static final ParserErrorCode NON_USER_DEFINABLE_OPERATOR = new ParserErrorCode .con3('NON_USER_DEFINABLE_OPERATOR', 101, "The operator '%s' is not user definab le"); 7540 static const ParserErrorCode NON_USER_DEFINABLE_OPERATOR = const ParserErrorCo de.con3('NON_USER_DEFINABLE_OPERATOR', 101, "The operator '%s' is not user defin able");
7557 7541
7558 static final ParserErrorCode NORMAL_BEFORE_OPTIONAL_PARAMETERS = new ParserErr orCode.con3('NORMAL_BEFORE_OPTIONAL_PARAMETERS', 102, "Normal parameters must oc cur before optional parameters"); 7542 static const ParserErrorCode NORMAL_BEFORE_OPTIONAL_PARAMETERS = const ParserE rrorCode.con3('NORMAL_BEFORE_OPTIONAL_PARAMETERS', 102, "Normal parameters must occur before optional parameters");
7559 7543
7560 static final ParserErrorCode POSITIONAL_AFTER_NAMED_ARGUMENT = new ParserError Code.con3('POSITIONAL_AFTER_NAMED_ARGUMENT', 103, "Positional arguments must occ ur before named arguments"); 7544 static const ParserErrorCode POSITIONAL_AFTER_NAMED_ARGUMENT = const ParserErr orCode.con3('POSITIONAL_AFTER_NAMED_ARGUMENT', 103, "Positional arguments must o ccur before named arguments");
7561 7545
7562 static final ParserErrorCode POSITIONAL_PARAMETER_OUTSIDE_GROUP = new ParserEr rorCode.con3('POSITIONAL_PARAMETER_OUTSIDE_GROUP', 104, "Positional parameters m ust be enclosed in square brackets ('[' and ']')"); 7546 static const ParserErrorCode POSITIONAL_PARAMETER_OUTSIDE_GROUP = const Parser ErrorCode.con3('POSITIONAL_PARAMETER_OUTSIDE_GROUP', 104, "Positional parameters must be enclosed in square brackets ('[' and ']')");
7563 7547
7564 static final ParserErrorCode REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR = new Pars erErrorCode.con3('REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR', 105, "Only factory co nstructor can specify '=' redirection."); 7548 static const ParserErrorCode REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR = const Pa rserErrorCode.con3('REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR', 105, "Only factory constructor can specify '=' redirection.");
7565 7549
7566 static final ParserErrorCode SETTER_IN_FUNCTION = new ParserErrorCode.con3('SE TTER_IN_FUNCTION', 106, "Setters cannot be defined within methods or functions") ; 7550 static const ParserErrorCode SETTER_IN_FUNCTION = const ParserErrorCode.con3(' SETTER_IN_FUNCTION', 106, "Setters cannot be defined within methods or functions ");
7567 7551
7568 static final ParserErrorCode STATIC_AFTER_CONST = new ParserErrorCode.con3('ST ATIC_AFTER_CONST', 107, "The modifier 'static' should be before the modifier 'co nst'"); 7552 static const ParserErrorCode STATIC_AFTER_CONST = const ParserErrorCode.con3(' STATIC_AFTER_CONST', 107, "The modifier 'static' should be before the modifier ' const'");
7569 7553
7570 static final ParserErrorCode STATIC_AFTER_FINAL = new ParserErrorCode.con3('ST ATIC_AFTER_FINAL', 108, "The modifier 'static' should be before the modifier 'fi nal'"); 7554 static const ParserErrorCode STATIC_AFTER_FINAL = const ParserErrorCode.con3(' STATIC_AFTER_FINAL', 108, "The modifier 'static' should be before the modifier ' final'");
7571 7555
7572 static final ParserErrorCode STATIC_AFTER_VAR = new ParserErrorCode.con3('STAT IC_AFTER_VAR', 109, "The modifier 'static' should be before the modifier 'var'") ; 7556 static const ParserErrorCode STATIC_AFTER_VAR = const ParserErrorCode.con3('ST ATIC_AFTER_VAR', 109, "The modifier 'static' should be before the modifier 'var' ");
7573 7557
7574 static final ParserErrorCode STATIC_CONSTRUCTOR = new ParserErrorCode.con3('ST ATIC_CONSTRUCTOR', 110, "Constructors cannot be static"); 7558 static const ParserErrorCode STATIC_CONSTRUCTOR = const ParserErrorCode.con3(' STATIC_CONSTRUCTOR', 110, "Constructors cannot be static");
7575 7559
7576 static final ParserErrorCode STATIC_GETTER_WITHOUT_BODY = new ParserErrorCode. con3('STATIC_GETTER_WITHOUT_BODY', 111, "A 'static' getter must have a body"); 7560 static const ParserErrorCode STATIC_GETTER_WITHOUT_BODY = const ParserErrorCod e.con3('STATIC_GETTER_WITHOUT_BODY', 111, "A 'static' getter must have a body");
7577 7561
7578 static final ParserErrorCode STATIC_OPERATOR = new ParserErrorCode.con3('STATI C_OPERATOR', 112, "Operators cannot be static"); 7562 static const ParserErrorCode STATIC_OPERATOR = const ParserErrorCode.con3('STA TIC_OPERATOR', 112, "Operators cannot be static");
7579 7563
7580 static final ParserErrorCode STATIC_SETTER_WITHOUT_BODY = new ParserErrorCode. con3('STATIC_SETTER_WITHOUT_BODY', 113, "A 'static' setter must have a body"); 7564 static const ParserErrorCode STATIC_SETTER_WITHOUT_BODY = const ParserErrorCod e.con3('STATIC_SETTER_WITHOUT_BODY', 113, "A 'static' setter must have a body");
7581 7565
7582 static final ParserErrorCode STATIC_TOP_LEVEL_DECLARATION = new ParserErrorCod e.con3('STATIC_TOP_LEVEL_DECLARATION', 114, "Top-level declarations cannot be de clared to be 'static'"); 7566 static const ParserErrorCode STATIC_TOP_LEVEL_DECLARATION = const ParserErrorC ode.con3('STATIC_TOP_LEVEL_DECLARATION', 114, "Top-level declarations cannot be declared to be 'static'");
7583 7567
7584 static final ParserErrorCode SWITCH_HAS_CASE_AFTER_DEFAULT_CASE = new ParserEr rorCode.con3('SWITCH_HAS_CASE_AFTER_DEFAULT_CASE', 115, "The 'default' case shou ld be the last case in a switch statement"); 7568 static const ParserErrorCode SWITCH_HAS_CASE_AFTER_DEFAULT_CASE = const Parser ErrorCode.con3('SWITCH_HAS_CASE_AFTER_DEFAULT_CASE', 115, "The 'default' case sh ould be the last case in a switch statement");
7585 7569
7586 static final ParserErrorCode SWITCH_HAS_MULTIPLE_DEFAULT_CASES = new ParserErr orCode.con3('SWITCH_HAS_MULTIPLE_DEFAULT_CASES', 116, "The 'default' case can on ly be declared once"); 7570 static const ParserErrorCode SWITCH_HAS_MULTIPLE_DEFAULT_CASES = const ParserE rrorCode.con3('SWITCH_HAS_MULTIPLE_DEFAULT_CASES', 116, "The 'default' case can only be declared once");
7587 7571
7588 static final ParserErrorCode TOP_LEVEL_OPERATOR = new ParserErrorCode.con3('TO P_LEVEL_OPERATOR', 117, "Operators must be declared within a class"); 7572 static const ParserErrorCode TOP_LEVEL_OPERATOR = const ParserErrorCode.con3(' TOP_LEVEL_OPERATOR', 117, "Operators must be declared within a class");
7589 7573
7590 static final ParserErrorCode UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP = new P arserErrorCode.con3('UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP', 118, "There is no '%s' to open a parameter group"); 7574 static const ParserErrorCode UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP = const ParserErrorCode.con3('UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP', 118, "There i s no '%s' to open a parameter group");
7591 7575
7592 static final ParserErrorCode UNEXPECTED_TOKEN = new ParserErrorCode.con3('UNEX PECTED_TOKEN', 119, "Unexpected token '%s'"); 7576 static const ParserErrorCode UNEXPECTED_TOKEN = const ParserErrorCode.con3('UN EXPECTED_TOKEN', 119, "Unexpected token '%s'");
7593 7577
7594 static final ParserErrorCode WITH_BEFORE_EXTENDS = new ParserErrorCode.con3('W ITH_BEFORE_EXTENDS', 120, "The extends clause must be before the with clause"); 7578 static const ParserErrorCode WITH_BEFORE_EXTENDS = const ParserErrorCode.con3( 'WITH_BEFORE_EXTENDS', 120, "The extends clause must be before the with clause") ;
7595 7579
7596 static final ParserErrorCode WITH_WITHOUT_EXTENDS = new ParserErrorCode.con3(' WITH_WITHOUT_EXTENDS', 121, "The with clause cannot be used without an extends c lause"); 7580 static const ParserErrorCode WITH_WITHOUT_EXTENDS = const ParserErrorCode.con3 ('WITH_WITHOUT_EXTENDS', 121, "The with clause cannot be used without an extends clause");
7597 7581
7598 static final ParserErrorCode WRONG_SEPARATOR_FOR_NAMED_PARAMETER = new ParserE rrorCode.con3('WRONG_SEPARATOR_FOR_NAMED_PARAMETER', 122, "The default value of a named parameter should be preceeded by ':'"); 7582 static const ParserErrorCode WRONG_SEPARATOR_FOR_NAMED_PARAMETER = const Parse rErrorCode.con3('WRONG_SEPARATOR_FOR_NAMED_PARAMETER', 122, "The default value o f a named parameter should be preceeded by ':'");
7599 7583
7600 static final ParserErrorCode WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER = new Pa rserErrorCode.con3('WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER', 123, "The default value of a positional parameter should be preceeded by '='"); 7584 static const ParserErrorCode WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER = const ParserErrorCode.con3('WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER', 123, "The defau lt value of a positional parameter should be preceeded by '='");
7601 7585
7602 static final ParserErrorCode WRONG_TERMINATOR_FOR_PARAMETER_GROUP = new Parser ErrorCode.con3('WRONG_TERMINATOR_FOR_PARAMETER_GROUP', 124, "Expected '%s' to cl ose parameter group"); 7586 static const ParserErrorCode WRONG_TERMINATOR_FOR_PARAMETER_GROUP = const Pars erErrorCode.con3('WRONG_TERMINATOR_FOR_PARAMETER_GROUP', 124, "Expected '%s' to close parameter group");
7603 7587
7604 static final ParserErrorCode VAR_AND_TYPE = new ParserErrorCode.con3('VAR_AND_ TYPE', 125, "Variables cannot be declared using both 'var' and a type name; remo ve the 'var'"); 7588 static const ParserErrorCode VAR_AND_TYPE = const ParserErrorCode.con3('VAR_AN D_TYPE', 125, "Variables cannot be declared using both 'var' and a type name; re move the 'var'");
7605 7589
7606 static final ParserErrorCode VAR_AS_TYPE_NAME = new ParserErrorCode.con3('VAR_ AS_TYPE_NAME', 126, "The keyword 'var' cannot be used as a type name"); 7590 static const ParserErrorCode VAR_AS_TYPE_NAME = const ParserErrorCode.con3('VA R_AS_TYPE_NAME', 126, "The keyword 'var' cannot be used as a type name");
7607 7591
7608 static final ParserErrorCode VAR_CLASS = new ParserErrorCode.con3('VAR_CLASS', 127, "Classes cannot be declared to be 'var'"); 7592 static const ParserErrorCode VAR_CLASS = const ParserErrorCode.con3('VAR_CLASS ', 127, "Classes cannot be declared to be 'var'");
7609 7593
7610 static final ParserErrorCode VAR_RETURN_TYPE = new ParserErrorCode.con3('VAR_R ETURN_TYPE', 128, "The return type cannot be 'var'"); 7594 static const ParserErrorCode VAR_RETURN_TYPE = const ParserErrorCode.con3('VAR _RETURN_TYPE', 128, "The return type cannot be 'var'");
7611 7595
7612 static final ParserErrorCode VAR_TYPEDEF = new ParserErrorCode.con3('VAR_TYPED EF', 129, "Type aliases cannot be declared to be 'var'"); 7596 static const ParserErrorCode VAR_TYPEDEF = const ParserErrorCode.con3('VAR_TYP EDEF', 129, "Type aliases cannot be declared to be 'var'");
7613 7597
7614 static final ParserErrorCode VOID_PARAMETER = new ParserErrorCode.con3('VOID_P ARAMETER', 130, "Parameters cannot have a type of 'void'"); 7598 static const ParserErrorCode VOID_PARAMETER = const ParserErrorCode.con3('VOID _PARAMETER', 130, "Parameters cannot have a type of 'void'");
7615 7599
7616 static final ParserErrorCode VOID_VARIABLE = new ParserErrorCode.con3('VOID_VA RIABLE', 131, "Variables cannot have a type of 'void'"); 7600 static const ParserErrorCode VOID_VARIABLE = const ParserErrorCode.con3('VOID_ VARIABLE', 131, "Variables cannot have a type of 'void'");
7617 7601
7618 static final List<ParserErrorCode> values = [ 7602 static const List<ParserErrorCode> values = const [
7619 ABSTRACT_CLASS_MEMBER, 7603 ABSTRACT_CLASS_MEMBER,
7620 ABSTRACT_STATIC_METHOD, 7604 ABSTRACT_STATIC_METHOD,
7621 ABSTRACT_TOP_LEVEL_FUNCTION, 7605 ABSTRACT_TOP_LEVEL_FUNCTION,
7622 ABSTRACT_TOP_LEVEL_VARIABLE, 7606 ABSTRACT_TOP_LEVEL_VARIABLE,
7623 ABSTRACT_TYPEDEF, 7607 ABSTRACT_TYPEDEF,
7624 ASSERT_DOES_NOT_TAKE_ASSIGNMENT, 7608 ASSERT_DOES_NOT_TAKE_ASSIGNMENT,
7625 ASSERT_DOES_NOT_TAKE_CASCADE, 7609 ASSERT_DOES_NOT_TAKE_CASCADE,
7626 ASSERT_DOES_NOT_TAKE_THROW, 7610 ASSERT_DOES_NOT_TAKE_THROW,
7627 ASSERT_DOES_NOT_TAKE_RETHROW, 7611 ASSERT_DOES_NOT_TAKE_RETHROW,
7628 BREAK_OUTSIDE_OF_LOOP, 7612 BREAK_OUTSIDE_OF_LOOP,
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
7745 VAR_AS_TYPE_NAME, 7729 VAR_AS_TYPE_NAME,
7746 VAR_CLASS, 7730 VAR_CLASS,
7747 VAR_RETURN_TYPE, 7731 VAR_RETURN_TYPE,
7748 VAR_TYPEDEF, 7732 VAR_TYPEDEF,
7749 VOID_PARAMETER, 7733 VOID_PARAMETER,
7750 VOID_VARIABLE]; 7734 VOID_VARIABLE];
7751 7735
7752 /** 7736 /**
7753 * The severity of this error. 7737 * The severity of this error.
7754 */ 7738 */
7755 ErrorSeverity _severity; 7739 final ErrorSeverity errorSeverity;
7756 7740
7757 /** 7741 /**
7758 * The template used to create the message to be displayed for this error. 7742 * The template used to create the message to be displayed for this error.
7759 */ 7743 */
7760 String _message; 7744 final String message;
7761 7745
7762 /** 7746 /**
7763 * The template used to create the correction to be displayed for this error, or `null` if 7747 * The template used to create the correction to be displayed for this error, or `null` if
7764 * there is no correction information for this error. 7748 * there is no correction information for this error.
7765 */ 7749 */
7766 String correction8; 7750 final String correction;
7767 7751
7768 /** 7752 /**
7769 * Initialize a newly created error code to have the given severity and messag e. 7753 * Initialize a newly created error code to have the given severity and messag e.
7770 * 7754 *
7771 * @param severity the severity of the error 7755 * @param errorSeverity the severity of the error
7772 * @param message the message template used to create the message to be displa yed for the error 7756 * @param message the message template used to create the message to be displa yed for the error
7773 */ 7757 */
7774 ParserErrorCode.con1(String name, int ordinal, ErrorSeverity severity, String message) : super(name, ordinal) { 7758 const ParserErrorCode.con1(String name, int ordinal, ErrorSeverity errorSeveri ty, String message) : this.con2(name, ordinal, errorSeverity, message, null);
7775 this._severity = severity;
7776 this._message = message;
7777 }
7778 7759
7779 /** 7760 /**
7780 * Initialize a newly created error code to have the given severity, message a nd correction. 7761 * Initialize a newly created error code to have the given severity, message a nd correction.
7781 * 7762 *
7782 * @param severity the severity of the error 7763 * @param errorSeverity the severity of the error
7783 * @param message the template used to create the message to be displayed for the error 7764 * @param message the template used to create the message to be displayed for the error
7784 * @param correction the template used to create the correction to be displaye d for the error 7765 * @param correction the template used to create the correction to be displaye d for the error
7785 */ 7766 */
7786 ParserErrorCode.con2(String name, int ordinal, ErrorSeverity severity, String message, String correction) : super(name, ordinal) { 7767 const ParserErrorCode.con2(String name, int ordinal, this.errorSeverity, this. message, this.correction) : super(name, ordinal);
7787 this._severity = severity;
7788 this._message = message;
7789 this.correction8 = correction;
7790 }
7791 7768
7792 /** 7769 /**
7793 * Initialize a newly created error code to have the given message and a sever ity of ERROR. 7770 * Initialize a newly created error code to have the given message and a sever ity of ERROR.
7794 * 7771 *
7795 * @param message the message template used to create the message to be displa yed for the error 7772 * @param message the message template used to create the message to be displa yed for the error
7796 */ 7773 */
7797 ParserErrorCode.con3(String name, int ordinal, String message) : this.con1(nam e, ordinal, ErrorSeverity.ERROR, message); 7774 const ParserErrorCode.con3(String name, int ordinal, String message) : this.co n2(name, ordinal, ErrorSeverity.ERROR, message, null);
7798
7799 @override
7800 String get correction => correction8;
7801
7802 @override
7803 ErrorSeverity get errorSeverity => _severity;
7804
7805 @override
7806 String get message => _message;
7807 7775
7808 @override 7776 @override
7809 ErrorType get type => ErrorType.SYNTACTIC_ERROR; 7777 ErrorType get type => ErrorType.SYNTACTIC_ERROR;
7810 } 7778 }
7811 7779
7812 /** 7780 /**
7813 * Instances of the class `ResolutionCopier` copies resolution information from one AST 7781 * Instances of the class `ResolutionCopier` copies resolution information from one AST
7814 * structure to another as long as the structures of the corresponding children of a pair of nodes 7782 * structure to another as long as the structures of the corresponding children of a pair of nodes
7815 * are the same. 7783 * are the same.
7816 */ 7784 */
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
7916 7884
7917 @override 7885 @override
7918 bool visitBlockFunctionBody(BlockFunctionBody node) { 7886 bool visitBlockFunctionBody(BlockFunctionBody node) {
7919 BlockFunctionBody toNode = this._toNode as BlockFunctionBody; 7887 BlockFunctionBody toNode = this._toNode as BlockFunctionBody;
7920 return _isEqualNodes(node.block, toNode.block); 7888 return _isEqualNodes(node.block, toNode.block);
7921 } 7889 }
7922 7890
7923 @override 7891 @override
7924 bool visitBooleanLiteral(BooleanLiteral node) { 7892 bool visitBooleanLiteral(BooleanLiteral node) {
7925 BooleanLiteral toNode = this._toNode as BooleanLiteral; 7893 BooleanLiteral toNode = this._toNode as BooleanLiteral;
7926 if (javaBooleanAnd(_isEqualTokens(node.literal, toNode.literal), identical(n ode.value, toNode.value))) { 7894 if (javaBooleanAnd(_isEqualTokens(node.literal, toNode.literal), node.value == toNode.value)) {
7927 toNode.propagatedType = node.propagatedType; 7895 toNode.propagatedType = node.propagatedType;
7928 toNode.staticType = node.staticType; 7896 toNode.staticType = node.staticType;
7929 return true; 7897 return true;
7930 } 7898 }
7931 return false; 7899 return false;
7932 } 7900 }
7933 7901
7934 @override 7902 @override
7935 bool visitBreakStatement(BreakStatement node) { 7903 bool visitBreakStatement(BreakStatement node) {
7936 BreakStatement toNode = this._toNode as BreakStatement; 7904 BreakStatement toNode = this._toNode as BreakStatement;
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
8033 8001
8034 @override 8002 @override
8035 bool visitDeclaredIdentifier(DeclaredIdentifier node) { 8003 bool visitDeclaredIdentifier(DeclaredIdentifier node) {
8036 DeclaredIdentifier toNode = this._toNode as DeclaredIdentifier; 8004 DeclaredIdentifier toNode = this._toNode as DeclaredIdentifier;
8037 return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualN odes(node.documentationComment, toNode.documentationComment), _isEqualNodeLists( node.metadata, toNode.metadata)), _isEqualTokens(node.keyword, toNode.keyword)), _isEqualNodes(node.type, toNode.type)), _isEqualNodes(node.identifier, toNode.i dentifier)); 8005 return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualN odes(node.documentationComment, toNode.documentationComment), _isEqualNodeLists( node.metadata, toNode.metadata)), _isEqualTokens(node.keyword, toNode.keyword)), _isEqualNodes(node.type, toNode.type)), _isEqualNodes(node.identifier, toNode.i dentifier));
8038 } 8006 }
8039 8007
8040 @override 8008 @override
8041 bool visitDefaultFormalParameter(DefaultFormalParameter node) { 8009 bool visitDefaultFormalParameter(DefaultFormalParameter node) {
8042 DefaultFormalParameter toNode = this._toNode as DefaultFormalParameter; 8010 DefaultFormalParameter toNode = this._toNode as DefaultFormalParameter;
8043 return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.param eter, toNode.parameter), identical(node.kind, toNode.kind)), _isEqualTokens(node .separator, toNode.separator)), _isEqualNodes(node.defaultValue, toNode.defaultV alue)); 8011 return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(_isEqualNodes(node.param eter, toNode.parameter), node.kind == toNode.kind), _isEqualTokens(node.separato r, toNode.separator)), _isEqualNodes(node.defaultValue, toNode.defaultValue));
8044 } 8012 }
8045 8013
8046 @override 8014 @override
8047 bool visitDoStatement(DoStatement node) { 8015 bool visitDoStatement(DoStatement node) {
8048 DoStatement toNode = this._toNode as DoStatement; 8016 DoStatement toNode = this._toNode as DoStatement;
8049 return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBoole anAnd(javaBooleanAnd(_isEqualTokens(node.doKeyword, toNode.doKeyword), _isEqualN odes(node.body, toNode.body)), _isEqualTokens(node.whileKeyword, toNode.whileKey word)), _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis)), _isEqualN odes(node.condition, toNode.condition)), _isEqualTokens(node.rightParenthesis, t oNode.rightParenthesis)), _isEqualTokens(node.semicolon, toNode.semicolon)); 8017 return javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBooleanAnd(javaBoole anAnd(javaBooleanAnd(_isEqualTokens(node.doKeyword, toNode.doKeyword), _isEqualN odes(node.body, toNode.body)), _isEqualTokens(node.whileKeyword, toNode.whileKey word)), _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis)), _isEqualN odes(node.condition, toNode.condition)), _isEqualTokens(node.rightParenthesis, t oNode.rightParenthesis)), _isEqualTokens(node.semicolon, toNode.semicolon));
8050 } 8018 }
8051 8019
8052 @override 8020 @override
8053 bool visitDoubleLiteral(DoubleLiteral node) { 8021 bool visitDoubleLiteral(DoubleLiteral node) {
(...skipping 940 matching lines...) Expand 10 before | Expand all | Expand 10 after
8994 return trampoline(target, arguments[0], arguments[1]); 8962 return trampoline(target, arguments[0], arguments[1]);
8995 case 3: 8963 case 3:
8996 return trampoline(target, arguments[0], arguments[1], arguments[2]); 8964 return trampoline(target, arguments[0], arguments[1], arguments[2]);
8997 case 4: 8965 case 4:
8998 return trampoline(target, arguments[0], arguments[1], arguments[2], argu ments[3]); 8966 return trampoline(target, arguments[0], arguments[1], arguments[2], argu ments[3]);
8999 default: 8967 default:
9000 throw new IllegalArgumentException("Not implemented for > 4 arguments"); 8968 throw new IllegalArgumentException("Not implemented for > 4 arguments");
9001 } 8969 }
9002 } 8970 }
9003 } 8971 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/java_core.dart ('k') | pkg/analyzer/lib/src/generated/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698