OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 // This code was auto-generated, is not intended to be edited, and is subject to | |
6 // significant change. Please see the README file for more information. | |
7 | |
8 library engine.parser; | 5 library engine.parser; |
9 | 6 |
10 import 'dart:collection'; | 7 import 'dart:collection'; |
11 import "dart:math" as math; | 8 import "dart:math" as math; |
12 | 9 |
13 import 'ast.dart'; | 10 import 'ast.dart'; |
14 import 'engine.dart' show AnalysisEngine, AnalysisOptionsImpl; | 11 import 'engine.dart' show AnalysisEngine, AnalysisOptionsImpl; |
15 import 'error.dart'; | 12 import 'error.dart'; |
16 import 'java_core.dart'; | 13 import 'java_core.dart'; |
17 import 'java_engine.dart'; | 14 import 'java_engine.dart'; |
(...skipping 67 matching lines...) Loading... |
85 0, (Parser target) => target.parseTypeArgumentList()), | 82 0, (Parser target) => target.parseTypeArgumentList()), |
86 'parseTypeName_0': | 83 'parseTypeName_0': |
87 new MethodTrampoline(0, (Parser target) => target.parseTypeName()), | 84 new MethodTrampoline(0, (Parser target) => target.parseTypeName()), |
88 'parseTypeParameter_0': | 85 'parseTypeParameter_0': |
89 new MethodTrampoline(0, (Parser target) => target.parseTypeParameter()), | 86 new MethodTrampoline(0, (Parser target) => target.parseTypeParameter()), |
90 'parseTypeParameterList_0': new MethodTrampoline( | 87 'parseTypeParameterList_0': new MethodTrampoline( |
91 0, (Parser target) => target.parseTypeParameterList()), | 88 0, (Parser target) => target.parseTypeParameterList()), |
92 'parseWithClause_0': | 89 'parseWithClause_0': |
93 new MethodTrampoline(0, (Parser target) => target.parseWithClause()), | 90 new MethodTrampoline(0, (Parser target) => target.parseWithClause()), |
94 'advance_0': new MethodTrampoline(0, (Parser target) => target._advance()), | 91 'advance_0': new MethodTrampoline(0, (Parser target) => target._advance()), |
95 'appendScalarValue_5': new MethodTrampoline(5, (Parser target, arg0, arg1, | 92 'appendScalarValue_5': new MethodTrampoline( |
96 arg2, arg3, | 93 5, |
97 arg4) => target._appendScalarValue(arg0, arg1, arg2, arg3, arg4)), | 94 (Parser target, arg0, arg1, arg2, arg3, arg4) => |
98 'computeStringValue_3': new MethodTrampoline(3, (Parser target, arg0, arg1, | 95 target._appendScalarValue(arg0, arg1, arg2, arg3, arg4)), |
99 arg2) => target._computeStringValue(arg0, arg1, arg2)), | 96 'computeStringValue_3': new MethodTrampoline( |
| 97 3, |
| 98 (Parser target, arg0, arg1, arg2) => |
| 99 target._computeStringValue(arg0, arg1, arg2)), |
100 'convertToFunctionDeclaration_1': new MethodTrampoline( | 100 'convertToFunctionDeclaration_1': new MethodTrampoline( |
101 1, (Parser target, arg0) => target._convertToFunctionDeclaration(arg0)), | 101 1, (Parser target, arg0) => target._convertToFunctionDeclaration(arg0)), |
102 'couldBeStartOfCompilationUnitMember_0': new MethodTrampoline( | 102 'couldBeStartOfCompilationUnitMember_0': new MethodTrampoline( |
103 0, (Parser target) => target._couldBeStartOfCompilationUnitMember()), | 103 0, (Parser target) => target._couldBeStartOfCompilationUnitMember()), |
104 'createSyntheticIdentifier_0': new MethodTrampoline( | 104 'createSyntheticIdentifier_0': new MethodTrampoline( |
105 0, (Parser target) => target._createSyntheticIdentifier()), | 105 0, (Parser target) => target._createSyntheticIdentifier()), |
106 'createSyntheticKeyword_1': new MethodTrampoline( | 106 'createSyntheticKeyword_1': new MethodTrampoline( |
107 1, (Parser target, arg0) => target._createSyntheticKeyword(arg0)), | 107 1, (Parser target, arg0) => target._createSyntheticKeyword(arg0)), |
108 'createSyntheticStringLiteral_0': new MethodTrampoline( | 108 'createSyntheticStringLiteral_0': new MethodTrampoline( |
109 0, (Parser target) => target._createSyntheticStringLiteral()), | 109 0, (Parser target) => target._createSyntheticStringLiteral()), |
(...skipping 45 matching lines...) Loading... |
155 'matchesString_1': new MethodTrampoline( | 155 'matchesString_1': new MethodTrampoline( |
156 1, (Parser target, arg0) => target._matchesString(arg0)), | 156 1, (Parser target, arg0) => target._matchesString(arg0)), |
157 'optional_1': | 157 'optional_1': |
158 new MethodTrampoline(1, (Parser target, arg0) => target._optional(arg0)), | 158 new MethodTrampoline(1, (Parser target, arg0) => target._optional(arg0)), |
159 'parseAdditiveExpression_0': new MethodTrampoline( | 159 'parseAdditiveExpression_0': new MethodTrampoline( |
160 0, (Parser target) => target._parseAdditiveExpression()), | 160 0, (Parser target) => target._parseAdditiveExpression()), |
161 'parseAssertStatement_0': new MethodTrampoline( | 161 'parseAssertStatement_0': new MethodTrampoline( |
162 0, (Parser target) => target._parseAssertStatement()), | 162 0, (Parser target) => target._parseAssertStatement()), |
163 'parseAssignableExpression_1': new MethodTrampoline( | 163 'parseAssignableExpression_1': new MethodTrampoline( |
164 1, (Parser target, arg0) => target._parseAssignableExpression(arg0)), | 164 1, (Parser target, arg0) => target._parseAssignableExpression(arg0)), |
165 'parseAssignableSelector_2': new MethodTrampoline(2, (Parser target, arg0, | 165 'parseAssignableSelector_2': new MethodTrampoline( |
166 arg1) => target._parseAssignableSelector(arg0, arg1)), | 166 2, |
| 167 (Parser target, arg0, arg1) => |
| 168 target._parseAssignableSelector(arg0, arg1)), |
167 'parseAwaitExpression_0': new MethodTrampoline( | 169 'parseAwaitExpression_0': new MethodTrampoline( |
168 0, (Parser target) => target._parseAwaitExpression()), | 170 0, (Parser target) => target._parseAwaitExpression()), |
169 'parseBitwiseAndExpression_0': new MethodTrampoline( | 171 'parseBitwiseAndExpression_0': new MethodTrampoline( |
170 0, (Parser target) => target._parseBitwiseAndExpression()), | 172 0, (Parser target) => target._parseBitwiseAndExpression()), |
171 'parseBitwiseXorExpression_0': new MethodTrampoline( | 173 'parseBitwiseXorExpression_0': new MethodTrampoline( |
172 0, (Parser target) => target._parseBitwiseXorExpression()), | 174 0, (Parser target) => target._parseBitwiseXorExpression()), |
173 'parseBreakStatement_0': | 175 'parseBreakStatement_0': |
174 new MethodTrampoline(0, (Parser target) => target._parseBreakStatement()), | 176 new MethodTrampoline(0, (Parser target) => target._parseBreakStatement()), |
175 'parseCascadeSection_0': | 177 'parseCascadeSection_0': |
176 new MethodTrampoline(0, (Parser target) => target._parseCascadeSection()), | 178 new MethodTrampoline(0, (Parser target) => target._parseCascadeSection()), |
177 'parseClassDeclaration_2': new MethodTrampoline(2, | 179 'parseClassDeclaration_2': new MethodTrampoline(2, |
178 (Parser target, arg0, arg1) => target._parseClassDeclaration(arg0, arg1)), | 180 (Parser target, arg0, arg1) => target._parseClassDeclaration(arg0, arg1)), |
179 'parseClassMembers_2': new MethodTrampoline( | 181 'parseClassMembers_2': new MethodTrampoline( |
180 2, (Parser target, arg0, arg1) => target._parseClassMembers(arg0, arg1)), | 182 2, (Parser target, arg0, arg1) => target._parseClassMembers(arg0, arg1)), |
181 'parseClassTypeAlias_3': new MethodTrampoline(3, (Parser target, arg0, arg1, | 183 'parseClassTypeAlias_3': new MethodTrampoline( |
182 arg2) => target._parseClassTypeAlias(arg0, arg1, arg2)), | 184 3, |
| 185 (Parser target, arg0, arg1, arg2) => |
| 186 target._parseClassTypeAlias(arg0, arg1, arg2)), |
183 'parseCombinator_0': | 187 'parseCombinator_0': |
184 new MethodTrampoline(0, (Parser target) => target.parseCombinator()), | 188 new MethodTrampoline(0, (Parser target) => target.parseCombinator()), |
185 'parseCombinators_0': | 189 'parseCombinators_0': |
186 new MethodTrampoline(0, (Parser target) => target._parseCombinators()), | 190 new MethodTrampoline(0, (Parser target) => target._parseCombinators()), |
187 'parseCommentAndMetadata_0': new MethodTrampoline( | 191 'parseCommentAndMetadata_0': new MethodTrampoline( |
188 0, (Parser target) => target._parseCommentAndMetadata()), | 192 0, (Parser target) => target._parseCommentAndMetadata()), |
189 'parseCommentReference_2': new MethodTrampoline(2, | 193 'parseCommentReference_2': new MethodTrampoline(2, |
190 (Parser target, arg0, arg1) => target._parseCommentReference(arg0, arg1)), | 194 (Parser target, arg0, arg1) => target._parseCommentReference(arg0, arg1)), |
191 'parseCommentReferences_1': new MethodTrampoline( | 195 'parseCommentReferences_1': new MethodTrampoline( |
192 1, (Parser target, arg0) => target._parseCommentReferences(arg0)), | 196 1, (Parser target, arg0) => target._parseCommentReferences(arg0)), |
193 'parseCompilationUnitMember_1': new MethodTrampoline( | 197 'parseCompilationUnitMember_1': new MethodTrampoline( |
194 1, (Parser target, arg0) => target._parseCompilationUnitMember(arg0)), | 198 1, (Parser target, arg0) => target._parseCompilationUnitMember(arg0)), |
195 'parseConstExpression_0': new MethodTrampoline( | 199 'parseConstExpression_0': new MethodTrampoline( |
196 0, (Parser target) => target._parseConstExpression()), | 200 0, (Parser target) => target._parseConstExpression()), |
197 'parseConstructor_8': new MethodTrampoline(8, (Parser target, arg0, arg1, | 201 'parseConstructor_8': new MethodTrampoline( |
198 arg2, arg3, arg4, arg5, arg6, arg7) => | 202 8, |
199 target._parseConstructor(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)), | 203 (Parser target, arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7) => target |
| 204 ._parseConstructor(arg0, arg1, arg2, arg3, arg4, arg5, arg6, arg7)), |
200 'parseConstructorFieldInitializer_0': new MethodTrampoline( | 205 'parseConstructorFieldInitializer_0': new MethodTrampoline( |
201 0, (Parser target) => target._parseConstructorFieldInitializer()), | 206 0, (Parser target) => target._parseConstructorFieldInitializer()), |
202 'parseContinueStatement_0': new MethodTrampoline( | 207 'parseContinueStatement_0': new MethodTrampoline( |
203 0, (Parser target) => target._parseContinueStatement()), | 208 0, (Parser target) => target._parseContinueStatement()), |
204 'parseDirective_1': new MethodTrampoline( | 209 'parseDirective_1': new MethodTrampoline( |
205 1, (Parser target, arg0) => target._parseDirective(arg0)), | 210 1, (Parser target, arg0) => target._parseDirective(arg0)), |
206 'parseDirectives_0': | 211 'parseDirectives_0': |
207 new MethodTrampoline(0, (Parser target) => target._parseDirectives()), | 212 new MethodTrampoline(0, (Parser target) => target._parseDirectives()), |
208 'parseDocumentationComment_0': new MethodTrampoline( | 213 'parseDocumentationComment_0': new MethodTrampoline( |
209 0, (Parser target) => target._parseDocumentationComment()), | 214 0, (Parser target) => target._parseDocumentationComment()), |
(...skipping 10 matching lines...) Loading... |
220 'parseExportDirective_1': new MethodTrampoline( | 225 'parseExportDirective_1': new MethodTrampoline( |
221 1, (Parser target, arg0) => target._parseExportDirective(arg0)), | 226 1, (Parser target, arg0) => target._parseExportDirective(arg0)), |
222 'parseExpressionList_0': | 227 'parseExpressionList_0': |
223 new MethodTrampoline(0, (Parser target) => target._parseExpressionList()), | 228 new MethodTrampoline(0, (Parser target) => target._parseExpressionList()), |
224 'parseFinalConstVarOrType_1': new MethodTrampoline( | 229 'parseFinalConstVarOrType_1': new MethodTrampoline( |
225 1, (Parser target, arg0) => target._parseFinalConstVarOrType(arg0)), | 230 1, (Parser target, arg0) => target._parseFinalConstVarOrType(arg0)), |
226 'parseFormalParameter_1': new MethodTrampoline( | 231 'parseFormalParameter_1': new MethodTrampoline( |
227 1, (Parser target, arg0) => target._parseFormalParameter(arg0)), | 232 1, (Parser target, arg0) => target._parseFormalParameter(arg0)), |
228 'parseForStatement_0': | 233 'parseForStatement_0': |
229 new MethodTrampoline(0, (Parser target) => target._parseForStatement()), | 234 new MethodTrampoline(0, (Parser target) => target._parseForStatement()), |
230 'parseFunctionBody_3': new MethodTrampoline(3, (Parser target, arg0, arg1, | 235 'parseFunctionBody_3': new MethodTrampoline( |
231 arg2) => target._parseFunctionBody(arg0, arg1, arg2)), | 236 3, |
232 'parseFunctionDeclaration_3': new MethodTrampoline(3, (Parser target, arg0, | 237 (Parser target, arg0, arg1, arg2) => |
233 arg1, arg2) => target._parseFunctionDeclaration(arg0, arg1, arg2)), | 238 target._parseFunctionBody(arg0, arg1, arg2)), |
| 239 'parseFunctionDeclaration_3': new MethodTrampoline( |
| 240 3, |
| 241 (Parser target, arg0, arg1, arg2) => |
| 242 target._parseFunctionDeclaration(arg0, arg1, arg2)), |
234 'parseFunctionDeclarationStatement_0': new MethodTrampoline( | 243 'parseFunctionDeclarationStatement_0': new MethodTrampoline( |
235 0, (Parser target) => target._parseFunctionDeclarationStatement()), | 244 0, (Parser target) => target._parseFunctionDeclarationStatement()), |
236 'parseFunctionDeclarationStatementAfterReturnType_2': new MethodTrampoline(2, | 245 'parseFunctionDeclarationStatementAfterReturnType_2': new MethodTrampoline( |
| 246 2, |
237 (Parser target, arg0, arg1) => | 247 (Parser target, arg0, arg1) => |
238 target._parseFunctionDeclarationStatementAfterReturnType(arg0, arg1)), | 248 target._parseFunctionDeclarationStatementAfterReturnType(arg0, arg1)), |
239 'parseFunctionTypeAlias_2': new MethodTrampoline(2, (Parser target, arg0, | 249 'parseFunctionTypeAlias_2': new MethodTrampoline( |
240 arg1) => target._parseFunctionTypeAlias(arg0, arg1)), | 250 2, |
241 'parseGetter_4': new MethodTrampoline(4, (Parser target, arg0, arg1, arg2, | 251 (Parser target, arg0, arg1) => |
242 arg3) => target._parseGetter(arg0, arg1, arg2, arg3)), | 252 target._parseFunctionTypeAlias(arg0, arg1)), |
| 253 'parseGetter_4': new MethodTrampoline( |
| 254 4, |
| 255 (Parser target, arg0, arg1, arg2, arg3) => |
| 256 target._parseGetter(arg0, arg1, arg2, arg3)), |
243 'parseIdentifierList_0': | 257 'parseIdentifierList_0': |
244 new MethodTrampoline(0, (Parser target) => target._parseIdentifierList()), | 258 new MethodTrampoline(0, (Parser target) => target._parseIdentifierList()), |
245 'parseIfStatement_0': | 259 'parseIfStatement_0': |
246 new MethodTrampoline(0, (Parser target) => target._parseIfStatement()), | 260 new MethodTrampoline(0, (Parser target) => target._parseIfStatement()), |
247 'parseImportDirective_1': new MethodTrampoline( | 261 'parseImportDirective_1': new MethodTrampoline( |
248 1, (Parser target, arg0) => target._parseImportDirective(arg0)), | 262 1, (Parser target, arg0) => target._parseImportDirective(arg0)), |
249 'parseInitializedIdentifierList_4': new MethodTrampoline(4, | 263 'parseInitializedIdentifierList_4': new MethodTrampoline( |
| 264 4, |
250 (Parser target, arg0, arg1, arg2, arg3) => | 265 (Parser target, arg0, arg1, arg2, arg3) => |
251 target._parseInitializedIdentifierList(arg0, arg1, arg2, arg3)), | 266 target._parseInitializedIdentifierList(arg0, arg1, arg2, arg3)), |
252 'parseInstanceCreationExpression_1': new MethodTrampoline(1, | 267 'parseInstanceCreationExpression_1': new MethodTrampoline(1, |
253 (Parser target, arg0) => target._parseInstanceCreationExpression(arg0)), | 268 (Parser target, arg0) => target._parseInstanceCreationExpression(arg0)), |
254 'parseLibraryDirective_1': new MethodTrampoline( | 269 'parseLibraryDirective_1': new MethodTrampoline( |
255 1, (Parser target, arg0) => target._parseLibraryDirective(arg0)), | 270 1, (Parser target, arg0) => target._parseLibraryDirective(arg0)), |
256 'parseLibraryName_2': new MethodTrampoline( | 271 'parseLibraryName_2': new MethodTrampoline( |
257 2, (Parser target, arg0, arg1) => target._parseLibraryName(arg0, arg1)), | 272 2, (Parser target, arg0, arg1) => target._parseLibraryName(arg0, arg1)), |
258 'parseListLiteral_2': new MethodTrampoline( | 273 'parseListLiteral_2': new MethodTrampoline( |
259 2, (Parser target, arg0, arg1) => target._parseListLiteral(arg0, arg1)), | 274 2, (Parser target, arg0, arg1) => target._parseListLiteral(arg0, arg1)), |
260 'parseListOrMapLiteral_1': new MethodTrampoline( | 275 'parseListOrMapLiteral_1': new MethodTrampoline( |
261 1, (Parser target, arg0) => target._parseListOrMapLiteral(arg0)), | 276 1, (Parser target, arg0) => target._parseListOrMapLiteral(arg0)), |
262 'parseLogicalAndExpression_0': new MethodTrampoline( | 277 'parseLogicalAndExpression_0': new MethodTrampoline( |
263 0, (Parser target) => target._parseLogicalAndExpression()), | 278 0, (Parser target) => target._parseLogicalAndExpression()), |
264 'parseMapLiteral_2': new MethodTrampoline( | 279 'parseMapLiteral_2': new MethodTrampoline( |
265 2, (Parser target, arg0, arg1) => target._parseMapLiteral(arg0, arg1)), | 280 2, (Parser target, arg0, arg1) => target._parseMapLiteral(arg0, arg1)), |
266 'parseMethodDeclarationAfterParameters_7': new MethodTrampoline(7, | 281 'parseMethodDeclarationAfterParameters_7': new MethodTrampoline( |
267 (Parser target, arg0, arg1, arg2, arg3, arg4, arg5, arg6) => target | 282 7, |
268 ._parseMethodDeclarationAfterParameters( | 283 (Parser target, arg0, arg1, arg2, arg3, arg4, arg5, arg6) => |
| 284 target._parseMethodDeclarationAfterParameters( |
269 arg0, arg1, arg2, arg3, arg4, arg5, arg6)), | 285 arg0, arg1, arg2, arg3, arg4, arg5, arg6)), |
270 'parseMethodDeclarationAfterReturnType_4': new MethodTrampoline(4, | 286 'parseMethodDeclarationAfterReturnType_4': new MethodTrampoline( |
| 287 4, |
271 (Parser target, arg0, arg1, arg2, arg3) => target | 288 (Parser target, arg0, arg1, arg2, arg3) => target |
272 ._parseMethodDeclarationAfterReturnType(arg0, arg1, arg2, arg3)), | 289 ._parseMethodDeclarationAfterReturnType(arg0, arg1, arg2, arg3)), |
273 'parseModifiers_0': | 290 'parseModifiers_0': |
274 new MethodTrampoline(0, (Parser target) => target._parseModifiers()), | 291 new MethodTrampoline(0, (Parser target) => target._parseModifiers()), |
275 'parseMultiplicativeExpression_0': new MethodTrampoline( | 292 'parseMultiplicativeExpression_0': new MethodTrampoline( |
276 0, (Parser target) => target._parseMultiplicativeExpression()), | 293 0, (Parser target) => target._parseMultiplicativeExpression()), |
277 'parseNativeClause_0': | 294 'parseNativeClause_0': |
278 new MethodTrampoline(0, (Parser target) => target._parseNativeClause()), | 295 new MethodTrampoline(0, (Parser target) => target._parseNativeClause()), |
279 'parseNewExpression_0': | 296 'parseNewExpression_0': |
280 new MethodTrampoline(0, (Parser target) => target._parseNewExpression()), | 297 new MethodTrampoline(0, (Parser target) => target._parseNewExpression()), |
281 'parseNonLabeledStatement_0': new MethodTrampoline( | 298 'parseNonLabeledStatement_0': new MethodTrampoline( |
282 0, (Parser target) => target._parseNonLabeledStatement()), | 299 0, (Parser target) => target._parseNonLabeledStatement()), |
283 'parseOperator_3': new MethodTrampoline(3, (Parser target, arg0, arg1, | 300 'parseOperator_3': new MethodTrampoline( |
284 arg2) => target._parseOperator(arg0, arg1, arg2)), | 301 3, |
| 302 (Parser target, arg0, arg1, arg2) => |
| 303 target._parseOperator(arg0, arg1, arg2)), |
285 'parseOptionalReturnType_0': new MethodTrampoline( | 304 'parseOptionalReturnType_0': new MethodTrampoline( |
286 0, (Parser target) => target._parseOptionalReturnType()), | 305 0, (Parser target) => target._parseOptionalReturnType()), |
287 'parsePartDirective_1': new MethodTrampoline( | 306 'parsePartDirective_1': new MethodTrampoline( |
288 1, (Parser target, arg0) => target._parsePartDirective(arg0)), | 307 1, (Parser target, arg0) => target._parsePartDirective(arg0)), |
289 'parsePostfixExpression_0': new MethodTrampoline( | 308 'parsePostfixExpression_0': new MethodTrampoline( |
290 0, (Parser target) => target._parsePostfixExpression()), | 309 0, (Parser target) => target._parsePostfixExpression()), |
291 'parsePrimaryExpression_0': new MethodTrampoline( | 310 'parsePrimaryExpression_0': new MethodTrampoline( |
292 0, (Parser target) => target._parsePrimaryExpression()), | 311 0, (Parser target) => target._parsePrimaryExpression()), |
293 'parseRedirectingConstructorInvocation_0': new MethodTrampoline( | 312 'parseRedirectingConstructorInvocation_0': new MethodTrampoline( |
294 0, (Parser target) => target._parseRedirectingConstructorInvocation()), | 313 0, (Parser target) => target._parseRedirectingConstructorInvocation()), |
295 'parseRelationalExpression_0': new MethodTrampoline( | 314 'parseRelationalExpression_0': new MethodTrampoline( |
296 0, (Parser target) => target._parseRelationalExpression()), | 315 0, (Parser target) => target._parseRelationalExpression()), |
297 'parseRethrowExpression_0': new MethodTrampoline( | 316 'parseRethrowExpression_0': new MethodTrampoline( |
298 0, (Parser target) => target._parseRethrowExpression()), | 317 0, (Parser target) => target._parseRethrowExpression()), |
299 'parseReturnStatement_0': new MethodTrampoline( | 318 'parseReturnStatement_0': new MethodTrampoline( |
300 0, (Parser target) => target._parseReturnStatement()), | 319 0, (Parser target) => target._parseReturnStatement()), |
301 'parseSetter_4': new MethodTrampoline(4, (Parser target, arg0, arg1, arg2, | 320 'parseSetter_4': new MethodTrampoline( |
302 arg3) => target._parseSetter(arg0, arg1, arg2, arg3)), | 321 4, |
| 322 (Parser target, arg0, arg1, arg2, arg3) => |
| 323 target._parseSetter(arg0, arg1, arg2, arg3)), |
303 'parseShiftExpression_0': new MethodTrampoline( | 324 'parseShiftExpression_0': new MethodTrampoline( |
304 0, (Parser target) => target._parseShiftExpression()), | 325 0, (Parser target) => target._parseShiftExpression()), |
305 'parseStatementList_0': | 326 'parseStatementList_0': |
306 new MethodTrampoline(0, (Parser target) => target._parseStatementList()), | 327 new MethodTrampoline(0, (Parser target) => target._parseStatementList()), |
307 'parseStringInterpolation_1': new MethodTrampoline( | 328 'parseStringInterpolation_1': new MethodTrampoline( |
308 1, (Parser target, arg0) => target._parseStringInterpolation(arg0)), | 329 1, (Parser target, arg0) => target._parseStringInterpolation(arg0)), |
309 'parseSuperConstructorInvocation_0': new MethodTrampoline( | 330 'parseSuperConstructorInvocation_0': new MethodTrampoline( |
310 0, (Parser target) => target._parseSuperConstructorInvocation()), | 331 0, (Parser target) => target._parseSuperConstructorInvocation()), |
311 'parseSwitchStatement_0': new MethodTrampoline( | 332 'parseSwitchStatement_0': new MethodTrampoline( |
312 0, (Parser target) => target._parseSwitchStatement()), | 333 0, (Parser target) => target._parseSwitchStatement()), |
313 'parseSymbolLiteral_0': | 334 'parseSymbolLiteral_0': |
314 new MethodTrampoline(0, (Parser target) => target._parseSymbolLiteral()), | 335 new MethodTrampoline(0, (Parser target) => target._parseSymbolLiteral()), |
315 'parseThrowExpression_0': new MethodTrampoline( | 336 'parseThrowExpression_0': new MethodTrampoline( |
316 0, (Parser target) => target._parseThrowExpression()), | 337 0, (Parser target) => target._parseThrowExpression()), |
317 'parseThrowExpressionWithoutCascade_0': new MethodTrampoline( | 338 'parseThrowExpressionWithoutCascade_0': new MethodTrampoline( |
318 0, (Parser target) => target._parseThrowExpressionWithoutCascade()), | 339 0, (Parser target) => target._parseThrowExpressionWithoutCascade()), |
319 'parseTryStatement_0': | 340 'parseTryStatement_0': |
320 new MethodTrampoline(0, (Parser target) => target._parseTryStatement()), | 341 new MethodTrampoline(0, (Parser target) => target._parseTryStatement()), |
321 'parseTypeAlias_1': new MethodTrampoline( | 342 'parseTypeAlias_1': new MethodTrampoline( |
322 1, (Parser target, arg0) => target._parseTypeAlias(arg0)), | 343 1, (Parser target, arg0) => target._parseTypeAlias(arg0)), |
323 'parseUnaryExpression_0': new MethodTrampoline( | 344 'parseUnaryExpression_0': new MethodTrampoline( |
324 0, (Parser target) => target._parseUnaryExpression()), | 345 0, (Parser target) => target._parseUnaryExpression()), |
325 'parseVariableDeclaration_0': new MethodTrampoline( | 346 'parseVariableDeclaration_0': new MethodTrampoline( |
326 0, (Parser target) => target._parseVariableDeclaration()), | 347 0, (Parser target) => target._parseVariableDeclaration()), |
327 'parseVariableDeclarationListAfterMetadata_1': new MethodTrampoline(1, | 348 'parseVariableDeclarationListAfterMetadata_1': new MethodTrampoline( |
| 349 1, |
328 (Parser target, arg0) => | 350 (Parser target, arg0) => |
329 target._parseVariableDeclarationListAfterMetadata(arg0)), | 351 target._parseVariableDeclarationListAfterMetadata(arg0)), |
330 'parseVariableDeclarationListAfterType_3': new MethodTrampoline(3, | 352 'parseVariableDeclarationListAfterType_3': new MethodTrampoline( |
| 353 3, |
331 (Parser target, arg0, arg1, arg2) => | 354 (Parser target, arg0, arg1, arg2) => |
332 target._parseVariableDeclarationListAfterType(arg0, arg1, arg2)), | 355 target._parseVariableDeclarationListAfterType(arg0, arg1, arg2)), |
333 'parseVariableDeclarationStatementAfterMetadata_1': new MethodTrampoline(1, | 356 'parseVariableDeclarationStatementAfterMetadata_1': new MethodTrampoline( |
| 357 1, |
334 (Parser target, arg0) => | 358 (Parser target, arg0) => |
335 target._parseVariableDeclarationStatementAfterMetadata(arg0)), | 359 target._parseVariableDeclarationStatementAfterMetadata(arg0)), |
336 'parseVariableDeclarationStatementAfterType_3': new MethodTrampoline(3, | 360 'parseVariableDeclarationStatementAfterType_3': new MethodTrampoline( |
| 361 3, |
337 (Parser target, arg0, arg1, arg2) => | 362 (Parser target, arg0, arg1, arg2) => |
338 target._parseVariableDeclarationStatementAfterType(arg0, arg1, arg2)), | 363 target._parseVariableDeclarationStatementAfterType(arg0, arg1, arg2)), |
339 'parseWhileStatement_0': | 364 'parseWhileStatement_0': |
340 new MethodTrampoline(0, (Parser target) => target._parseWhileStatement()), | 365 new MethodTrampoline(0, (Parser target) => target._parseWhileStatement()), |
341 'parseYieldStatement_0': | 366 'parseYieldStatement_0': |
342 new MethodTrampoline(0, (Parser target) => target._parseYieldStatement()), | 367 new MethodTrampoline(0, (Parser target) => target._parseYieldStatement()), |
343 'peek_0': new MethodTrampoline(0, (Parser target) => target._peek()), | 368 'peek_0': new MethodTrampoline(0, (Parser target) => target._peek()), |
344 'peekAt_1': | 369 'peekAt_1': |
345 new MethodTrampoline(1, (Parser target, arg0) => target._peekAt(arg0)), | 370 new MethodTrampoline(1, (Parser target, arg0) => target._peekAt(arg0)), |
346 'reportError_1': new MethodTrampoline( | 371 'reportError_1': new MethodTrampoline( |
347 1, (Parser target, arg0) => target._reportError(arg0)), | 372 1, (Parser target, arg0) => target._reportError(arg0)), |
348 'reportErrorForCurrentToken_2': new MethodTrampoline(2, (Parser target, arg0, | 373 'reportErrorForCurrentToken_2': new MethodTrampoline( |
349 arg1) => target._reportErrorForCurrentToken(arg0, arg1)), | 374 2, |
350 'reportErrorForNode_3': new MethodTrampoline(3, (Parser target, arg0, arg1, | 375 (Parser target, arg0, arg1) => |
351 arg2) => target._reportErrorForNode(arg0, arg1, arg2)), | 376 target._reportErrorForCurrentToken(arg0, arg1)), |
352 'reportErrorForToken_3': new MethodTrampoline(3, (Parser target, arg0, arg1, | 377 'reportErrorForNode_3': new MethodTrampoline( |
353 arg2) => target._reportErrorForToken(arg0, arg1, arg2)), | 378 3, |
| 379 (Parser target, arg0, arg1, arg2) => |
| 380 target._reportErrorForNode(arg0, arg1, arg2)), |
| 381 'reportErrorForToken_3': new MethodTrampoline( |
| 382 3, |
| 383 (Parser target, arg0, arg1, arg2) => |
| 384 target._reportErrorForToken(arg0, arg1, arg2)), |
354 'skipBlock_0': | 385 'skipBlock_0': |
355 new MethodTrampoline(0, (Parser target) => target._skipBlock()), | 386 new MethodTrampoline(0, (Parser target) => target._skipBlock()), |
356 'skipFinalConstVarOrType_1': new MethodTrampoline( | 387 'skipFinalConstVarOrType_1': new MethodTrampoline( |
357 1, (Parser target, arg0) => target._skipFinalConstVarOrType(arg0)), | 388 1, (Parser target, arg0) => target._skipFinalConstVarOrType(arg0)), |
358 'skipFormalParameterList_1': new MethodTrampoline( | 389 'skipFormalParameterList_1': new MethodTrampoline( |
359 1, (Parser target, arg0) => target._skipFormalParameterList(arg0)), | 390 1, (Parser target, arg0) => target._skipFormalParameterList(arg0)), |
360 'skipPastMatchingToken_1': new MethodTrampoline( | 391 'skipPastMatchingToken_1': new MethodTrampoline( |
361 1, (Parser target, arg0) => target._skipPastMatchingToken(arg0)), | 392 1, (Parser target, arg0) => target._skipPastMatchingToken(arg0)), |
362 'skipPrefixedIdentifier_1': new MethodTrampoline( | 393 'skipPrefixedIdentifier_1': new MethodTrampoline( |
363 1, (Parser target, arg0) => target._skipPrefixedIdentifier(arg0)), | 394 1, (Parser target, arg0) => target._skipPrefixedIdentifier(arg0)), |
(...skipping 12 matching lines...) Loading... |
376 'skipTypeParameterList_1': new MethodTrampoline( | 407 'skipTypeParameterList_1': new MethodTrampoline( |
377 1, (Parser target, arg0) => target._skipTypeParameterList(arg0)), | 408 1, (Parser target, arg0) => target._skipTypeParameterList(arg0)), |
378 'tokenMatches_2': new MethodTrampoline( | 409 'tokenMatches_2': new MethodTrampoline( |
379 2, (Parser target, arg0, arg1) => target._tokenMatches(arg0, arg1)), | 410 2, (Parser target, arg0, arg1) => target._tokenMatches(arg0, arg1)), |
380 'tokenMatchesIdentifier_1': new MethodTrampoline( | 411 'tokenMatchesIdentifier_1': new MethodTrampoline( |
381 1, (Parser target, arg0) => target._tokenMatchesIdentifier(arg0)), | 412 1, (Parser target, arg0) => target._tokenMatchesIdentifier(arg0)), |
382 'tokenMatchesKeyword_2': new MethodTrampoline(2, | 413 'tokenMatchesKeyword_2': new MethodTrampoline(2, |
383 (Parser target, arg0, arg1) => target._tokenMatchesKeyword(arg0, arg1)), | 414 (Parser target, arg0, arg1) => target._tokenMatchesKeyword(arg0, arg1)), |
384 'tokenMatchesString_2': new MethodTrampoline( | 415 'tokenMatchesString_2': new MethodTrampoline( |
385 2, (Parser target, arg0, arg1) => target._tokenMatchesString(arg0, arg1)), | 416 2, (Parser target, arg0, arg1) => target._tokenMatchesString(arg0, arg1)), |
386 'translateCharacter_3': new MethodTrampoline(3, (Parser target, arg0, arg1, | 417 'translateCharacter_3': new MethodTrampoline( |
387 arg2) => target._translateCharacter(arg0, arg1, arg2)), | 418 3, |
| 419 (Parser target, arg0, arg1, arg2) => |
| 420 target._translateCharacter(arg0, arg1, arg2)), |
388 'unlockErrorListener_0': | 421 'unlockErrorListener_0': |
389 new MethodTrampoline(0, (Parser target) => target._unlockErrorListener()), | 422 new MethodTrampoline(0, (Parser target) => target._unlockErrorListener()), |
390 'validateFormalParameterList_1': new MethodTrampoline( | 423 'validateFormalParameterList_1': new MethodTrampoline( |
391 1, (Parser target, arg0) => target._validateFormalParameterList(arg0)), | 424 1, (Parser target, arg0) => target._validateFormalParameterList(arg0)), |
392 'validateModifiersForClass_1': new MethodTrampoline( | 425 'validateModifiersForClass_1': new MethodTrampoline( |
393 1, (Parser target, arg0) => target._validateModifiersForClass(arg0)), | 426 1, (Parser target, arg0) => target._validateModifiersForClass(arg0)), |
394 'validateModifiersForConstructor_1': new MethodTrampoline(1, | 427 'validateModifiersForConstructor_1': new MethodTrampoline(1, |
395 (Parser target, arg0) => target._validateModifiersForConstructor(arg0)), | 428 (Parser target, arg0) => target._validateModifiersForConstructor(arg0)), |
396 'validateModifiersForEnum_1': new MethodTrampoline( | 429 'validateModifiersForEnum_1': new MethodTrampoline( |
397 1, (Parser target, arg0) => target._validateModifiersForEnum(arg0)), | 430 1, (Parser target, arg0) => target._validateModifiersForEnum(arg0)), |
398 'validateModifiersForField_1': new MethodTrampoline( | 431 'validateModifiersForField_1': new MethodTrampoline( |
399 1, (Parser target, arg0) => target._validateModifiersForField(arg0)), | 432 1, (Parser target, arg0) => target._validateModifiersForField(arg0)), |
400 'validateModifiersForFunctionDeclarationStatement_1': new MethodTrampoline(1, | 433 'validateModifiersForFunctionDeclarationStatement_1': new MethodTrampoline( |
| 434 1, |
401 (Parser target, arg0) => | 435 (Parser target, arg0) => |
402 target._validateModifiersForFunctionDeclarationStatement(arg0)), | 436 target._validateModifiersForFunctionDeclarationStatement(arg0)), |
403 'validateModifiersForGetterOrSetterOrMethod_1': new MethodTrampoline(1, | 437 'validateModifiersForGetterOrSetterOrMethod_1': new MethodTrampoline( |
| 438 1, |
404 (Parser target, arg0) => | 439 (Parser target, arg0) => |
405 target._validateModifiersForGetterOrSetterOrMethod(arg0)), | 440 target._validateModifiersForGetterOrSetterOrMethod(arg0)), |
406 'validateModifiersForOperator_1': new MethodTrampoline( | 441 'validateModifiersForOperator_1': new MethodTrampoline( |
407 1, (Parser target, arg0) => target._validateModifiersForOperator(arg0)), | 442 1, (Parser target, arg0) => target._validateModifiersForOperator(arg0)), |
408 'validateModifiersForTopLevelDeclaration_1': new MethodTrampoline(1, | 443 'validateModifiersForTopLevelDeclaration_1': new MethodTrampoline( |
| 444 1, |
409 (Parser target, arg0) => | 445 (Parser target, arg0) => |
410 target._validateModifiersForTopLevelDeclaration(arg0)), | 446 target._validateModifiersForTopLevelDeclaration(arg0)), |
411 'validateModifiersForTopLevelFunction_1': new MethodTrampoline(1, | 447 'validateModifiersForTopLevelFunction_1': new MethodTrampoline( |
| 448 1, |
412 (Parser target, arg0) => | 449 (Parser target, arg0) => |
413 target._validateModifiersForTopLevelFunction(arg0)), | 450 target._validateModifiersForTopLevelFunction(arg0)), |
414 'validateModifiersForTopLevelVariable_1': new MethodTrampoline(1, | 451 'validateModifiersForTopLevelVariable_1': new MethodTrampoline( |
| 452 1, |
415 (Parser target, arg0) => | 453 (Parser target, arg0) => |
416 target._validateModifiersForTopLevelVariable(arg0)), | 454 target._validateModifiersForTopLevelVariable(arg0)), |
417 'validateModifiersForTypedef_1': new MethodTrampoline( | 455 'validateModifiersForTypedef_1': new MethodTrampoline( |
418 1, (Parser target, arg0) => target._validateModifiersForTypedef(arg0)), | 456 1, (Parser target, arg0) => target._validateModifiersForTypedef(arg0)), |
419 }; | 457 }; |
420 | 458 |
421 Object invokeParserMethodImpl( | 459 Object invokeParserMethodImpl( |
422 Parser parser, String methodName, List<Object> objects, Token tokenStream) { | 460 Parser parser, String methodName, List<Object> objects, Token tokenStream) { |
423 parser.currentToken = tokenStream; | 461 parser.currentToken = tokenStream; |
424 MethodTrampoline method = | 462 MethodTrampoline method = |
(...skipping 1899 matching lines...) Loading... |
2324 _tokenMatchesIdentifier(_peek())) { | 2362 _tokenMatchesIdentifier(_peek())) { |
2325 _validateModifiersForGetterOrSetterOrMethod(modifiers); | 2363 _validateModifiersForGetterOrSetterOrMethod(modifiers); |
2326 return _parseSetter(commentAndMetadata, modifiers.externalKeyword, | 2364 return _parseSetter(commentAndMetadata, modifiers.externalKeyword, |
2327 modifiers.staticKeyword, returnType); | 2365 modifiers.staticKeyword, returnType); |
2328 } else if (_matchesKeyword(Keyword.OPERATOR) && _isOperator(_peek())) { | 2366 } else if (_matchesKeyword(Keyword.OPERATOR) && _isOperator(_peek())) { |
2329 _validateModifiersForOperator(modifiers); | 2367 _validateModifiersForOperator(modifiers); |
2330 return _parseOperator( | 2368 return _parseOperator( |
2331 commentAndMetadata, modifiers.externalKeyword, returnType); | 2369 commentAndMetadata, modifiers.externalKeyword, returnType); |
2332 } else if (_matchesIdentifier() && | 2370 } else if (_matchesIdentifier() && |
2333 _peek().matchesAny([ | 2371 _peek().matchesAny([ |
2334 TokenType.OPEN_PAREN, | 2372 TokenType.OPEN_PAREN, |
2335 TokenType.OPEN_CURLY_BRACKET, | 2373 TokenType.OPEN_CURLY_BRACKET, |
2336 TokenType.FUNCTION, | 2374 TokenType.FUNCTION, |
2337 TokenType.LT | 2375 TokenType.LT |
2338 ])) { | 2376 ])) { |
2339 _validateModifiersForGetterOrSetterOrMethod(modifiers); | 2377 _validateModifiersForGetterOrSetterOrMethod(modifiers); |
2340 return _parseMethodDeclarationAfterReturnType(commentAndMetadata, | 2378 return _parseMethodDeclarationAfterReturnType(commentAndMetadata, |
2341 modifiers.externalKeyword, modifiers.staticKeyword, returnType); | 2379 modifiers.externalKeyword, modifiers.staticKeyword, returnType); |
2342 } else { | 2380 } else { |
2343 // | 2381 // |
2344 // We have found an error of some kind. Try to recover. | 2382 // We have found an error of some kind. Try to recover. |
2345 // | 2383 // |
2346 if (_matchesIdentifier()) { | 2384 if (_matchesIdentifier()) { |
2347 if (_peek().matchesAny( | 2385 if (_peek().matchesAny( |
2348 [TokenType.EQ, TokenType.COMMA, TokenType.SEMICOLON])) { | 2386 [TokenType.EQ, TokenType.COMMA, TokenType.SEMICOLON])) { |
2349 // | 2387 // |
2350 // We appear to have a variable declaration with a type of "void". | 2388 // We appear to have a variable declaration with a type of "void". |
2351 // | 2389 // |
2352 _reportErrorForNode(ParserErrorCode.VOID_VARIABLE, returnType); | 2390 _reportErrorForNode(ParserErrorCode.VOID_VARIABLE, returnType); |
2353 return _parseInitializedIdentifierList(commentAndMetadata, | 2391 return _parseInitializedIdentifierList( |
2354 modifiers.staticKeyword, _validateModifiersForField(modifiers), | 2392 commentAndMetadata, |
| 2393 modifiers.staticKeyword, |
| 2394 _validateModifiersForField(modifiers), |
2355 returnType); | 2395 returnType); |
2356 } | 2396 } |
2357 } | 2397 } |
2358 if (_isOperator(_currentToken)) { | 2398 if (_isOperator(_currentToken)) { |
2359 // | 2399 // |
2360 // We appear to have found an operator declaration without the | 2400 // We appear to have found an operator declaration without the |
2361 // 'operator' keyword. | 2401 // 'operator' keyword. |
2362 // | 2402 // |
2363 _validateModifiersForOperator(modifiers); | 2403 _validateModifiersForOperator(modifiers); |
2364 return _parseOperator( | 2404 return _parseOperator( |
(...skipping 57 matching lines...) Loading... |
2422 keyword = modifiers.constKeyword; | 2462 keyword = modifiers.constKeyword; |
2423 } | 2463 } |
2424 if (keyword != null) { | 2464 if (keyword != null) { |
2425 // | 2465 // |
2426 // We appear to have found an incomplete field declaration. | 2466 // We appear to have found an incomplete field declaration. |
2427 // | 2467 // |
2428 _reportErrorForCurrentToken(ParserErrorCode.MISSING_IDENTIFIER); | 2468 _reportErrorForCurrentToken(ParserErrorCode.MISSING_IDENTIFIER); |
2429 List<VariableDeclaration> variables = new List<VariableDeclaration>(); | 2469 List<VariableDeclaration> variables = new List<VariableDeclaration>(); |
2430 variables.add( | 2470 variables.add( |
2431 new VariableDeclaration(_createSyntheticIdentifier(), null, null)); | 2471 new VariableDeclaration(_createSyntheticIdentifier(), null, null)); |
2432 return new FieldDeclaration(commentAndMetadata.comment, | 2472 return new FieldDeclaration( |
2433 commentAndMetadata.metadata, null, | 2473 commentAndMetadata.comment, |
| 2474 commentAndMetadata.metadata, |
| 2475 null, |
2434 new VariableDeclarationList(null, null, keyword, null, variables), | 2476 new VariableDeclarationList(null, null, keyword, null, variables), |
2435 _expectSemicolon()); | 2477 _expectSemicolon()); |
2436 } | 2478 } |
2437 _reportErrorForToken( | 2479 _reportErrorForToken( |
2438 ParserErrorCode.EXPECTED_CLASS_MEMBER, _currentToken); | 2480 ParserErrorCode.EXPECTED_CLASS_MEMBER, _currentToken); |
2439 if (commentAndMetadata.comment != null || | 2481 if (commentAndMetadata.comment != null || |
2440 !commentAndMetadata.metadata.isEmpty) { | 2482 !commentAndMetadata.metadata.isEmpty) { |
2441 // | 2483 // |
2442 // We appear to have found an incomplete declaration at the end of the | 2484 // We appear to have found an incomplete declaration at the end of the |
2443 // class. At this point it consists of a metadata, which we don't want | 2485 // class. At this point it consists of a metadata, which we don't want |
2444 // to loose, so we'll treat it as a method declaration with a missing | 2486 // to loose, so we'll treat it as a method declaration with a missing |
2445 // name, parameters and empty body. | 2487 // name, parameters and empty body. |
2446 // | 2488 // |
2447 return new MethodDeclaration(commentAndMetadata.comment, | 2489 return new MethodDeclaration( |
2448 commentAndMetadata.metadata, null, null, null, null, null, | 2490 commentAndMetadata.comment, |
2449 _createSyntheticIdentifier(), null, new FormalParameterList( | 2491 commentAndMetadata.metadata, |
| 2492 null, |
| 2493 null, |
| 2494 null, |
| 2495 null, |
| 2496 null, |
| 2497 _createSyntheticIdentifier(), |
| 2498 null, |
| 2499 new FormalParameterList( |
2450 null, new List<FormalParameter>(), null, null, null), | 2500 null, new List<FormalParameter>(), null, null, null), |
2451 new EmptyFunctionBody(_createSyntheticToken(TokenType.SEMICOLON))); | 2501 new EmptyFunctionBody(_createSyntheticToken(TokenType.SEMICOLON))); |
2452 } | 2502 } |
2453 return null; | 2503 return null; |
2454 } else if (_tokenMatches(_peek(), TokenType.PERIOD) && | 2504 } else if (_tokenMatches(_peek(), TokenType.PERIOD) && |
2455 _tokenMatchesIdentifier(_peekAt(2)) && | 2505 _tokenMatchesIdentifier(_peekAt(2)) && |
2456 _tokenMatches(_peekAt(3), TokenType.OPEN_PAREN)) { | 2506 _tokenMatches(_peekAt(3), TokenType.OPEN_PAREN)) { |
2457 return _parseConstructor(commentAndMetadata, modifiers.externalKeyword, | 2507 return _parseConstructor( |
2458 _validateModifiersForConstructor(modifiers), modifiers.factoryKeyword, | 2508 commentAndMetadata, |
2459 parseSimpleIdentifier(), getAndAdvance(), parseSimpleIdentifier(), | 2509 modifiers.externalKeyword, |
| 2510 _validateModifiersForConstructor(modifiers), |
| 2511 modifiers.factoryKeyword, |
| 2512 parseSimpleIdentifier(), |
| 2513 getAndAdvance(), |
| 2514 parseSimpleIdentifier(), |
2460 parseFormalParameterList()); | 2515 parseFormalParameterList()); |
2461 } else if (_tokenMatches(_peek(), TokenType.OPEN_PAREN)) { | 2516 } else if (_tokenMatches(_peek(), TokenType.OPEN_PAREN)) { |
2462 SimpleIdentifier methodName = parseSimpleIdentifier(); | 2517 SimpleIdentifier methodName = parseSimpleIdentifier(); |
2463 FormalParameterList parameters = parseFormalParameterList(); | 2518 FormalParameterList parameters = parseFormalParameterList(); |
2464 if (_matches(TokenType.COLON) || | 2519 if (_matches(TokenType.COLON) || |
2465 modifiers.factoryKeyword != null || | 2520 modifiers.factoryKeyword != null || |
2466 methodName.name == className) { | 2521 methodName.name == className) { |
2467 return _parseConstructor(commentAndMetadata, modifiers.externalKeyword, | 2522 return _parseConstructor( |
| 2523 commentAndMetadata, |
| 2524 modifiers.externalKeyword, |
2468 _validateModifiersForConstructor(modifiers), | 2525 _validateModifiersForConstructor(modifiers), |
2469 modifiers.factoryKeyword, methodName, null, null, parameters); | 2526 modifiers.factoryKeyword, |
| 2527 methodName, |
| 2528 null, |
| 2529 null, |
| 2530 parameters); |
2470 } | 2531 } |
2471 _validateModifiersForGetterOrSetterOrMethod(modifiers); | 2532 _validateModifiersForGetterOrSetterOrMethod(modifiers); |
2472 _validateFormalParameterList(parameters); | 2533 _validateFormalParameterList(parameters); |
2473 return _parseMethodDeclarationAfterParameters(commentAndMetadata, | 2534 return _parseMethodDeclarationAfterParameters( |
2474 modifiers.externalKeyword, modifiers.staticKeyword, null, methodName, | 2535 commentAndMetadata, |
2475 null, parameters); | 2536 modifiers.externalKeyword, |
| 2537 modifiers.staticKeyword, |
| 2538 null, |
| 2539 methodName, |
| 2540 null, |
| 2541 parameters); |
2476 } else if (_peek() | 2542 } else if (_peek() |
2477 .matchesAny([TokenType.EQ, TokenType.COMMA, TokenType.SEMICOLON])) { | 2543 .matchesAny([TokenType.EQ, TokenType.COMMA, TokenType.SEMICOLON])) { |
2478 if (modifiers.constKeyword == null && | 2544 if (modifiers.constKeyword == null && |
2479 modifiers.finalKeyword == null && | 2545 modifiers.finalKeyword == null && |
2480 modifiers.varKeyword == null) { | 2546 modifiers.varKeyword == null) { |
2481 _reportErrorForCurrentToken( | 2547 _reportErrorForCurrentToken( |
2482 ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE); | 2548 ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE); |
2483 } | 2549 } |
2484 return _parseInitializedIdentifierList(commentAndMetadata, | 2550 return _parseInitializedIdentifierList(commentAndMetadata, |
2485 modifiers.staticKeyword, _validateModifiersForField(modifiers), null); | 2551 modifiers.staticKeyword, _validateModifiersForField(modifiers), null); |
(...skipping 24 matching lines...) Loading... |
2510 _validateModifiersForOperator(modifiers); | 2576 _validateModifiersForOperator(modifiers); |
2511 return _parseOperator( | 2577 return _parseOperator( |
2512 commentAndMetadata, modifiers.externalKeyword, type); | 2578 commentAndMetadata, modifiers.externalKeyword, type); |
2513 } else if (!_matchesIdentifier()) { | 2579 } else if (!_matchesIdentifier()) { |
2514 if (_matches(TokenType.CLOSE_CURLY_BRACKET)) { | 2580 if (_matches(TokenType.CLOSE_CURLY_BRACKET)) { |
2515 // | 2581 // |
2516 // We appear to have found an incomplete declaration at the end of the | 2582 // We appear to have found an incomplete declaration at the end of the |
2517 // class. At this point it consists of a type name, so we'll treat it as | 2583 // class. At this point it consists of a type name, so we'll treat it as |
2518 // a field declaration with a missing field name and semicolon. | 2584 // a field declaration with a missing field name and semicolon. |
2519 // | 2585 // |
2520 return _parseInitializedIdentifierList(commentAndMetadata, | 2586 return _parseInitializedIdentifierList( |
2521 modifiers.staticKeyword, _validateModifiersForField(modifiers), | 2587 commentAndMetadata, |
| 2588 modifiers.staticKeyword, |
| 2589 _validateModifiersForField(modifiers), |
2522 type); | 2590 type); |
2523 } | 2591 } |
2524 if (_isOperator(_currentToken)) { | 2592 if (_isOperator(_currentToken)) { |
2525 // | 2593 // |
2526 // We appear to have found an operator declaration without the | 2594 // We appear to have found an operator declaration without the |
2527 // 'operator' keyword. | 2595 // 'operator' keyword. |
2528 // | 2596 // |
2529 _validateModifiersForOperator(modifiers); | 2597 _validateModifiersForOperator(modifiers); |
2530 return _parseOperator( | 2598 return _parseOperator( |
2531 commentAndMetadata, modifiers.externalKeyword, type); | 2599 commentAndMetadata, modifiers.externalKeyword, type); |
2532 } | 2600 } |
2533 // | 2601 // |
2534 // We appear to have found an incomplete declaration before another | 2602 // We appear to have found an incomplete declaration before another |
2535 // declaration. At this point it consists of a type name, so we'll treat | 2603 // declaration. At this point it consists of a type name, so we'll treat |
2536 // it as a field declaration with a missing field name and semicolon. | 2604 // it as a field declaration with a missing field name and semicolon. |
2537 // | 2605 // |
2538 _reportErrorForToken( | 2606 _reportErrorForToken( |
2539 ParserErrorCode.EXPECTED_CLASS_MEMBER, _currentToken); | 2607 ParserErrorCode.EXPECTED_CLASS_MEMBER, _currentToken); |
2540 try { | 2608 try { |
2541 _lockErrorListener(); | 2609 _lockErrorListener(); |
2542 return _parseInitializedIdentifierList(commentAndMetadata, | 2610 return _parseInitializedIdentifierList( |
2543 modifiers.staticKeyword, _validateModifiersForField(modifiers), | 2611 commentAndMetadata, |
| 2612 modifiers.staticKeyword, |
| 2613 _validateModifiersForField(modifiers), |
2544 type); | 2614 type); |
2545 } finally { | 2615 } finally { |
2546 _unlockErrorListener(); | 2616 _unlockErrorListener(); |
2547 } | 2617 } |
2548 } else if (_tokenMatches(_peek(), TokenType.OPEN_PAREN)) { | 2618 } else if (_tokenMatches(_peek(), TokenType.OPEN_PAREN)) { |
2549 SimpleIdentifier methodName = parseSimpleIdentifier(); | 2619 SimpleIdentifier methodName = parseSimpleIdentifier(); |
2550 FormalParameterList parameters = parseFormalParameterList(); | 2620 FormalParameterList parameters = parseFormalParameterList(); |
2551 if (methodName.name == className) { | 2621 if (methodName.name == className) { |
2552 _reportErrorForNode(ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE, type); | 2622 _reportErrorForNode(ParserErrorCode.CONSTRUCTOR_WITH_RETURN_TYPE, type); |
2553 return _parseConstructor(commentAndMetadata, modifiers.externalKeyword, | 2623 return _parseConstructor( |
| 2624 commentAndMetadata, |
| 2625 modifiers.externalKeyword, |
2554 _validateModifiersForConstructor(modifiers), | 2626 _validateModifiersForConstructor(modifiers), |
2555 modifiers.factoryKeyword, methodName, null, null, parameters); | 2627 modifiers.factoryKeyword, |
| 2628 methodName, |
| 2629 null, |
| 2630 null, |
| 2631 parameters); |
2556 } | 2632 } |
2557 _validateModifiersForGetterOrSetterOrMethod(modifiers); | 2633 _validateModifiersForGetterOrSetterOrMethod(modifiers); |
2558 _validateFormalParameterList(parameters); | 2634 _validateFormalParameterList(parameters); |
2559 return _parseMethodDeclarationAfterParameters(commentAndMetadata, | 2635 return _parseMethodDeclarationAfterParameters( |
2560 modifiers.externalKeyword, modifiers.staticKeyword, type, methodName, | 2636 commentAndMetadata, |
2561 null, parameters); | 2637 modifiers.externalKeyword, |
| 2638 modifiers.staticKeyword, |
| 2639 type, |
| 2640 methodName, |
| 2641 null, |
| 2642 parameters); |
2562 } else if (parseGenericMethods && _tokenMatches(_peek(), TokenType.LT)) { | 2643 } else if (parseGenericMethods && _tokenMatches(_peek(), TokenType.LT)) { |
2563 return _parseMethodDeclarationAfterReturnType(commentAndMetadata, | 2644 return _parseMethodDeclarationAfterReturnType(commentAndMetadata, |
2564 modifiers.externalKeyword, modifiers.staticKeyword, type); | 2645 modifiers.externalKeyword, modifiers.staticKeyword, type); |
2565 } else if (_tokenMatches(_peek(), TokenType.OPEN_CURLY_BRACKET)) { | 2646 } else if (_tokenMatches(_peek(), TokenType.OPEN_CURLY_BRACKET)) { |
2566 // We have found "TypeName identifier {", and are guessing that this is a | 2647 // We have found "TypeName identifier {", and are guessing that this is a |
2567 // getter without the keyword 'get'. | 2648 // getter without the keyword 'get'. |
2568 _validateModifiersForGetterOrSetterOrMethod(modifiers); | 2649 _validateModifiersForGetterOrSetterOrMethod(modifiers); |
2569 _reportErrorForCurrentToken(ParserErrorCode.MISSING_GET); | 2650 _reportErrorForCurrentToken(ParserErrorCode.MISSING_GET); |
2570 _currentToken = _injectToken( | 2651 _currentToken = _injectToken( |
2571 new Parser_SyntheticKeywordToken(Keyword.GET, _currentToken.offset)); | 2652 new Parser_SyntheticKeywordToken(Keyword.GET, _currentToken.offset)); |
(...skipping 616 matching lines...) Loading... |
3188 if (parseGenericMethods && _matches(TokenType.LT)) { | 3269 if (parseGenericMethods && _matches(TokenType.LT)) { |
3189 typeParameters = parseTypeParameterList(); | 3270 typeParameters = parseTypeParameterList(); |
3190 } | 3271 } |
3191 if (_matches(TokenType.OPEN_PAREN)) { | 3272 if (_matches(TokenType.OPEN_PAREN)) { |
3192 FormalParameterList parameters = parseFormalParameterList(); | 3273 FormalParameterList parameters = parseFormalParameterList(); |
3193 if (thisKeyword == null) { | 3274 if (thisKeyword == null) { |
3194 if (holder.keyword != null) { | 3275 if (holder.keyword != null) { |
3195 _reportErrorForToken( | 3276 _reportErrorForToken( |
3196 ParserErrorCode.FUNCTION_TYPED_PARAMETER_VAR, holder.keyword); | 3277 ParserErrorCode.FUNCTION_TYPED_PARAMETER_VAR, holder.keyword); |
3197 } | 3278 } |
3198 return new FunctionTypedFormalParameter(commentAndMetadata.comment, | 3279 return new FunctionTypedFormalParameter( |
3199 commentAndMetadata.metadata, holder.type, identifier, | 3280 commentAndMetadata.comment, |
3200 typeParameters, parameters); | 3281 commentAndMetadata.metadata, |
| 3282 holder.type, |
| 3283 identifier, |
| 3284 typeParameters, |
| 3285 parameters); |
3201 } else { | 3286 } else { |
3202 return new FieldFormalParameter(commentAndMetadata.comment, | 3287 return new FieldFormalParameter( |
3203 commentAndMetadata.metadata, holder.keyword, holder.type, | 3288 commentAndMetadata.comment, |
3204 thisKeyword, period, identifier, typeParameters, parameters); | 3289 commentAndMetadata.metadata, |
| 3290 holder.keyword, |
| 3291 holder.type, |
| 3292 thisKeyword, |
| 3293 period, |
| 3294 identifier, |
| 3295 typeParameters, |
| 3296 parameters); |
3205 } | 3297 } |
3206 } else if (typeParameters != null) { | 3298 } else if (typeParameters != null) { |
3207 // TODO(brianwilkerson) Report an error. It looks like a function-typed | 3299 // TODO(brianwilkerson) Report an error. It looks like a function-typed |
3208 // parameter with no parameter list. | 3300 // parameter with no parameter list. |
3209 //_reportErrorForToken(ParserErrorCode.MISSING_PARAMETERS, typeParameters.
endToken); | 3301 //_reportErrorForToken(ParserErrorCode.MISSING_PARAMETERS, typeParameters.
endToken); |
3210 } | 3302 } |
3211 TypeName type = holder.type; | 3303 TypeName type = holder.type; |
3212 if (type != null) { | 3304 if (type != null) { |
3213 if (_tokenMatchesKeyword(type.name.beginToken, Keyword.VOID)) { | 3305 if (_tokenMatchesKeyword(type.name.beginToken, Keyword.VOID)) { |
3214 _reportErrorForToken( | 3306 _reportErrorForToken( |
3215 ParserErrorCode.VOID_PARAMETER, type.name.beginToken); | 3307 ParserErrorCode.VOID_PARAMETER, type.name.beginToken); |
3216 } else if (holder.keyword != null && | 3308 } else if (holder.keyword != null && |
3217 _tokenMatchesKeyword(holder.keyword, Keyword.VAR)) { | 3309 _tokenMatchesKeyword(holder.keyword, Keyword.VAR)) { |
3218 _reportErrorForToken(ParserErrorCode.VAR_AND_TYPE, holder.keyword); | 3310 _reportErrorForToken(ParserErrorCode.VAR_AND_TYPE, holder.keyword); |
3219 } | 3311 } |
3220 } | 3312 } |
3221 if (thisKeyword != null) { | 3313 if (thisKeyword != null) { |
3222 // TODO(brianwilkerson) If there are type parameters but no parameters, | 3314 // TODO(brianwilkerson) If there are type parameters but no parameters, |
3223 // should we create a synthetic empty parameter list here so we can | 3315 // should we create a synthetic empty parameter list here so we can |
3224 // capture the type parameters? | 3316 // capture the type parameters? |
3225 return new FieldFormalParameter(commentAndMetadata.comment, | 3317 return new FieldFormalParameter( |
3226 commentAndMetadata.metadata, holder.keyword, holder.type, thisKeyword, | 3318 commentAndMetadata.comment, |
3227 period, identifier, null, null); | 3319 commentAndMetadata.metadata, |
| 3320 holder.keyword, |
| 3321 holder.type, |
| 3322 thisKeyword, |
| 3323 period, |
| 3324 identifier, |
| 3325 null, |
| 3326 null); |
3228 } | 3327 } |
3229 return new SimpleFormalParameter(commentAndMetadata.comment, | 3328 return new SimpleFormalParameter(commentAndMetadata.comment, |
3230 commentAndMetadata.metadata, holder.keyword, holder.type, identifier); | 3329 commentAndMetadata.metadata, holder.keyword, holder.type, identifier); |
3231 } | 3330 } |
3232 | 3331 |
3233 /** | 3332 /** |
3234 * Parse a prefixed identifier. Return the prefixed identifier that was | 3333 * Parse a prefixed identifier. Return the prefixed identifier that was |
3235 * parsed. | 3334 * parsed. |
3236 * | 3335 * |
3237 * prefixedIdentifier ::= | 3336 * prefixedIdentifier ::= |
(...skipping 266 matching lines...) Loading... |
3504 } | 3603 } |
3505 return buffer.toString(); | 3604 return buffer.toString(); |
3506 } | 3605 } |
3507 | 3606 |
3508 /** | 3607 /** |
3509 * Convert the given [method] declaration into the nearest valid top-level | 3608 * Convert the given [method] declaration into the nearest valid top-level |
3510 * function declaration (that is, the function declaration that most closely | 3609 * function declaration (that is, the function declaration that most closely |
3511 * captures the components of the given method declaration). | 3610 * captures the components of the given method declaration). |
3512 */ | 3611 */ |
3513 FunctionDeclaration _convertToFunctionDeclaration(MethodDeclaration method) => | 3612 FunctionDeclaration _convertToFunctionDeclaration(MethodDeclaration method) => |
3514 new FunctionDeclaration(method.documentationComment, method.metadata, | 3613 new FunctionDeclaration( |
3515 method.externalKeyword, method.returnType, method.propertyKeyword, | 3614 method.documentationComment, |
3516 method.name, new FunctionExpression( | 3615 method.metadata, |
| 3616 method.externalKeyword, |
| 3617 method.returnType, |
| 3618 method.propertyKeyword, |
| 3619 method.name, |
| 3620 new FunctionExpression( |
3517 method.typeParameters, method.parameters, method.body)); | 3621 method.typeParameters, method.parameters, method.body)); |
3518 | 3622 |
3519 /** | 3623 /** |
3520 * Return `true` if the current token could be the start of a compilation unit | 3624 * Return `true` if the current token could be the start of a compilation unit |
3521 * member. This method is used for recovery purposes to decide when to stop | 3625 * member. This method is used for recovery purposes to decide when to stop |
3522 * skipping tokens after finding an error while parsing a compilation unit | 3626 * skipping tokens after finding an error while parsing a compilation unit |
3523 * member. | 3627 * member. |
3524 */ | 3628 */ |
3525 bool _couldBeStartOfCompilationUnitMember() { | 3629 bool _couldBeStartOfCompilationUnitMember() { |
3526 if ((_matchesKeyword(Keyword.IMPORT) || | 3630 if ((_matchesKeyword(Keyword.IMPORT) || |
(...skipping 681 matching lines...) Loading... |
4208 * Return the assignable expression that was parsed. | 4312 * Return the assignable expression that was parsed. |
4209 * | 4313 * |
4210 * assignableExpression ::= | 4314 * assignableExpression ::= |
4211 * primary (arguments* assignableSelector)+ | 4315 * primary (arguments* assignableSelector)+ |
4212 * | 'super' unconditionalAssignableSelector | 4316 * | 'super' unconditionalAssignableSelector |
4213 * | identifier | 4317 * | identifier |
4214 */ | 4318 */ |
4215 Expression _parseAssignableExpression(bool primaryAllowed) { | 4319 Expression _parseAssignableExpression(bool primaryAllowed) { |
4216 if (_matchesKeyword(Keyword.SUPER)) { | 4320 if (_matchesKeyword(Keyword.SUPER)) { |
4217 return _parseAssignableSelector( | 4321 return _parseAssignableSelector( |
4218 new SuperExpression(getAndAdvance()), false, allowConditional: false); | 4322 new SuperExpression(getAndAdvance()), false, |
| 4323 allowConditional: false); |
4219 } | 4324 } |
4220 // | 4325 // |
4221 // A primary expression can start with an identifier. We resolve the | 4326 // A primary expression can start with an identifier. We resolve the |
4222 // ambiguity by determining whether the primary consists of anything other | 4327 // ambiguity by determining whether the primary consists of anything other |
4223 // than an identifier and/or is followed by an assignableSelector. | 4328 // than an identifier and/or is followed by an assignableSelector. |
4224 // | 4329 // |
4225 Expression expression = _parsePrimaryExpression(); | 4330 Expression expression = _parsePrimaryExpression(); |
4226 bool isOptional = primaryAllowed || expression is SimpleIdentifier; | 4331 bool isOptional = primaryAllowed || expression is SimpleIdentifier; |
4227 while (true) { | 4332 while (true) { |
4228 while (_isLikelyParameterList()) { | 4333 while (_isLikelyParameterList()) { |
4229 TypeArgumentList typeArguments = null; | 4334 TypeArgumentList typeArguments = null; |
4230 if (_matches(TokenType.LT)) { | 4335 if (_matches(TokenType.LT)) { |
4231 typeArguments = parseTypeArgumentList(); | 4336 typeArguments = parseTypeArgumentList(); |
4232 } | 4337 } |
4233 ArgumentList argumentList = parseArgumentList(); | 4338 ArgumentList argumentList = parseArgumentList(); |
4234 if (expression is SimpleIdentifier) { | 4339 if (expression is SimpleIdentifier) { |
4235 expression = new MethodInvocation(null, null, | 4340 expression = new MethodInvocation(null, null, |
4236 expression as SimpleIdentifier, typeArguments, argumentList); | 4341 expression as SimpleIdentifier, typeArguments, argumentList); |
4237 } else if (expression is PrefixedIdentifier) { | 4342 } else if (expression is PrefixedIdentifier) { |
4238 PrefixedIdentifier identifier = expression as PrefixedIdentifier; | 4343 PrefixedIdentifier identifier = expression as PrefixedIdentifier; |
4239 expression = new MethodInvocation(identifier.prefix, | 4344 expression = new MethodInvocation( |
4240 identifier.period, identifier.identifier, typeArguments, | 4345 identifier.prefix, |
| 4346 identifier.period, |
| 4347 identifier.identifier, |
| 4348 typeArguments, |
4241 argumentList); | 4349 argumentList); |
4242 } else if (expression is PropertyAccess) { | 4350 } else if (expression is PropertyAccess) { |
4243 PropertyAccess access = expression as PropertyAccess; | 4351 PropertyAccess access = expression as PropertyAccess; |
4244 expression = new MethodInvocation(access.target, access.operator, | 4352 expression = new MethodInvocation(access.target, access.operator, |
4245 access.propertyName, typeArguments, argumentList); | 4353 access.propertyName, typeArguments, argumentList); |
4246 } else { | 4354 } else { |
4247 expression = new FunctionExpressionInvocation( | 4355 expression = new FunctionExpressionInvocation( |
4248 expression, typeArguments, argumentList); | 4356 expression, typeArguments, argumentList); |
4249 } | 4357 } |
4250 if (!primaryAllowed) { | 4358 if (!primaryAllowed) { |
(...skipping 214 matching lines...) Loading... |
4465 if (!identical(selector, expression)) { | 4573 if (!identical(selector, expression)) { |
4466 expression = selector; | 4574 expression = selector; |
4467 progress = true; | 4575 progress = true; |
4468 while (_isLikelyParameterList()) { | 4576 while (_isLikelyParameterList()) { |
4469 TypeArgumentList typeArguments = null; | 4577 TypeArgumentList typeArguments = null; |
4470 if (_matches(TokenType.LT)) { | 4578 if (_matches(TokenType.LT)) { |
4471 typeArguments = parseTypeArgumentList(); | 4579 typeArguments = parseTypeArgumentList(); |
4472 } | 4580 } |
4473 if (expression is PropertyAccess) { | 4581 if (expression is PropertyAccess) { |
4474 PropertyAccess propertyAccess = expression as PropertyAccess; | 4582 PropertyAccess propertyAccess = expression as PropertyAccess; |
4475 expression = new MethodInvocation(propertyAccess.target, | 4583 expression = new MethodInvocation( |
4476 propertyAccess.operator, propertyAccess.propertyName, | 4584 propertyAccess.target, |
4477 typeArguments, parseArgumentList()); | 4585 propertyAccess.operator, |
| 4586 propertyAccess.propertyName, |
| 4587 typeArguments, |
| 4588 parseArgumentList()); |
4478 } else { | 4589 } else { |
4479 expression = new FunctionExpressionInvocation( | 4590 expression = new FunctionExpressionInvocation( |
4480 expression, typeArguments, parseArgumentList()); | 4591 expression, typeArguments, parseArgumentList()); |
4481 } | 4592 } |
4482 } | 4593 } |
4483 } | 4594 } |
4484 } | 4595 } |
4485 if (_currentToken.type.isAssignmentOperator) { | 4596 if (_currentToken.type.isAssignmentOperator) { |
4486 Token operator = getAndAdvance(); | 4597 Token operator = getAndAdvance(); |
4487 _ensureAssignable(expression); | 4598 _ensureAssignable(expression); |
(...skipping 108 matching lines...) Loading... |
4596 if (_matches(TokenType.OPEN_CURLY_BRACKET)) { | 4707 if (_matches(TokenType.OPEN_CURLY_BRACKET)) { |
4597 leftBracket = _expect(TokenType.OPEN_CURLY_BRACKET); | 4708 leftBracket = _expect(TokenType.OPEN_CURLY_BRACKET); |
4598 members = _parseClassMembers(className, _getEndToken(leftBracket)); | 4709 members = _parseClassMembers(className, _getEndToken(leftBracket)); |
4599 rightBracket = _expect(TokenType.CLOSE_CURLY_BRACKET); | 4710 rightBracket = _expect(TokenType.CLOSE_CURLY_BRACKET); |
4600 } else { | 4711 } else { |
4601 leftBracket = _createSyntheticToken(TokenType.OPEN_CURLY_BRACKET); | 4712 leftBracket = _createSyntheticToken(TokenType.OPEN_CURLY_BRACKET); |
4602 rightBracket = _createSyntheticToken(TokenType.CLOSE_CURLY_BRACKET); | 4713 rightBracket = _createSyntheticToken(TokenType.CLOSE_CURLY_BRACKET); |
4603 _reportErrorForCurrentToken(ParserErrorCode.MISSING_CLASS_BODY); | 4714 _reportErrorForCurrentToken(ParserErrorCode.MISSING_CLASS_BODY); |
4604 } | 4715 } |
4605 ClassDeclaration classDeclaration = new ClassDeclaration( | 4716 ClassDeclaration classDeclaration = new ClassDeclaration( |
4606 commentAndMetadata.comment, commentAndMetadata.metadata, | 4717 commentAndMetadata.comment, |
4607 abstractKeyword, keyword, name, typeParameters, extendsClause, | 4718 commentAndMetadata.metadata, |
4608 withClause, implementsClause, leftBracket, members, rightBracket); | 4719 abstractKeyword, |
| 4720 keyword, |
| 4721 name, |
| 4722 typeParameters, |
| 4723 extendsClause, |
| 4724 withClause, |
| 4725 implementsClause, |
| 4726 leftBracket, |
| 4727 members, |
| 4728 rightBracket); |
4609 classDeclaration.nativeClause = nativeClause; | 4729 classDeclaration.nativeClause = nativeClause; |
4610 return classDeclaration; | 4730 return classDeclaration; |
4611 } | 4731 } |
4612 | 4732 |
4613 /** | 4733 /** |
4614 * Parse a list of class members. The [className] is the name of the class | 4734 * Parse a list of class members. The [className] is the name of the class |
4615 * whose members are being parsed. The [closingBracket] is the closing bracket | 4735 * whose members are being parsed. The [closingBracket] is the closing bracket |
4616 * for the class, or `null` if the closing bracket is missing. Return the list | 4736 * for the class, or `null` if the closing bracket is missing. Return the list |
4617 * of class members that were parsed. | 4737 * of class members that were parsed. |
4618 * | 4738 * |
(...skipping 69 matching lines...) Loading... |
4688 ParserErrorCode.EXPECTED_TOKEN, [TokenType.SEMICOLON.lexeme]); | 4808 ParserErrorCode.EXPECTED_TOKEN, [TokenType.SEMICOLON.lexeme]); |
4689 Token leftBracket = getAndAdvance(); | 4809 Token leftBracket = getAndAdvance(); |
4690 _parseClassMembers(className.name, _getEndToken(leftBracket)); | 4810 _parseClassMembers(className.name, _getEndToken(leftBracket)); |
4691 _expect(TokenType.CLOSE_CURLY_BRACKET); | 4811 _expect(TokenType.CLOSE_CURLY_BRACKET); |
4692 } else { | 4812 } else { |
4693 _reportErrorForToken(ParserErrorCode.EXPECTED_TOKEN, | 4813 _reportErrorForToken(ParserErrorCode.EXPECTED_TOKEN, |
4694 _currentToken.previous, [TokenType.SEMICOLON.lexeme]); | 4814 _currentToken.previous, [TokenType.SEMICOLON.lexeme]); |
4695 } | 4815 } |
4696 semicolon = _createSyntheticToken(TokenType.SEMICOLON); | 4816 semicolon = _createSyntheticToken(TokenType.SEMICOLON); |
4697 } | 4817 } |
4698 return new ClassTypeAlias(commentAndMetadata.comment, | 4818 return new ClassTypeAlias( |
4699 commentAndMetadata.metadata, classKeyword, className, typeParameters, | 4819 commentAndMetadata.comment, |
4700 equals, abstractKeyword, superclass, withClause, implementsClause, | 4820 commentAndMetadata.metadata, |
| 4821 classKeyword, |
| 4822 className, |
| 4823 typeParameters, |
| 4824 equals, |
| 4825 abstractKeyword, |
| 4826 superclass, |
| 4827 withClause, |
| 4828 implementsClause, |
4701 semicolon); | 4829 semicolon); |
4702 } | 4830 } |
4703 | 4831 |
4704 /** | 4832 /** |
4705 * Parse a list of combinators in a directive. Return the combinators that | 4833 * Parse a list of combinators in a directive. Return the combinators that |
4706 * were parsed. | 4834 * were parsed. |
4707 * | 4835 * |
4708 * combinator ::= | 4836 * combinator ::= |
4709 * 'show' identifier (',' identifier)* | 4837 * 'show' identifier (',' identifier)* |
4710 * | 'hide' identifier (',' identifier)* | 4838 * | 'hide' identifier (',' identifier)* |
(...skipping 209 matching lines...) Loading... |
4920 _tokenMatchesIdentifier(_peek())) { | 5048 _tokenMatchesIdentifier(_peek())) { |
4921 _validateModifiersForTopLevelFunction(modifiers); | 5049 _validateModifiersForTopLevelFunction(modifiers); |
4922 return _parseFunctionDeclaration( | 5050 return _parseFunctionDeclaration( |
4923 commentAndMetadata, modifiers.externalKeyword, returnType); | 5051 commentAndMetadata, modifiers.externalKeyword, returnType); |
4924 } else if (_matchesKeyword(Keyword.OPERATOR) && _isOperator(_peek())) { | 5052 } else if (_matchesKeyword(Keyword.OPERATOR) && _isOperator(_peek())) { |
4925 _reportErrorForToken(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken); | 5053 _reportErrorForToken(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken); |
4926 return _convertToFunctionDeclaration(_parseOperator( | 5054 return _convertToFunctionDeclaration(_parseOperator( |
4927 commentAndMetadata, modifiers.externalKeyword, returnType)); | 5055 commentAndMetadata, modifiers.externalKeyword, returnType)); |
4928 } else if (_matchesIdentifier() && | 5056 } else if (_matchesIdentifier() && |
4929 _peek().matchesAny([ | 5057 _peek().matchesAny([ |
4930 TokenType.OPEN_PAREN, | 5058 TokenType.OPEN_PAREN, |
4931 TokenType.OPEN_CURLY_BRACKET, | 5059 TokenType.OPEN_CURLY_BRACKET, |
4932 TokenType.FUNCTION | 5060 TokenType.FUNCTION |
4933 ])) { | 5061 ])) { |
4934 _validateModifiersForTopLevelFunction(modifiers); | 5062 _validateModifiersForTopLevelFunction(modifiers); |
4935 return _parseFunctionDeclaration( | 5063 return _parseFunctionDeclaration( |
4936 commentAndMetadata, modifiers.externalKeyword, returnType); | 5064 commentAndMetadata, modifiers.externalKeyword, returnType); |
4937 } else { | 5065 } else { |
4938 // | 5066 // |
4939 // We have found an error of some kind. Try to recover. | 5067 // We have found an error of some kind. Try to recover. |
4940 // | 5068 // |
4941 if (_matchesIdentifier()) { | 5069 if (_matchesIdentifier()) { |
4942 if (_peek().matchesAny( | 5070 if (_peek().matchesAny( |
4943 [TokenType.EQ, TokenType.COMMA, TokenType.SEMICOLON])) { | 5071 [TokenType.EQ, TokenType.COMMA, TokenType.SEMICOLON])) { |
4944 // | 5072 // |
4945 // We appear to have a variable declaration with a type of "void". | 5073 // We appear to have a variable declaration with a type of "void". |
4946 // | 5074 // |
4947 _reportErrorForNode(ParserErrorCode.VOID_VARIABLE, returnType); | 5075 _reportErrorForNode(ParserErrorCode.VOID_VARIABLE, returnType); |
4948 return new TopLevelVariableDeclaration(commentAndMetadata.comment, | 5076 return new TopLevelVariableDeclaration( |
| 5077 commentAndMetadata.comment, |
4949 commentAndMetadata.metadata, | 5078 commentAndMetadata.metadata, |
4950 _parseVariableDeclarationListAfterType(null, | 5079 _parseVariableDeclarationListAfterType(null, |
4951 _validateModifiersForTopLevelVariable(modifiers), null), | 5080 _validateModifiersForTopLevelVariable(modifiers), null), |
4952 _expect(TokenType.SEMICOLON)); | 5081 _expect(TokenType.SEMICOLON)); |
4953 } | 5082 } |
4954 } | 5083 } |
4955 _reportErrorForToken( | 5084 _reportErrorForToken( |
4956 ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken); | 5085 ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken); |
4957 return null; | 5086 return null; |
4958 } | 5087 } |
(...skipping 15 matching lines...) Loading... |
4974 keyword = modifiers.constKeyword; | 5103 keyword = modifiers.constKeyword; |
4975 } | 5104 } |
4976 if (keyword != null) { | 5105 if (keyword != null) { |
4977 // | 5106 // |
4978 // We appear to have found an incomplete top-level variable declaration. | 5107 // We appear to have found an incomplete top-level variable declaration. |
4979 // | 5108 // |
4980 _reportErrorForCurrentToken(ParserErrorCode.MISSING_IDENTIFIER); | 5109 _reportErrorForCurrentToken(ParserErrorCode.MISSING_IDENTIFIER); |
4981 List<VariableDeclaration> variables = new List<VariableDeclaration>(); | 5110 List<VariableDeclaration> variables = new List<VariableDeclaration>(); |
4982 variables.add( | 5111 variables.add( |
4983 new VariableDeclaration(_createSyntheticIdentifier(), null, null)); | 5112 new VariableDeclaration(_createSyntheticIdentifier(), null, null)); |
4984 return new TopLevelVariableDeclaration(commentAndMetadata.comment, | 5113 return new TopLevelVariableDeclaration( |
| 5114 commentAndMetadata.comment, |
4985 commentAndMetadata.metadata, | 5115 commentAndMetadata.metadata, |
4986 new VariableDeclarationList(null, null, keyword, null, variables), | 5116 new VariableDeclarationList(null, null, keyword, null, variables), |
4987 _expectSemicolon()); | 5117 _expectSemicolon()); |
4988 } | 5118 } |
4989 _reportErrorForToken(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken); | 5119 _reportErrorForToken(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken); |
4990 return null; | 5120 return null; |
4991 } else if (_tokenMatches(_peek(), TokenType.OPEN_PAREN)) { | 5121 } else if (_tokenMatches(_peek(), TokenType.OPEN_PAREN)) { |
4992 _validateModifiersForTopLevelFunction(modifiers); | 5122 _validateModifiersForTopLevelFunction(modifiers); |
4993 return _parseFunctionDeclaration( | 5123 return _parseFunctionDeclaration( |
4994 commentAndMetadata, modifiers.externalKeyword, null); | 5124 commentAndMetadata, modifiers.externalKeyword, null); |
4995 } else if (_peek() | 5125 } else if (_peek() |
4996 .matchesAny([TokenType.EQ, TokenType.COMMA, TokenType.SEMICOLON])) { | 5126 .matchesAny([TokenType.EQ, TokenType.COMMA, TokenType.SEMICOLON])) { |
4997 if (modifiers.constKeyword == null && | 5127 if (modifiers.constKeyword == null && |
4998 modifiers.finalKeyword == null && | 5128 modifiers.finalKeyword == null && |
4999 modifiers.varKeyword == null) { | 5129 modifiers.varKeyword == null) { |
5000 _reportErrorForCurrentToken( | 5130 _reportErrorForCurrentToken( |
5001 ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE); | 5131 ParserErrorCode.MISSING_CONST_FINAL_VAR_OR_TYPE); |
5002 } | 5132 } |
5003 return new TopLevelVariableDeclaration(commentAndMetadata.comment, | 5133 return new TopLevelVariableDeclaration( |
5004 commentAndMetadata.metadata, _parseVariableDeclarationListAfterType( | 5134 commentAndMetadata.comment, |
| 5135 commentAndMetadata.metadata, |
| 5136 _parseVariableDeclarationListAfterType( |
5005 null, _validateModifiersForTopLevelVariable(modifiers), null), | 5137 null, _validateModifiersForTopLevelVariable(modifiers), null), |
5006 _expect(TokenType.SEMICOLON)); | 5138 _expect(TokenType.SEMICOLON)); |
5007 } | 5139 } |
5008 TypeName returnType = parseReturnType(); | 5140 TypeName returnType = parseReturnType(); |
5009 if ((_matchesKeyword(Keyword.GET) || _matchesKeyword(Keyword.SET)) && | 5141 if ((_matchesKeyword(Keyword.GET) || _matchesKeyword(Keyword.SET)) && |
5010 _tokenMatchesIdentifier(_peek())) { | 5142 _tokenMatchesIdentifier(_peek())) { |
5011 _validateModifiersForTopLevelFunction(modifiers); | 5143 _validateModifiersForTopLevelFunction(modifiers); |
5012 return _parseFunctionDeclaration( | 5144 return _parseFunctionDeclaration( |
5013 commentAndMetadata, modifiers.externalKeyword, returnType); | 5145 commentAndMetadata, modifiers.externalKeyword, returnType); |
5014 } else if (_matchesKeyword(Keyword.OPERATOR) && _isOperator(_peek())) { | 5146 } else if (_matchesKeyword(Keyword.OPERATOR) && _isOperator(_peek())) { |
5015 _reportErrorForToken(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken); | 5147 _reportErrorForToken(ParserErrorCode.TOP_LEVEL_OPERATOR, _currentToken); |
5016 return _convertToFunctionDeclaration(_parseOperator( | 5148 return _convertToFunctionDeclaration(_parseOperator( |
5017 commentAndMetadata, modifiers.externalKeyword, returnType)); | 5149 commentAndMetadata, modifiers.externalKeyword, returnType)); |
5018 } else if (_matches(TokenType.AT)) { | 5150 } else if (_matches(TokenType.AT)) { |
5019 return new TopLevelVariableDeclaration(commentAndMetadata.comment, | 5151 return new TopLevelVariableDeclaration( |
5020 commentAndMetadata.metadata, _parseVariableDeclarationListAfterType( | 5152 commentAndMetadata.comment, |
5021 null, _validateModifiersForTopLevelVariable(modifiers), | 5153 commentAndMetadata.metadata, |
5022 returnType), _expect(TokenType.SEMICOLON)); | 5154 _parseVariableDeclarationListAfterType(null, |
| 5155 _validateModifiersForTopLevelVariable(modifiers), returnType), |
| 5156 _expect(TokenType.SEMICOLON)); |
5023 } else if (!_matchesIdentifier()) { | 5157 } else if (!_matchesIdentifier()) { |
5024 // TODO(brianwilkerson) Generalize this error. We could also be parsing a | 5158 // TODO(brianwilkerson) Generalize this error. We could also be parsing a |
5025 // top-level variable at this point. | 5159 // top-level variable at this point. |
5026 _reportErrorForToken(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken); | 5160 _reportErrorForToken(ParserErrorCode.EXPECTED_EXECUTABLE, _currentToken); |
5027 Token semicolon; | 5161 Token semicolon; |
5028 if (_matches(TokenType.SEMICOLON)) { | 5162 if (_matches(TokenType.SEMICOLON)) { |
5029 semicolon = getAndAdvance(); | 5163 semicolon = getAndAdvance(); |
5030 } else { | 5164 } else { |
5031 semicolon = _createSyntheticToken(TokenType.SEMICOLON); | 5165 semicolon = _createSyntheticToken(TokenType.SEMICOLON); |
5032 } | 5166 } |
5033 List<VariableDeclaration> variables = new List<VariableDeclaration>(); | 5167 List<VariableDeclaration> variables = new List<VariableDeclaration>(); |
5034 variables.add( | 5168 variables.add( |
5035 new VariableDeclaration(_createSyntheticIdentifier(), null, null)); | 5169 new VariableDeclaration(_createSyntheticIdentifier(), null, null)); |
5036 return new TopLevelVariableDeclaration(commentAndMetadata.comment, | 5170 return new TopLevelVariableDeclaration( |
| 5171 commentAndMetadata.comment, |
5037 commentAndMetadata.metadata, | 5172 commentAndMetadata.metadata, |
5038 new VariableDeclarationList(null, null, null, returnType, variables), | 5173 new VariableDeclarationList(null, null, null, returnType, variables), |
5039 semicolon); | 5174 semicolon); |
5040 } | 5175 } |
5041 if (_peek().matchesAny([ | 5176 if (_peek().matchesAny([ |
5042 TokenType.OPEN_PAREN, | 5177 TokenType.OPEN_PAREN, |
5043 TokenType.FUNCTION, | 5178 TokenType.FUNCTION, |
5044 TokenType.OPEN_CURLY_BRACKET | 5179 TokenType.OPEN_CURLY_BRACKET |
5045 ])) { | 5180 ])) { |
5046 _validateModifiersForTopLevelFunction(modifiers); | 5181 _validateModifiersForTopLevelFunction(modifiers); |
5047 return _parseFunctionDeclaration( | 5182 return _parseFunctionDeclaration( |
5048 commentAndMetadata, modifiers.externalKeyword, returnType); | 5183 commentAndMetadata, modifiers.externalKeyword, returnType); |
5049 } | 5184 } |
5050 return new TopLevelVariableDeclaration(commentAndMetadata.comment, | 5185 return new TopLevelVariableDeclaration( |
5051 commentAndMetadata.metadata, _parseVariableDeclarationListAfterType( | 5186 commentAndMetadata.comment, |
| 5187 commentAndMetadata.metadata, |
| 5188 _parseVariableDeclarationListAfterType( |
5052 null, _validateModifiersForTopLevelVariable(modifiers), returnType), | 5189 null, _validateModifiersForTopLevelVariable(modifiers), returnType), |
5053 _expect(TokenType.SEMICOLON)); | 5190 _expect(TokenType.SEMICOLON)); |
5054 } | 5191 } |
5055 | 5192 |
5056 /** | 5193 /** |
5057 * Parse a const expression. Return the const expression that was parsed. | 5194 * Parse a const expression. Return the const expression that was parsed. |
5058 * | 5195 * |
5059 * constExpression ::= | 5196 * constExpression ::= |
5060 * instanceCreationExpression | 5197 * instanceCreationExpression |
5061 * | listLiteral | 5198 * | listLiteral |
5062 * | mapLiteral | 5199 * | mapLiteral |
5063 */ | 5200 */ |
5064 Expression _parseConstExpression() { | 5201 Expression _parseConstExpression() { |
5065 Token keyword = _expectKeyword(Keyword.CONST); | 5202 Token keyword = _expectKeyword(Keyword.CONST); |
5066 if (_matches(TokenType.OPEN_SQUARE_BRACKET) || _matches(TokenType.INDEX)) { | 5203 if (_matches(TokenType.OPEN_SQUARE_BRACKET) || _matches(TokenType.INDEX)) { |
5067 return _parseListLiteral(keyword, null); | 5204 return _parseListLiteral(keyword, null); |
5068 } else if (_matches(TokenType.OPEN_CURLY_BRACKET)) { | 5205 } else if (_matches(TokenType.OPEN_CURLY_BRACKET)) { |
5069 return _parseMapLiteral(keyword, null); | 5206 return _parseMapLiteral(keyword, null); |
5070 } else if (_matches(TokenType.LT)) { | 5207 } else if (_matches(TokenType.LT)) { |
5071 return _parseListOrMapLiteral(keyword); | 5208 return _parseListOrMapLiteral(keyword); |
5072 } | 5209 } |
5073 return _parseInstanceCreationExpression(keyword); | 5210 return _parseInstanceCreationExpression(keyword); |
5074 } | 5211 } |
5075 | 5212 |
5076 ConstructorDeclaration _parseConstructor( | 5213 ConstructorDeclaration _parseConstructor( |
5077 CommentAndMetadata commentAndMetadata, Token externalKeyword, | 5214 CommentAndMetadata commentAndMetadata, |
5078 Token constKeyword, Token factoryKeyword, SimpleIdentifier returnType, | 5215 Token externalKeyword, |
5079 Token period, SimpleIdentifier name, FormalParameterList parameters) { | 5216 Token constKeyword, |
| 5217 Token factoryKeyword, |
| 5218 SimpleIdentifier returnType, |
| 5219 Token period, |
| 5220 SimpleIdentifier name, |
| 5221 FormalParameterList parameters) { |
5080 bool bodyAllowed = externalKeyword == null; | 5222 bool bodyAllowed = externalKeyword == null; |
5081 Token separator = null; | 5223 Token separator = null; |
5082 List<ConstructorInitializer> initializers = null; | 5224 List<ConstructorInitializer> initializers = null; |
5083 if (_matches(TokenType.COLON)) { | 5225 if (_matches(TokenType.COLON)) { |
5084 separator = getAndAdvance(); | 5226 separator = getAndAdvance(); |
5085 initializers = new List<ConstructorInitializer>(); | 5227 initializers = new List<ConstructorInitializer>(); |
5086 do { | 5228 do { |
5087 if (_matchesKeyword(Keyword.THIS)) { | 5229 if (_matchesKeyword(Keyword.THIS)) { |
5088 if (_tokenMatches(_peek(), TokenType.OPEN_PAREN)) { | 5230 if (_tokenMatches(_peek(), TokenType.OPEN_PAREN)) { |
5089 bodyAllowed = false; | 5231 bodyAllowed = false; |
(...skipping 47 matching lines...) Loading... |
5137 } else { | 5279 } else { |
5138 if (constKeyword != null) { | 5280 if (constKeyword != null) { |
5139 _reportErrorForNode( | 5281 _reportErrorForNode( |
5140 ParserErrorCode.CONST_CONSTRUCTOR_WITH_BODY, body); | 5282 ParserErrorCode.CONST_CONSTRUCTOR_WITH_BODY, body); |
5141 } else if (!bodyAllowed) { | 5283 } else if (!bodyAllowed) { |
5142 _reportErrorForNode( | 5284 _reportErrorForNode( |
5143 ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY, body); | 5285 ParserErrorCode.EXTERNAL_CONSTRUCTOR_WITH_BODY, body); |
5144 } | 5286 } |
5145 } | 5287 } |
5146 } | 5288 } |
5147 return new ConstructorDeclaration(commentAndMetadata.comment, | 5289 return new ConstructorDeclaration( |
5148 commentAndMetadata.metadata, externalKeyword, constKeyword, | 5290 commentAndMetadata.comment, |
5149 factoryKeyword, returnType, period, name, parameters, separator, | 5291 commentAndMetadata.metadata, |
5150 initializers, redirectedConstructor, body); | 5292 externalKeyword, |
| 5293 constKeyword, |
| 5294 factoryKeyword, |
| 5295 returnType, |
| 5296 period, |
| 5297 name, |
| 5298 parameters, |
| 5299 separator, |
| 5300 initializers, |
| 5301 redirectedConstructor, |
| 5302 body); |
5151 } | 5303 } |
5152 | 5304 |
5153 /** | 5305 /** |
5154 * Parse a field initializer within a constructor. Return the field | 5306 * Parse a field initializer within a constructor. Return the field |
5155 * initializer that was parsed. | 5307 * initializer that was parsed. |
5156 * | 5308 * |
5157 * fieldInitializer: | 5309 * fieldInitializer: |
5158 * ('this' '.')? identifier '=' conditionalExpression cascadeSection* | 5310 * ('this' '.')? identifier '=' conditionalExpression cascadeSection* |
5159 */ | 5311 */ |
5160 ConstructorFieldInitializer _parseConstructorFieldInitializer() { | 5312 ConstructorFieldInitializer _parseConstructorFieldInitializer() { |
(...skipping 247 matching lines...) Loading... |
5408 break; | 5560 break; |
5409 } | 5561 } |
5410 constants.add(_parseEnumConstantDeclaration()); | 5562 constants.add(_parseEnumConstantDeclaration()); |
5411 } | 5563 } |
5412 rightBracket = _expect(TokenType.CLOSE_CURLY_BRACKET); | 5564 rightBracket = _expect(TokenType.CLOSE_CURLY_BRACKET); |
5413 } else { | 5565 } else { |
5414 leftBracket = _createSyntheticToken(TokenType.OPEN_CURLY_BRACKET); | 5566 leftBracket = _createSyntheticToken(TokenType.OPEN_CURLY_BRACKET); |
5415 rightBracket = _createSyntheticToken(TokenType.CLOSE_CURLY_BRACKET); | 5567 rightBracket = _createSyntheticToken(TokenType.CLOSE_CURLY_BRACKET); |
5416 _reportErrorForCurrentToken(ParserErrorCode.MISSING_ENUM_BODY); | 5568 _reportErrorForCurrentToken(ParserErrorCode.MISSING_ENUM_BODY); |
5417 } | 5569 } |
5418 return new EnumDeclaration(commentAndMetadata.comment, | 5570 return new EnumDeclaration( |
5419 commentAndMetadata.metadata, keyword, name, leftBracket, constants, | 5571 commentAndMetadata.comment, |
| 5572 commentAndMetadata.metadata, |
| 5573 keyword, |
| 5574 name, |
| 5575 leftBracket, |
| 5576 constants, |
5420 rightBracket); | 5577 rightBracket); |
5421 } | 5578 } |
5422 | 5579 |
5423 /** | 5580 /** |
5424 * Parse an equality expression. Return the equality expression that was | 5581 * Parse an equality expression. Return the equality expression that was |
5425 * parsed. | 5582 * parsed. |
5426 * | 5583 * |
5427 * equalityExpression ::= | 5584 * equalityExpression ::= |
5428 * relationalExpression (equalityOperator relationalExpression)? | 5585 * relationalExpression (equalityOperator relationalExpression)? |
5429 * | 'super' equalityOperator relationalExpression | 5586 * | 'super' equalityOperator relationalExpression |
(...skipping 25 matching lines...) Loading... |
5455 * associated with the directive. Return the export directive that was parsed. | 5612 * associated with the directive. Return the export directive that was parsed. |
5456 * | 5613 * |
5457 * exportDirective ::= | 5614 * exportDirective ::= |
5458 * metadata 'export' stringLiteral combinator*';' | 5615 * metadata 'export' stringLiteral combinator*';' |
5459 */ | 5616 */ |
5460 ExportDirective _parseExportDirective(CommentAndMetadata commentAndMetadata) { | 5617 ExportDirective _parseExportDirective(CommentAndMetadata commentAndMetadata) { |
5461 Token exportKeyword = _expectKeyword(Keyword.EXPORT); | 5618 Token exportKeyword = _expectKeyword(Keyword.EXPORT); |
5462 StringLiteral libraryUri = _parseUri(); | 5619 StringLiteral libraryUri = _parseUri(); |
5463 List<Combinator> combinators = _parseCombinators(); | 5620 List<Combinator> combinators = _parseCombinators(); |
5464 Token semicolon = _expectSemicolon(); | 5621 Token semicolon = _expectSemicolon(); |
5465 return new ExportDirective(commentAndMetadata.comment, | 5622 return new ExportDirective( |
5466 commentAndMetadata.metadata, exportKeyword, libraryUri, combinators, | 5623 commentAndMetadata.comment, |
| 5624 commentAndMetadata.metadata, |
| 5625 exportKeyword, |
| 5626 libraryUri, |
| 5627 combinators, |
5467 semicolon); | 5628 semicolon); |
5468 } | 5629 } |
5469 | 5630 |
5470 /** | 5631 /** |
5471 * Parse a list of expressions. Return the expression that was parsed. | 5632 * Parse a list of expressions. Return the expression that was parsed. |
5472 * | 5633 * |
5473 * expressionList ::= | 5634 * expressionList ::= |
5474 * expression (',' expression)* | 5635 * expression (',' expression)* |
5475 */ | 5636 */ |
5476 List<Expression> _parseExpressionList() { | 5637 List<Expression> _parseExpressionList() { |
(...skipping 159 matching lines...) Loading... |
5636 // has content | 5797 // has content |
5637 } | 5798 } |
5638 identifier = variable.name; | 5799 identifier = variable.name; |
5639 } | 5800 } |
5640 } | 5801 } |
5641 Token inKeyword = getAndAdvance(); | 5802 Token inKeyword = getAndAdvance(); |
5642 Expression iterator = parseExpression2(); | 5803 Expression iterator = parseExpression2(); |
5643 Token rightParenthesis = _expect(TokenType.CLOSE_PAREN); | 5804 Token rightParenthesis = _expect(TokenType.CLOSE_PAREN); |
5644 Statement body = parseStatement2(); | 5805 Statement body = parseStatement2(); |
5645 if (loopVariable == null) { | 5806 if (loopVariable == null) { |
5646 return new ForEachStatement.withReference(awaitKeyword, forKeyword, | 5807 return new ForEachStatement.withReference( |
5647 leftParenthesis, identifier, inKeyword, iterator, | 5808 awaitKeyword, |
5648 rightParenthesis, body); | 5809 forKeyword, |
| 5810 leftParenthesis, |
| 5811 identifier, |
| 5812 inKeyword, |
| 5813 iterator, |
| 5814 rightParenthesis, |
| 5815 body); |
5649 } | 5816 } |
5650 return new ForEachStatement.withDeclaration(awaitKeyword, forKeyword, | 5817 return new ForEachStatement.withDeclaration( |
5651 leftParenthesis, loopVariable, inKeyword, iterator, | 5818 awaitKeyword, |
5652 rightParenthesis, body); | 5819 forKeyword, |
| 5820 leftParenthesis, |
| 5821 loopVariable, |
| 5822 inKeyword, |
| 5823 iterator, |
| 5824 rightParenthesis, |
| 5825 body); |
5653 } | 5826 } |
5654 } | 5827 } |
5655 if (awaitKeyword != null) { | 5828 if (awaitKeyword != null) { |
5656 _reportErrorForToken( | 5829 _reportErrorForToken( |
5657 ParserErrorCode.INVALID_AWAIT_IN_FOR, awaitKeyword); | 5830 ParserErrorCode.INVALID_AWAIT_IN_FOR, awaitKeyword); |
5658 } | 5831 } |
5659 Token leftSeparator = _expect(TokenType.SEMICOLON); | 5832 Token leftSeparator = _expect(TokenType.SEMICOLON); |
5660 Expression condition = null; | 5833 Expression condition = null; |
5661 if (!_matches(TokenType.SEMICOLON)) { | 5834 if (!_matches(TokenType.SEMICOLON)) { |
5662 condition = parseExpression2(); | 5835 condition = parseExpression2(); |
5663 } | 5836 } |
5664 Token rightSeparator = _expect(TokenType.SEMICOLON); | 5837 Token rightSeparator = _expect(TokenType.SEMICOLON); |
5665 List<Expression> updaters = null; | 5838 List<Expression> updaters = null; |
5666 if (!_matches(TokenType.CLOSE_PAREN)) { | 5839 if (!_matches(TokenType.CLOSE_PAREN)) { |
5667 updaters = _parseExpressionList(); | 5840 updaters = _parseExpressionList(); |
5668 } | 5841 } |
5669 Token rightParenthesis = _expect(TokenType.CLOSE_PAREN); | 5842 Token rightParenthesis = _expect(TokenType.CLOSE_PAREN); |
5670 Statement body = parseStatement2(); | 5843 Statement body = parseStatement2(); |
5671 return new ForStatement(forKeyword, leftParenthesis, variableList, | 5844 return new ForStatement( |
5672 initialization, leftSeparator, condition, rightSeparator, updaters, | 5845 forKeyword, |
5673 rightParenthesis, body); | 5846 leftParenthesis, |
| 5847 variableList, |
| 5848 initialization, |
| 5849 leftSeparator, |
| 5850 condition, |
| 5851 rightSeparator, |
| 5852 updaters, |
| 5853 rightParenthesis, |
| 5854 body); |
5674 } finally { | 5855 } finally { |
5675 _inLoop = wasInLoop; | 5856 _inLoop = wasInLoop; |
5676 } | 5857 } |
5677 } | 5858 } |
5678 | 5859 |
5679 /** | 5860 /** |
5680 * Parse a function body. The [mayBeEmpty] is `true` if the function body is | 5861 * Parse a function body. The [mayBeEmpty] is `true` if the function body is |
5681 * allowed to be empty. The [emptyErrorCode] is the error code to report if | 5862 * allowed to be empty. The [emptyErrorCode] is the error code to report if |
5682 * function body expected, but not found. The [inExpression] is `true` if the | 5863 * function body expected, but not found. The [inExpression] is `true` if the |
5683 * function body is being parsed as part of an expression and therefore does | 5864 * function body is being parsed as part of an expression and therefore does |
(...skipping 109 matching lines...) Loading... |
5793 * not external. The [returnType] is the return type, or `null` if there is no | 5974 * not external. The [returnType] is the return type, or `null` if there is no |
5794 * return type. The [isStatement] is `true` if the function declaration is | 5975 * return type. The [isStatement] is `true` if the function declaration is |
5795 * being parsed as a statement. Return the function declaration that was | 5976 * being parsed as a statement. Return the function declaration that was |
5796 * parsed. | 5977 * parsed. |
5797 * | 5978 * |
5798 * functionDeclaration ::= | 5979 * functionDeclaration ::= |
5799 * functionSignature functionBody | 5980 * functionSignature functionBody |
5800 * | returnType? getOrSet identifier formalParameterList functionBody | 5981 * | returnType? getOrSet identifier formalParameterList functionBody |
5801 */ | 5982 */ |
5802 FunctionDeclaration _parseFunctionDeclaration( | 5983 FunctionDeclaration _parseFunctionDeclaration( |
5803 CommentAndMetadata commentAndMetadata, Token externalKeyword, | 5984 CommentAndMetadata commentAndMetadata, |
| 5985 Token externalKeyword, |
5804 TypeName returnType) { | 5986 TypeName returnType) { |
5805 Token keyword = null; | 5987 Token keyword = null; |
5806 bool isGetter = false; | 5988 bool isGetter = false; |
5807 if (_matchesKeyword(Keyword.GET) && | 5989 if (_matchesKeyword(Keyword.GET) && |
5808 !_tokenMatches(_peek(), TokenType.OPEN_PAREN)) { | 5990 !_tokenMatches(_peek(), TokenType.OPEN_PAREN)) { |
5809 keyword = getAndAdvance(); | 5991 keyword = getAndAdvance(); |
5810 isGetter = true; | 5992 isGetter = true; |
5811 } else if (_matchesKeyword(Keyword.SET) && | 5993 } else if (_matchesKeyword(Keyword.SET) && |
5812 !_tokenMatches(_peek(), TokenType.OPEN_PAREN)) { | 5994 !_tokenMatches(_peek(), TokenType.OPEN_PAREN)) { |
5813 keyword = getAndAdvance(); | 5995 keyword = getAndAdvance(); |
5814 } | 5996 } |
5815 SimpleIdentifier name = parseSimpleIdentifier(); | 5997 SimpleIdentifier name = parseSimpleIdentifier(); |
5816 TypeParameterList typeParameters = null; | 5998 TypeParameterList typeParameters = null; |
5817 if (parseGenericMethods && _matches(TokenType.LT)) { | 5999 if (parseGenericMethods && _matches(TokenType.LT)) { |
5818 typeParameters = parseTypeParameterList(); | 6000 typeParameters = parseTypeParameterList(); |
5819 } | 6001 } |
5820 FormalParameterList parameters = null; | 6002 FormalParameterList parameters = null; |
5821 if (!isGetter) { | 6003 if (!isGetter) { |
5822 if (_matches(TokenType.OPEN_PAREN)) { | 6004 if (_matches(TokenType.OPEN_PAREN)) { |
5823 parameters = parseFormalParameterList(); | 6005 parameters = parseFormalParameterList(); |
5824 _validateFormalParameterList(parameters); | 6006 _validateFormalParameterList(parameters); |
5825 } else { | 6007 } else { |
5826 _reportErrorForCurrentToken( | 6008 _reportErrorForCurrentToken( |
5827 ParserErrorCode.MISSING_FUNCTION_PARAMETERS); | 6009 ParserErrorCode.MISSING_FUNCTION_PARAMETERS); |
5828 parameters = new FormalParameterList( | 6010 parameters = new FormalParameterList( |
5829 _createSyntheticToken(TokenType.OPEN_PAREN), null, null, null, | 6011 _createSyntheticToken(TokenType.OPEN_PAREN), |
| 6012 null, |
| 6013 null, |
| 6014 null, |
5830 _createSyntheticToken(TokenType.CLOSE_PAREN)); | 6015 _createSyntheticToken(TokenType.CLOSE_PAREN)); |
5831 } | 6016 } |
5832 } else if (_matches(TokenType.OPEN_PAREN)) { | 6017 } else if (_matches(TokenType.OPEN_PAREN)) { |
5833 _reportErrorForCurrentToken(ParserErrorCode.GETTER_WITH_PARAMETERS); | 6018 _reportErrorForCurrentToken(ParserErrorCode.GETTER_WITH_PARAMETERS); |
5834 parseFormalParameterList(); | 6019 parseFormalParameterList(); |
5835 } | 6020 } |
5836 FunctionBody body; | 6021 FunctionBody body; |
5837 if (externalKeyword == null) { | 6022 if (externalKeyword == null) { |
5838 body = _parseFunctionBody( | 6023 body = _parseFunctionBody( |
5839 false, ParserErrorCode.MISSING_FUNCTION_BODY, false); | 6024 false, ParserErrorCode.MISSING_FUNCTION_BODY, false); |
5840 } else { | 6025 } else { |
5841 body = new EmptyFunctionBody(_expect(TokenType.SEMICOLON)); | 6026 body = new EmptyFunctionBody(_expect(TokenType.SEMICOLON)); |
5842 } | 6027 } |
5843 // if (!isStatement && matches(TokenType.SEMICOLON)) { | 6028 // if (!isStatement && matches(TokenType.SEMICOLON)) { |
5844 // // TODO(brianwilkerson) Improve this error message. | 6029 // // TODO(brianwilkerson) Improve this error message. |
5845 // reportError(ParserErrorCode.UNEXPECTED_TOKEN, currentToken.getLexeme
()); | 6030 // reportError(ParserErrorCode.UNEXPECTED_TOKEN, currentToken.getLexeme
()); |
5846 // advance(); | 6031 // advance(); |
5847 // } | 6032 // } |
5848 return new FunctionDeclaration(commentAndMetadata.comment, | 6033 return new FunctionDeclaration( |
5849 commentAndMetadata.metadata, externalKeyword, returnType, keyword, name, | 6034 commentAndMetadata.comment, |
| 6035 commentAndMetadata.metadata, |
| 6036 externalKeyword, |
| 6037 returnType, |
| 6038 keyword, |
| 6039 name, |
5850 new FunctionExpression(typeParameters, parameters, body)); | 6040 new FunctionExpression(typeParameters, parameters, body)); |
5851 } | 6041 } |
5852 | 6042 |
5853 /** | 6043 /** |
5854 * Parse a function declaration statement. Return the function declaration | 6044 * Parse a function declaration statement. Return the function declaration |
5855 * statement that was parsed. | 6045 * statement that was parsed. |
5856 * | 6046 * |
5857 * functionDeclarationStatement ::= | 6047 * functionDeclarationStatement ::= |
5858 * functionSignature functionBody | 6048 * functionSignature functionBody |
5859 */ | 6049 */ |
(...skipping 48 matching lines...) Loading... |
5908 returnType = parseReturnType(); | 6098 returnType = parseReturnType(); |
5909 } | 6099 } |
5910 SimpleIdentifier name = parseSimpleIdentifier(); | 6100 SimpleIdentifier name = parseSimpleIdentifier(); |
5911 TypeParameterList typeParameters = null; | 6101 TypeParameterList typeParameters = null; |
5912 if (_matches(TokenType.LT)) { | 6102 if (_matches(TokenType.LT)) { |
5913 typeParameters = parseTypeParameterList(); | 6103 typeParameters = parseTypeParameterList(); |
5914 } | 6104 } |
5915 if (_matches(TokenType.SEMICOLON) || _matches(TokenType.EOF)) { | 6105 if (_matches(TokenType.SEMICOLON) || _matches(TokenType.EOF)) { |
5916 _reportErrorForCurrentToken(ParserErrorCode.MISSING_TYPEDEF_PARAMETERS); | 6106 _reportErrorForCurrentToken(ParserErrorCode.MISSING_TYPEDEF_PARAMETERS); |
5917 FormalParameterList parameters = new FormalParameterList( | 6107 FormalParameterList parameters = new FormalParameterList( |
5918 _createSyntheticToken(TokenType.OPEN_PAREN), null, null, null, | 6108 _createSyntheticToken(TokenType.OPEN_PAREN), |
| 6109 null, |
| 6110 null, |
| 6111 null, |
5919 _createSyntheticToken(TokenType.CLOSE_PAREN)); | 6112 _createSyntheticToken(TokenType.CLOSE_PAREN)); |
5920 Token semicolon = _expect(TokenType.SEMICOLON); | 6113 Token semicolon = _expect(TokenType.SEMICOLON); |
5921 return new FunctionTypeAlias(commentAndMetadata.comment, | 6114 return new FunctionTypeAlias( |
5922 commentAndMetadata.metadata, keyword, returnType, name, | 6115 commentAndMetadata.comment, |
5923 typeParameters, parameters, semicolon); | 6116 commentAndMetadata.metadata, |
| 6117 keyword, |
| 6118 returnType, |
| 6119 name, |
| 6120 typeParameters, |
| 6121 parameters, |
| 6122 semicolon); |
5924 } else if (!_matches(TokenType.OPEN_PAREN)) { | 6123 } else if (!_matches(TokenType.OPEN_PAREN)) { |
5925 _reportErrorForCurrentToken(ParserErrorCode.MISSING_TYPEDEF_PARAMETERS); | 6124 _reportErrorForCurrentToken(ParserErrorCode.MISSING_TYPEDEF_PARAMETERS); |
5926 // TODO(brianwilkerson) Recover from this error. At the very least we | 6125 // TODO(brianwilkerson) Recover from this error. At the very least we |
5927 // should skip to the start of the next valid compilation unit member, | 6126 // should skip to the start of the next valid compilation unit member, |
5928 // allowing for the possibility of finding the typedef parameters before | 6127 // allowing for the possibility of finding the typedef parameters before |
5929 // that point. | 6128 // that point. |
5930 return new FunctionTypeAlias(commentAndMetadata.comment, | 6129 return new FunctionTypeAlias( |
5931 commentAndMetadata.metadata, keyword, returnType, name, | 6130 commentAndMetadata.comment, |
5932 typeParameters, new FormalParameterList( | 6131 commentAndMetadata.metadata, |
5933 _createSyntheticToken(TokenType.OPEN_PAREN), null, null, null, | 6132 keyword, |
5934 _createSyntheticToken(TokenType.CLOSE_PAREN)), | 6133 returnType, |
| 6134 name, |
| 6135 typeParameters, |
| 6136 new FormalParameterList(_createSyntheticToken(TokenType.OPEN_PAREN), |
| 6137 null, null, null, _createSyntheticToken(TokenType.CLOSE_PAREN)), |
5935 _createSyntheticToken(TokenType.SEMICOLON)); | 6138 _createSyntheticToken(TokenType.SEMICOLON)); |
5936 } | 6139 } |
5937 FormalParameterList parameters = parseFormalParameterList(); | 6140 FormalParameterList parameters = parseFormalParameterList(); |
5938 _validateFormalParameterList(parameters); | 6141 _validateFormalParameterList(parameters); |
5939 Token semicolon = _expect(TokenType.SEMICOLON); | 6142 Token semicolon = _expect(TokenType.SEMICOLON); |
5940 return new FunctionTypeAlias(commentAndMetadata.comment, | 6143 return new FunctionTypeAlias( |
5941 commentAndMetadata.metadata, keyword, returnType, name, typeParameters, | 6144 commentAndMetadata.comment, |
5942 parameters, semicolon); | 6145 commentAndMetadata.metadata, |
| 6146 keyword, |
| 6147 returnType, |
| 6148 name, |
| 6149 typeParameters, |
| 6150 parameters, |
| 6151 semicolon); |
5943 } | 6152 } |
5944 | 6153 |
5945 /** | 6154 /** |
5946 * Parse a getter. The [commentAndMetadata] is the documentation comment and | 6155 * Parse a getter. The [commentAndMetadata] is the documentation comment and |
5947 * metadata to be associated with the declaration. The externalKeyword] is the | 6156 * metadata to be associated with the declaration. The externalKeyword] is the |
5948 * 'external' token. The staticKeyword] is the static keyword, or `null` if | 6157 * 'external' token. The staticKeyword] is the static keyword, or `null` if |
5949 * the getter is not static. The [returnType] the return type that has already | 6158 * the getter is not static. The [returnType] the return type that has already |
5950 * been parsed, or `null` if there was no return type. Return the getter that | 6159 * been parsed, or `null` if there was no return type. Return the getter that |
5951 * was parsed. | 6160 * was parsed. |
5952 * | 6161 * |
5953 * getter ::= | 6162 * getter ::= |
5954 * getterSignature functionBody? | 6163 * getterSignature functionBody? |
5955 * | 6164 * |
5956 * getterSignature ::= | 6165 * getterSignature ::= |
5957 * 'external'? 'static'? returnType? 'get' identifier | 6166 * 'external'? 'static'? returnType? 'get' identifier |
5958 */ | 6167 */ |
5959 MethodDeclaration _parseGetter(CommentAndMetadata commentAndMetadata, | 6168 MethodDeclaration _parseGetter(CommentAndMetadata commentAndMetadata, |
5960 Token externalKeyword, Token staticKeyword, TypeName returnType) { | 6169 Token externalKeyword, Token staticKeyword, TypeName returnType) { |
5961 Token propertyKeyword = _expectKeyword(Keyword.GET); | 6170 Token propertyKeyword = _expectKeyword(Keyword.GET); |
5962 SimpleIdentifier name = parseSimpleIdentifier(); | 6171 SimpleIdentifier name = parseSimpleIdentifier(); |
5963 if (_matches(TokenType.OPEN_PAREN) && | 6172 if (_matches(TokenType.OPEN_PAREN) && |
5964 _tokenMatches(_peek(), TokenType.CLOSE_PAREN)) { | 6173 _tokenMatches(_peek(), TokenType.CLOSE_PAREN)) { |
5965 _reportErrorForCurrentToken(ParserErrorCode.GETTER_WITH_PARAMETERS); | 6174 _reportErrorForCurrentToken(ParserErrorCode.GETTER_WITH_PARAMETERS); |
5966 _advance(); | 6175 _advance(); |
5967 _advance(); | 6176 _advance(); |
5968 } | 6177 } |
5969 FunctionBody body = _parseFunctionBody( | 6178 FunctionBody body = _parseFunctionBody( |
5970 externalKeyword != null || staticKeyword == null, | 6179 externalKeyword != null || staticKeyword == null, |
5971 ParserErrorCode.STATIC_GETTER_WITHOUT_BODY, false); | 6180 ParserErrorCode.STATIC_GETTER_WITHOUT_BODY, |
| 6181 false); |
5972 if (externalKeyword != null && body is! EmptyFunctionBody) { | 6182 if (externalKeyword != null && body is! EmptyFunctionBody) { |
5973 _reportErrorForCurrentToken(ParserErrorCode.EXTERNAL_GETTER_WITH_BODY); | 6183 _reportErrorForCurrentToken(ParserErrorCode.EXTERNAL_GETTER_WITH_BODY); |
5974 } | 6184 } |
5975 return new MethodDeclaration(commentAndMetadata.comment, | 6185 return new MethodDeclaration( |
5976 commentAndMetadata.metadata, externalKeyword, staticKeyword, returnType, | 6186 commentAndMetadata.comment, |
5977 propertyKeyword, null, name, null, null, body); | 6187 commentAndMetadata.metadata, |
| 6188 externalKeyword, |
| 6189 staticKeyword, |
| 6190 returnType, |
| 6191 propertyKeyword, |
| 6192 null, |
| 6193 name, |
| 6194 null, |
| 6195 null, |
| 6196 body); |
5978 } | 6197 } |
5979 | 6198 |
5980 /** | 6199 /** |
5981 * Parse a list of identifiers. Return the list of identifiers that were | 6200 * Parse a list of identifiers. Return the list of identifiers that were |
5982 * parsed. | 6201 * parsed. |
5983 * | 6202 * |
5984 * identifierList ::= | 6203 * identifierList ::= |
5985 * identifier (',' identifier)* | 6204 * identifier (',' identifier)* |
5986 */ | 6205 */ |
5987 List<SimpleIdentifier> _parseIdentifierList() { | 6206 List<SimpleIdentifier> _parseIdentifierList() { |
(...skipping 61 matching lines...) Loading... |
6049 ParserErrorCode.UNEXPECTED_TOKEN, [_currentToken]); | 6268 ParserErrorCode.UNEXPECTED_TOKEN, [_currentToken]); |
6050 _advance(); | 6269 _advance(); |
6051 if (_matchesKeyword(Keyword.AS)) { | 6270 if (_matchesKeyword(Keyword.AS)) { |
6052 asToken = getAndAdvance(); | 6271 asToken = getAndAdvance(); |
6053 prefix = parseSimpleIdentifier(); | 6272 prefix = parseSimpleIdentifier(); |
6054 } | 6273 } |
6055 } | 6274 } |
6056 } | 6275 } |
6057 List<Combinator> combinators = _parseCombinators(); | 6276 List<Combinator> combinators = _parseCombinators(); |
6058 Token semicolon = _expectSemicolon(); | 6277 Token semicolon = _expectSemicolon(); |
6059 return new ImportDirective(commentAndMetadata.comment, | 6278 return new ImportDirective( |
6060 commentAndMetadata.metadata, importKeyword, libraryUri, deferredToken, | 6279 commentAndMetadata.comment, |
6061 asToken, prefix, combinators, semicolon); | 6280 commentAndMetadata.metadata, |
| 6281 importKeyword, |
| 6282 libraryUri, |
| 6283 deferredToken, |
| 6284 asToken, |
| 6285 prefix, |
| 6286 combinators, |
| 6287 semicolon); |
6062 } | 6288 } |
6063 | 6289 |
6064 /** | 6290 /** |
6065 * Parse a list of initialized identifiers. The [commentAndMetadata] is the | 6291 * Parse a list of initialized identifiers. The [commentAndMetadata] is the |
6066 * documentation comment and metadata to be associated with the declaration. | 6292 * documentation comment and metadata to be associated with the declaration. |
6067 * The [staticKeyword] is the static keyword, or `null` if the getter is not | 6293 * The [staticKeyword] is the static keyword, or `null` if the getter is not |
6068 * static. The [keyword] is the token representing the 'final', 'const' or | 6294 * static. The [keyword] is the token representing the 'final', 'const' or |
6069 * 'var' keyword, or `null` if there is no keyword. The [type] is the type | 6295 * 'var' keyword, or `null` if there is no keyword. The [type] is the type |
6070 * that has already been parsed, or `null` if 'var' was provided. Return the | 6296 * that has already been parsed, or `null` if 'var' was provided. Return the |
6071 * getter that was parsed. | 6297 * getter that was parsed. |
6072 * | 6298 * |
6073 * ?? ::= | 6299 * ?? ::= |
6074 * 'static'? ('var' | type) initializedIdentifierList ';' | 6300 * 'static'? ('var' | type) initializedIdentifierList ';' |
6075 * | 'final' type? initializedIdentifierList ';' | 6301 * | 'final' type? initializedIdentifierList ';' |
6076 * | 6302 * |
6077 * initializedIdentifierList ::= | 6303 * initializedIdentifierList ::= |
6078 * initializedIdentifier (',' initializedIdentifier)* | 6304 * initializedIdentifier (',' initializedIdentifier)* |
6079 * | 6305 * |
6080 * initializedIdentifier ::= | 6306 * initializedIdentifier ::= |
6081 * identifier ('=' expression)? | 6307 * identifier ('=' expression)? |
6082 */ | 6308 */ |
6083 FieldDeclaration _parseInitializedIdentifierList( | 6309 FieldDeclaration _parseInitializedIdentifierList( |
6084 CommentAndMetadata commentAndMetadata, Token staticKeyword, Token keyword, | 6310 CommentAndMetadata commentAndMetadata, |
| 6311 Token staticKeyword, |
| 6312 Token keyword, |
6085 TypeName type) { | 6313 TypeName type) { |
6086 VariableDeclarationList fieldList = | 6314 VariableDeclarationList fieldList = |
6087 _parseVariableDeclarationListAfterType(null, keyword, type); | 6315 _parseVariableDeclarationListAfterType(null, keyword, type); |
6088 return new FieldDeclaration(commentAndMetadata.comment, | 6316 return new FieldDeclaration( |
6089 commentAndMetadata.metadata, staticKeyword, fieldList, | 6317 commentAndMetadata.comment, |
| 6318 commentAndMetadata.metadata, |
| 6319 staticKeyword, |
| 6320 fieldList, |
6090 _expect(TokenType.SEMICOLON)); | 6321 _expect(TokenType.SEMICOLON)); |
6091 } | 6322 } |
6092 | 6323 |
6093 /** | 6324 /** |
6094 * Parse an instance creation expression. The [keyword] is the 'new' or | 6325 * Parse an instance creation expression. The [keyword] is the 'new' or |
6095 * 'const' keyword that introduces the expression. Return the instance | 6326 * 'const' keyword that introduces the expression. Return the instance |
6096 * creation expression that was parsed. | 6327 * creation expression that was parsed. |
6097 * | 6328 * |
6098 * instanceCreationExpression ::= | 6329 * instanceCreationExpression ::= |
6099 * ('new' | 'const') type ('.' identifier)? argumentList | 6330 * ('new' | 'const') type ('.' identifier)? argumentList |
(...skipping 57 matching lines...) Loading... |
6157 * no type arguments. Return the list literal that was parsed. | 6388 * no type arguments. Return the list literal that was parsed. |
6158 * | 6389 * |
6159 * listLiteral ::= | 6390 * listLiteral ::= |
6160 * 'const'? typeArguments? '[' (expressionList ','?)? ']' | 6391 * 'const'? typeArguments? '[' (expressionList ','?)? ']' |
6161 */ | 6392 */ |
6162 ListLiteral _parseListLiteral( | 6393 ListLiteral _parseListLiteral( |
6163 Token modifier, TypeArgumentList typeArguments) { | 6394 Token modifier, TypeArgumentList typeArguments) { |
6164 // may be empty list literal | 6395 // may be empty list literal |
6165 if (_matches(TokenType.INDEX)) { | 6396 if (_matches(TokenType.INDEX)) { |
6166 BeginToken leftBracket = _createToken( | 6397 BeginToken leftBracket = _createToken( |
6167 _currentToken, TokenType.OPEN_SQUARE_BRACKET, isBegin: true); | 6398 _currentToken, TokenType.OPEN_SQUARE_BRACKET, |
| 6399 isBegin: true); |
6168 Token rightBracket = | 6400 Token rightBracket = |
6169 new Token(TokenType.CLOSE_SQUARE_BRACKET, _currentToken.offset + 1); | 6401 new Token(TokenType.CLOSE_SQUARE_BRACKET, _currentToken.offset + 1); |
6170 leftBracket.endToken = rightBracket; | 6402 leftBracket.endToken = rightBracket; |
6171 rightBracket.setNext(_currentToken.next); | 6403 rightBracket.setNext(_currentToken.next); |
6172 leftBracket.setNext(rightBracket); | 6404 leftBracket.setNext(rightBracket); |
6173 _currentToken.previous.setNext(leftBracket); | 6405 _currentToken.previous.setNext(leftBracket); |
6174 _currentToken = _currentToken.next; | 6406 _currentToken = _currentToken.next; |
6175 return new ListLiteral( | 6407 return new ListLiteral( |
6176 modifier, typeArguments, leftBracket, null, rightBracket); | 6408 modifier, typeArguments, leftBracket, null, rightBracket); |
6177 } | 6409 } |
(...skipping 37 matching lines...) Loading... |
6215 if (_matches(TokenType.LT)) { | 6447 if (_matches(TokenType.LT)) { |
6216 typeArguments = parseTypeArgumentList(); | 6448 typeArguments = parseTypeArgumentList(); |
6217 } | 6449 } |
6218 if (_matches(TokenType.OPEN_CURLY_BRACKET)) { | 6450 if (_matches(TokenType.OPEN_CURLY_BRACKET)) { |
6219 return _parseMapLiteral(modifier, typeArguments); | 6451 return _parseMapLiteral(modifier, typeArguments); |
6220 } else if (_matches(TokenType.OPEN_SQUARE_BRACKET) || | 6452 } else if (_matches(TokenType.OPEN_SQUARE_BRACKET) || |
6221 _matches(TokenType.INDEX)) { | 6453 _matches(TokenType.INDEX)) { |
6222 return _parseListLiteral(modifier, typeArguments); | 6454 return _parseListLiteral(modifier, typeArguments); |
6223 } | 6455 } |
6224 _reportErrorForCurrentToken(ParserErrorCode.EXPECTED_LIST_OR_MAP_LITERAL); | 6456 _reportErrorForCurrentToken(ParserErrorCode.EXPECTED_LIST_OR_MAP_LITERAL); |
6225 return new ListLiteral(modifier, typeArguments, | 6457 return new ListLiteral( |
6226 _createSyntheticToken(TokenType.OPEN_SQUARE_BRACKET), null, | 6458 modifier, |
| 6459 typeArguments, |
| 6460 _createSyntheticToken(TokenType.OPEN_SQUARE_BRACKET), |
| 6461 null, |
6227 _createSyntheticToken(TokenType.CLOSE_SQUARE_BRACKET)); | 6462 _createSyntheticToken(TokenType.CLOSE_SQUARE_BRACKET)); |
6228 } | 6463 } |
6229 | 6464 |
6230 /** | 6465 /** |
6231 * Parse a logical and expression. Return the logical and expression that was | 6466 * Parse a logical and expression. Return the logical and expression that was |
6232 * parsed. | 6467 * parsed. |
6233 * | 6468 * |
6234 * logicalAndExpression ::= | 6469 * logicalAndExpression ::= |
6235 * equalityExpression ('&&' equalityExpression)* | 6470 * equalityExpression ('&&' equalityExpression)* |
6236 */ | 6471 */ |
(...skipping 49 matching lines...) Loading... |
6286 * static keyword, or `null` if the getter is not static. The [returnType] is | 6521 * static keyword, or `null` if the getter is not static. The [returnType] is |
6287 * the return type of the method. The [name] is the name of the method. The | 6522 * the return type of the method. The [name] is the name of the method. The |
6288 * [parameters] is the parameters to the method. Return the method declaration | 6523 * [parameters] is the parameters to the method. Return the method declaration |
6289 * that was parsed. | 6524 * that was parsed. |
6290 * | 6525 * |
6291 * functionDeclaration ::= | 6526 * functionDeclaration ::= |
6292 * ('external' 'static'?)? functionSignature functionBody | 6527 * ('external' 'static'?)? functionSignature functionBody |
6293 * | 'external'? functionSignature ';' | 6528 * | 'external'? functionSignature ';' |
6294 */ | 6529 */ |
6295 MethodDeclaration _parseMethodDeclarationAfterParameters( | 6530 MethodDeclaration _parseMethodDeclarationAfterParameters( |
6296 CommentAndMetadata commentAndMetadata, Token externalKeyword, | 6531 CommentAndMetadata commentAndMetadata, |
6297 Token staticKeyword, TypeName returnType, SimpleIdentifier name, | 6532 Token externalKeyword, |
6298 TypeParameterList typeParameters, FormalParameterList parameters) { | 6533 Token staticKeyword, |
| 6534 TypeName returnType, |
| 6535 SimpleIdentifier name, |
| 6536 TypeParameterList typeParameters, |
| 6537 FormalParameterList parameters) { |
6299 FunctionBody body = _parseFunctionBody( | 6538 FunctionBody body = _parseFunctionBody( |
6300 externalKeyword != null || staticKeyword == null, | 6539 externalKeyword != null || staticKeyword == null, |
6301 ParserErrorCode.MISSING_FUNCTION_BODY, false); | 6540 ParserErrorCode.MISSING_FUNCTION_BODY, |
| 6541 false); |
6302 if (externalKeyword != null) { | 6542 if (externalKeyword != null) { |
6303 if (body is! EmptyFunctionBody) { | 6543 if (body is! EmptyFunctionBody) { |
6304 _reportErrorForNode(ParserErrorCode.EXTERNAL_METHOD_WITH_BODY, body); | 6544 _reportErrorForNode(ParserErrorCode.EXTERNAL_METHOD_WITH_BODY, body); |
6305 } | 6545 } |
6306 } else if (staticKeyword != null) { | 6546 } else if (staticKeyword != null) { |
6307 if (body is EmptyFunctionBody && _parseFunctionBodies) { | 6547 if (body is EmptyFunctionBody && _parseFunctionBodies) { |
6308 _reportErrorForNode(ParserErrorCode.ABSTRACT_STATIC_METHOD, body); | 6548 _reportErrorForNode(ParserErrorCode.ABSTRACT_STATIC_METHOD, body); |
6309 } | 6549 } |
6310 } | 6550 } |
6311 return new MethodDeclaration(commentAndMetadata.comment, | 6551 return new MethodDeclaration( |
6312 commentAndMetadata.metadata, externalKeyword, staticKeyword, returnType, | 6552 commentAndMetadata.comment, |
6313 null, null, name, typeParameters, parameters, body); | 6553 commentAndMetadata.metadata, |
| 6554 externalKeyword, |
| 6555 staticKeyword, |
| 6556 returnType, |
| 6557 null, |
| 6558 null, |
| 6559 name, |
| 6560 typeParameters, |
| 6561 parameters, |
| 6562 body); |
6314 } | 6563 } |
6315 | 6564 |
6316 /** | 6565 /** |
6317 * Parse a method declaration. The [commentAndMetadata] is the documentation | 6566 * Parse a method declaration. The [commentAndMetadata] is the documentation |
6318 * comment and metadata to be associated with the declaration. The | 6567 * comment and metadata to be associated with the declaration. The |
6319 * [externalKeyword] is the 'external' token. The [staticKeyword] is the | 6568 * [externalKeyword] is the 'external' token. The [staticKeyword] is the |
6320 * static keyword, or `null` if the getter is not static. The [returnType] is | 6569 * static keyword, or `null` if the getter is not static. The [returnType] is |
6321 * the return type of the method. Return the method declaration that was | 6570 * the return type of the method. Return the method declaration that was |
6322 * parsed. | 6571 * parsed. |
6323 * | 6572 * |
6324 * functionDeclaration ::= | 6573 * functionDeclaration ::= |
6325 * 'external'? 'static'? functionSignature functionBody | 6574 * 'external'? 'static'? functionSignature functionBody |
6326 * | 'external'? functionSignature ';' | 6575 * | 'external'? functionSignature ';' |
6327 */ | 6576 */ |
6328 MethodDeclaration _parseMethodDeclarationAfterReturnType( | 6577 MethodDeclaration _parseMethodDeclarationAfterReturnType( |
6329 CommentAndMetadata commentAndMetadata, Token externalKeyword, | 6578 CommentAndMetadata commentAndMetadata, |
6330 Token staticKeyword, TypeName returnType) { | 6579 Token externalKeyword, |
| 6580 Token staticKeyword, |
| 6581 TypeName returnType) { |
6331 SimpleIdentifier methodName = parseSimpleIdentifier(); | 6582 SimpleIdentifier methodName = parseSimpleIdentifier(); |
6332 TypeParameterList typeParameters = null; | 6583 TypeParameterList typeParameters = null; |
6333 if (parseGenericMethods && _matches(TokenType.LT)) { | 6584 if (parseGenericMethods && _matches(TokenType.LT)) { |
6334 typeParameters = parseTypeParameterList(); | 6585 typeParameters = parseTypeParameterList(); |
6335 } | 6586 } |
6336 FormalParameterList parameters; | 6587 FormalParameterList parameters; |
6337 if (!_matches(TokenType.OPEN_PAREN) && | 6588 if (!_matches(TokenType.OPEN_PAREN) && |
6338 (_matches(TokenType.OPEN_CURLY_BRACKET) || | 6589 (_matches(TokenType.OPEN_CURLY_BRACKET) || |
6339 _matches(TokenType.FUNCTION))) { | 6590 _matches(TokenType.FUNCTION))) { |
6340 _reportErrorForToken( | 6591 _reportErrorForToken( |
6341 ParserErrorCode.MISSING_METHOD_PARAMETERS, _currentToken.previous); | 6592 ParserErrorCode.MISSING_METHOD_PARAMETERS, _currentToken.previous); |
6342 parameters = new FormalParameterList( | 6593 parameters = new FormalParameterList( |
6343 _createSyntheticToken(TokenType.OPEN_PAREN), null, null, null, | 6594 _createSyntheticToken(TokenType.OPEN_PAREN), |
| 6595 null, |
| 6596 null, |
| 6597 null, |
6344 _createSyntheticToken(TokenType.CLOSE_PAREN)); | 6598 _createSyntheticToken(TokenType.CLOSE_PAREN)); |
6345 } else { | 6599 } else { |
6346 parameters = parseFormalParameterList(); | 6600 parameters = parseFormalParameterList(); |
6347 } | 6601 } |
6348 _validateFormalParameterList(parameters); | 6602 _validateFormalParameterList(parameters); |
6349 return _parseMethodDeclarationAfterParameters(commentAndMetadata, | 6603 return _parseMethodDeclarationAfterParameters( |
6350 externalKeyword, staticKeyword, returnType, methodName, typeParameters, | 6604 commentAndMetadata, |
| 6605 externalKeyword, |
| 6606 staticKeyword, |
| 6607 returnType, |
| 6608 methodName, |
| 6609 typeParameters, |
6351 parameters); | 6610 parameters); |
6352 } | 6611 } |
6353 | 6612 |
6354 /** | 6613 /** |
6355 * Parse the modifiers preceding a declaration. This method allows the | 6614 * Parse the modifiers preceding a declaration. This method allows the |
6356 * modifiers to appear in any order but does generate errors for duplicated | 6615 * modifiers to appear in any order but does generate errors for duplicated |
6357 * modifiers. Checks for other problems, such as having the modifiers appear | 6616 * modifiers. Checks for other problems, such as having the modifiers appear |
6358 * in the wrong order or specifying both 'const' and 'final', are reported in | 6617 * in the wrong order or specifying both 'const' and 'final', are reported in |
6359 * one of the methods whose name is prefixed with `validateModifiersFor`. | 6618 * one of the methods whose name is prefixed with `validateModifiersFor`. |
6360 * Return the modifiers that were parsed. | 6619 * Return the modifiers that were parsed. |
(...skipping 187 matching lines...) Loading... |
6548 return _parseTryStatement(); | 6807 return _parseTryStatement(); |
6549 } else if (keyword == Keyword.WHILE) { | 6808 } else if (keyword == Keyword.WHILE) { |
6550 return _parseWhileStatement(); | 6809 return _parseWhileStatement(); |
6551 } else if (keyword == Keyword.VAR || keyword == Keyword.FINAL) { | 6810 } else if (keyword == Keyword.VAR || keyword == Keyword.FINAL) { |
6552 return _parseVariableDeclarationStatementAfterMetadata( | 6811 return _parseVariableDeclarationStatementAfterMetadata( |
6553 commentAndMetadata); | 6812 commentAndMetadata); |
6554 } else if (keyword == Keyword.VOID) { | 6813 } else if (keyword == Keyword.VOID) { |
6555 TypeName returnType = parseReturnType(); | 6814 TypeName returnType = parseReturnType(); |
6556 if (_matchesIdentifier() && | 6815 if (_matchesIdentifier() && |
6557 _peek().matchesAny([ | 6816 _peek().matchesAny([ |
6558 TokenType.OPEN_PAREN, | 6817 TokenType.OPEN_PAREN, |
6559 TokenType.OPEN_CURLY_BRACKET, | 6818 TokenType.OPEN_CURLY_BRACKET, |
6560 TokenType.FUNCTION | 6819 TokenType.FUNCTION |
6561 ])) { | 6820 ])) { |
6562 return _parseFunctionDeclarationStatementAfterReturnType( | 6821 return _parseFunctionDeclarationStatementAfterReturnType( |
6563 commentAndMetadata, returnType); | 6822 commentAndMetadata, returnType); |
6564 } else { | 6823 } else { |
6565 // | 6824 // |
6566 // We have found an error of some kind. Try to recover. | 6825 // We have found an error of some kind. Try to recover. |
6567 // | 6826 // |
6568 if (_matchesIdentifier()) { | 6827 if (_matchesIdentifier()) { |
6569 if (_peek().matchesAny( | 6828 if (_peek().matchesAny( |
6570 [TokenType.EQ, TokenType.COMMA, TokenType.SEMICOLON])) { | 6829 [TokenType.EQ, TokenType.COMMA, TokenType.SEMICOLON])) { |
6571 // | 6830 // |
(...skipping 123 matching lines...) Loading... |
6695 _advance(); | 6954 _advance(); |
6696 } | 6955 } |
6697 } | 6956 } |
6698 FormalParameterList parameters = parseFormalParameterList(); | 6957 FormalParameterList parameters = parseFormalParameterList(); |
6699 _validateFormalParameterList(parameters); | 6958 _validateFormalParameterList(parameters); |
6700 FunctionBody body = | 6959 FunctionBody body = |
6701 _parseFunctionBody(true, ParserErrorCode.MISSING_FUNCTION_BODY, false); | 6960 _parseFunctionBody(true, ParserErrorCode.MISSING_FUNCTION_BODY, false); |
6702 if (externalKeyword != null && body is! EmptyFunctionBody) { | 6961 if (externalKeyword != null && body is! EmptyFunctionBody) { |
6703 _reportErrorForCurrentToken(ParserErrorCode.EXTERNAL_OPERATOR_WITH_BODY); | 6962 _reportErrorForCurrentToken(ParserErrorCode.EXTERNAL_OPERATOR_WITH_BODY); |
6704 } | 6963 } |
6705 return new MethodDeclaration(commentAndMetadata.comment, | 6964 return new MethodDeclaration( |
6706 commentAndMetadata.metadata, externalKeyword, null, returnType, null, | 6965 commentAndMetadata.comment, |
6707 operatorKeyword, name, null, parameters, body); | 6966 commentAndMetadata.metadata, |
| 6967 externalKeyword, |
| 6968 null, |
| 6969 returnType, |
| 6970 null, |
| 6971 operatorKeyword, |
| 6972 name, |
| 6973 null, |
| 6974 parameters, |
| 6975 body); |
6708 } | 6976 } |
6709 | 6977 |
6710 /** | 6978 /** |
6711 * Parse a return type if one is given, otherwise return `null` without | 6979 * Parse a return type if one is given, otherwise return `null` without |
6712 * advancing. Return the return type that was parsed. | 6980 * advancing. Return the return type that was parsed. |
6713 */ | 6981 */ |
6714 TypeName _parseOptionalReturnType() { | 6982 TypeName _parseOptionalReturnType() { |
6715 if (_matchesKeyword(Keyword.VOID)) { | 6983 if (_matchesKeyword(Keyword.VOID)) { |
6716 return parseReturnType(); | 6984 return parseReturnType(); |
6717 } else if (_matchesIdentifier() && | 6985 } else if (_matchesIdentifier() && |
(...skipping 24 matching lines...) Loading... |
6742 * partOfDirective ::= | 7010 * partOfDirective ::= |
6743 * metadata 'part' 'of' identifier ';' | 7011 * metadata 'part' 'of' identifier ';' |
6744 */ | 7012 */ |
6745 Directive _parsePartDirective(CommentAndMetadata commentAndMetadata) { | 7013 Directive _parsePartDirective(CommentAndMetadata commentAndMetadata) { |
6746 Token partKeyword = _expectKeyword(Keyword.PART); | 7014 Token partKeyword = _expectKeyword(Keyword.PART); |
6747 if (_matchesString(_OF)) { | 7015 if (_matchesString(_OF)) { |
6748 Token ofKeyword = getAndAdvance(); | 7016 Token ofKeyword = getAndAdvance(); |
6749 LibraryIdentifier libraryName = _parseLibraryName( | 7017 LibraryIdentifier libraryName = _parseLibraryName( |
6750 ParserErrorCode.MISSING_NAME_IN_PART_OF_DIRECTIVE, ofKeyword); | 7018 ParserErrorCode.MISSING_NAME_IN_PART_OF_DIRECTIVE, ofKeyword); |
6751 Token semicolon = _expect(TokenType.SEMICOLON); | 7019 Token semicolon = _expect(TokenType.SEMICOLON); |
6752 return new PartOfDirective(commentAndMetadata.comment, | 7020 return new PartOfDirective( |
6753 commentAndMetadata.metadata, partKeyword, ofKeyword, libraryName, | 7021 commentAndMetadata.comment, |
| 7022 commentAndMetadata.metadata, |
| 7023 partKeyword, |
| 7024 ofKeyword, |
| 7025 libraryName, |
6754 semicolon); | 7026 semicolon); |
6755 } | 7027 } |
6756 StringLiteral partUri = _parseUri(); | 7028 StringLiteral partUri = _parseUri(); |
6757 Token semicolon = _expect(TokenType.SEMICOLON); | 7029 Token semicolon = _expect(TokenType.SEMICOLON); |
6758 return new PartDirective(commentAndMetadata.comment, | 7030 return new PartDirective(commentAndMetadata.comment, |
6759 commentAndMetadata.metadata, partKeyword, partUri, semicolon); | 7031 commentAndMetadata.metadata, partKeyword, partUri, semicolon); |
6760 } | 7032 } |
6761 | 7033 |
6762 /** | 7034 /** |
6763 * Parse a postfix expression. Return the postfix expression that was parsed. | 7035 * Parse a postfix expression. Return the postfix expression that was parsed. |
(...skipping 68 matching lines...) Loading... |
6832 * | mapLiteral | 7104 * | mapLiteral |
6833 * | listLiteral | 7105 * | listLiteral |
6834 */ | 7106 */ |
6835 Expression _parsePrimaryExpression() { | 7107 Expression _parsePrimaryExpression() { |
6836 if (_matchesKeyword(Keyword.THIS)) { | 7108 if (_matchesKeyword(Keyword.THIS)) { |
6837 return new ThisExpression(getAndAdvance()); | 7109 return new ThisExpression(getAndAdvance()); |
6838 } else if (_matchesKeyword(Keyword.SUPER)) { | 7110 } else if (_matchesKeyword(Keyword.SUPER)) { |
6839 // TODO(paulberry): verify with Gilad that "super" must be followed by | 7111 // TODO(paulberry): verify with Gilad that "super" must be followed by |
6840 // unconditionalAssignableSelector in this case. | 7112 // unconditionalAssignableSelector in this case. |
6841 return _parseAssignableSelector( | 7113 return _parseAssignableSelector( |
6842 new SuperExpression(getAndAdvance()), false, allowConditional: false); | 7114 new SuperExpression(getAndAdvance()), false, |
| 7115 allowConditional: false); |
6843 } else if (_matchesKeyword(Keyword.NULL)) { | 7116 } else if (_matchesKeyword(Keyword.NULL)) { |
6844 return new NullLiteral(getAndAdvance()); | 7117 return new NullLiteral(getAndAdvance()); |
6845 } else if (_matchesKeyword(Keyword.FALSE)) { | 7118 } else if (_matchesKeyword(Keyword.FALSE)) { |
6846 return new BooleanLiteral(getAndAdvance(), false); | 7119 return new BooleanLiteral(getAndAdvance(), false); |
6847 } else if (_matchesKeyword(Keyword.TRUE)) { | 7120 } else if (_matchesKeyword(Keyword.TRUE)) { |
6848 return new BooleanLiteral(getAndAdvance(), true); | 7121 return new BooleanLiteral(getAndAdvance(), true); |
6849 } else if (_matches(TokenType.DOUBLE)) { | 7122 } else if (_matches(TokenType.DOUBLE)) { |
6850 Token token = getAndAdvance(); | 7123 Token token = getAndAdvance(); |
6851 double value = 0.0; | 7124 double value = 0.0; |
6852 try { | 7125 try { |
(...skipping 182 matching lines...) Loading... |
7035 * 'external'? 'static'? returnType? 'set' identifier formalParameterL
ist | 7308 * 'external'? 'static'? returnType? 'set' identifier formalParameterL
ist |
7036 */ | 7309 */ |
7037 MethodDeclaration _parseSetter(CommentAndMetadata commentAndMetadata, | 7310 MethodDeclaration _parseSetter(CommentAndMetadata commentAndMetadata, |
7038 Token externalKeyword, Token staticKeyword, TypeName returnType) { | 7311 Token externalKeyword, Token staticKeyword, TypeName returnType) { |
7039 Token propertyKeyword = _expectKeyword(Keyword.SET); | 7312 Token propertyKeyword = _expectKeyword(Keyword.SET); |
7040 SimpleIdentifier name = parseSimpleIdentifier(); | 7313 SimpleIdentifier name = parseSimpleIdentifier(); |
7041 FormalParameterList parameters = parseFormalParameterList(); | 7314 FormalParameterList parameters = parseFormalParameterList(); |
7042 _validateFormalParameterList(parameters); | 7315 _validateFormalParameterList(parameters); |
7043 FunctionBody body = _parseFunctionBody( | 7316 FunctionBody body = _parseFunctionBody( |
7044 externalKeyword != null || staticKeyword == null, | 7317 externalKeyword != null || staticKeyword == null, |
7045 ParserErrorCode.STATIC_SETTER_WITHOUT_BODY, false); | 7318 ParserErrorCode.STATIC_SETTER_WITHOUT_BODY, |
| 7319 false); |
7046 if (externalKeyword != null && body is! EmptyFunctionBody) { | 7320 if (externalKeyword != null && body is! EmptyFunctionBody) { |
7047 _reportErrorForCurrentToken(ParserErrorCode.EXTERNAL_SETTER_WITH_BODY); | 7321 _reportErrorForCurrentToken(ParserErrorCode.EXTERNAL_SETTER_WITH_BODY); |
7048 } | 7322 } |
7049 return new MethodDeclaration(commentAndMetadata.comment, | 7323 return new MethodDeclaration( |
7050 commentAndMetadata.metadata, externalKeyword, staticKeyword, returnType, | 7324 commentAndMetadata.comment, |
7051 propertyKeyword, null, name, null, parameters, body); | 7325 commentAndMetadata.metadata, |
| 7326 externalKeyword, |
| 7327 staticKeyword, |
| 7328 returnType, |
| 7329 propertyKeyword, |
| 7330 null, |
| 7331 name, |
| 7332 null, |
| 7333 parameters, |
| 7334 body); |
7052 } | 7335 } |
7053 | 7336 |
7054 /** | 7337 /** |
7055 * Parse a shift expression. Return the shift expression that was parsed. | 7338 * Parse a shift expression. Return the shift expression that was parsed. |
7056 * | 7339 * |
7057 * shiftExpression ::= | 7340 * shiftExpression ::= |
7058 * additiveExpression (shiftOperator additiveExpression)* | 7341 * additiveExpression (shiftOperator additiveExpression)* |
7059 * | 'super' (shiftOperator additiveExpression)+ | 7342 * | 'super' (shiftOperator additiveExpression)+ |
7060 */ | 7343 */ |
7061 Expression _parseShiftExpression() { | 7344 Expression _parseShiftExpression() { |
(...skipping 129 matching lines...) Loading... |
7191 while (!_matches(TokenType.EOF) && | 7474 while (!_matches(TokenType.EOF) && |
7192 !_matches(TokenType.CLOSE_CURLY_BRACKET)) { | 7475 !_matches(TokenType.CLOSE_CURLY_BRACKET)) { |
7193 List<Label> labels = new List<Label>(); | 7476 List<Label> labels = new List<Label>(); |
7194 while ( | 7477 while ( |
7195 _matchesIdentifier() && _tokenMatches(_peek(), TokenType.COLON)) { | 7478 _matchesIdentifier() && _tokenMatches(_peek(), TokenType.COLON)) { |
7196 SimpleIdentifier identifier = parseSimpleIdentifier(); | 7479 SimpleIdentifier identifier = parseSimpleIdentifier(); |
7197 String label = identifier.token.lexeme; | 7480 String label = identifier.token.lexeme; |
7198 if (definedLabels.contains(label)) { | 7481 if (definedLabels.contains(label)) { |
7199 _reportErrorForToken( | 7482 _reportErrorForToken( |
7200 ParserErrorCode.DUPLICATE_LABEL_IN_SWITCH_STATEMENT, | 7483 ParserErrorCode.DUPLICATE_LABEL_IN_SWITCH_STATEMENT, |
7201 identifier.token, [label]); | 7484 identifier.token, |
| 7485 [label]); |
7202 } else { | 7486 } else { |
7203 definedLabels.add(label); | 7487 definedLabels.add(label); |
7204 } | 7488 } |
7205 Token colon = _expect(TokenType.COLON); | 7489 Token colon = _expect(TokenType.COLON); |
7206 labels.add(new Label(identifier, colon)); | 7490 labels.add(new Label(identifier, colon)); |
7207 } | 7491 } |
7208 if (_matchesKeyword(Keyword.CASE)) { | 7492 if (_matchesKeyword(Keyword.CASE)) { |
7209 Token caseKeyword = getAndAdvance(); | 7493 Token caseKeyword = getAndAdvance(); |
7210 Expression caseExpression = parseExpression2(); | 7494 Expression caseExpression = parseExpression2(); |
7211 Token colon = _expect(TokenType.COLON); | 7495 Token colon = _expect(TokenType.COLON); |
(...skipping 137 matching lines...) Loading... |
7349 catchKeyword = getAndAdvance(); | 7633 catchKeyword = getAndAdvance(); |
7350 leftParenthesis = _expect(TokenType.OPEN_PAREN); | 7634 leftParenthesis = _expect(TokenType.OPEN_PAREN); |
7351 exceptionParameter = parseSimpleIdentifier(); | 7635 exceptionParameter = parseSimpleIdentifier(); |
7352 if (_matches(TokenType.COMMA)) { | 7636 if (_matches(TokenType.COMMA)) { |
7353 comma = getAndAdvance(); | 7637 comma = getAndAdvance(); |
7354 stackTraceParameter = parseSimpleIdentifier(); | 7638 stackTraceParameter = parseSimpleIdentifier(); |
7355 } | 7639 } |
7356 rightParenthesis = _expect(TokenType.CLOSE_PAREN); | 7640 rightParenthesis = _expect(TokenType.CLOSE_PAREN); |
7357 } | 7641 } |
7358 Block catchBody = parseBlock(); | 7642 Block catchBody = parseBlock(); |
7359 catchClauses.add(new CatchClause(onKeyword, exceptionType, catchKeyword, | 7643 catchClauses.add(new CatchClause( |
7360 leftParenthesis, exceptionParameter, comma, stackTraceParameter, | 7644 onKeyword, |
7361 rightParenthesis, catchBody)); | 7645 exceptionType, |
| 7646 catchKeyword, |
| 7647 leftParenthesis, |
| 7648 exceptionParameter, |
| 7649 comma, |
| 7650 stackTraceParameter, |
| 7651 rightParenthesis, |
| 7652 catchBody)); |
7362 } | 7653 } |
7363 Token finallyKeyword = null; | 7654 Token finallyKeyword = null; |
7364 if (_matchesKeyword(Keyword.FINALLY)) { | 7655 if (_matchesKeyword(Keyword.FINALLY)) { |
7365 finallyKeyword = getAndAdvance(); | 7656 finallyKeyword = getAndAdvance(); |
7366 finallyClause = parseBlock(); | 7657 finallyClause = parseBlock(); |
7367 } else { | 7658 } else { |
7368 if (catchClauses.isEmpty) { | 7659 if (catchClauses.isEmpty) { |
7369 _reportErrorForCurrentToken(ParserErrorCode.MISSING_CATCH_OR_FINALLY); | 7660 _reportErrorForCurrentToken(ParserErrorCode.MISSING_CATCH_OR_FINALLY); |
7370 } | 7661 } |
7371 } | 7662 } |
(...skipping 92 matching lines...) Loading... |
7464 // we cannot do the same for "++super" because "+super" is also not | 7755 // we cannot do the same for "++super" because "+super" is also not |
7465 // valid. | 7756 // valid. |
7466 // | 7757 // |
7467 if (operator.type == TokenType.MINUS_MINUS) { | 7758 if (operator.type == TokenType.MINUS_MINUS) { |
7468 Token firstOperator = _createToken(operator, TokenType.MINUS); | 7759 Token firstOperator = _createToken(operator, TokenType.MINUS); |
7469 Token secondOperator = | 7760 Token secondOperator = |
7470 new Token(TokenType.MINUS, operator.offset + 1); | 7761 new Token(TokenType.MINUS, operator.offset + 1); |
7471 secondOperator.setNext(_currentToken); | 7762 secondOperator.setNext(_currentToken); |
7472 firstOperator.setNext(secondOperator); | 7763 firstOperator.setNext(secondOperator); |
7473 operator.previous.setNext(firstOperator); | 7764 operator.previous.setNext(firstOperator); |
7474 return new PrefixExpression(firstOperator, new PrefixExpression( | 7765 return new PrefixExpression( |
7475 secondOperator, new SuperExpression(getAndAdvance()))); | 7766 firstOperator, |
| 7767 new PrefixExpression( |
| 7768 secondOperator, new SuperExpression(getAndAdvance()))); |
7476 } else { | 7769 } else { |
7477 // Invalid operator before 'super' | 7770 // Invalid operator before 'super' |
7478 _reportErrorForCurrentToken( | 7771 _reportErrorForCurrentToken( |
7479 ParserErrorCode.INVALID_OPERATOR_FOR_SUPER, [operator.lexeme]); | 7772 ParserErrorCode.INVALID_OPERATOR_FOR_SUPER, [operator.lexeme]); |
7480 return new PrefixExpression( | 7773 return new PrefixExpression( |
7481 operator, new SuperExpression(getAndAdvance())); | 7774 operator, new SuperExpression(getAndAdvance())); |
7482 } | 7775 } |
7483 } | 7776 } |
7484 return new PrefixExpression(operator, _parseAssignableExpression(false)); | 7777 return new PrefixExpression(operator, _parseAssignableExpression(false)); |
7485 } else if (_matches(TokenType.PLUS)) { | 7778 } else if (_matches(TokenType.PLUS)) { |
(...skipping 118 matching lines...) Loading... |
7604 } | 7897 } |
7605 List<VariableDeclaration> variables = new List<VariableDeclaration>(); | 7898 List<VariableDeclaration> variables = new List<VariableDeclaration>(); |
7606 variables.add(_parseVariableDeclaration()); | 7899 variables.add(_parseVariableDeclaration()); |
7607 while (_matches(TokenType.COMMA)) { | 7900 while (_matches(TokenType.COMMA)) { |
7608 _advance(); | 7901 _advance(); |
7609 variables.add(_parseVariableDeclaration()); | 7902 variables.add(_parseVariableDeclaration()); |
7610 } | 7903 } |
7611 return new VariableDeclarationList( | 7904 return new VariableDeclarationList( |
7612 commentAndMetadata != null ? commentAndMetadata.comment : null, | 7905 commentAndMetadata != null ? commentAndMetadata.comment : null, |
7613 commentAndMetadata != null ? commentAndMetadata.metadata : null, | 7906 commentAndMetadata != null ? commentAndMetadata.metadata : null, |
7614 keyword, type, variables); | 7907 keyword, |
| 7908 type, |
| 7909 variables); |
7615 } | 7910 } |
7616 | 7911 |
7617 /** | 7912 /** |
7618 * Parse a variable declaration statement. The [commentAndMetadata] is the | 7913 * Parse a variable declaration statement. The [commentAndMetadata] is the |
7619 * metadata to be associated with the variable declaration statement, or | 7914 * metadata to be associated with the variable declaration statement, or |
7620 * `null` if there is no attempt at parsing the comment and metadata. Return | 7915 * `null` if there is no attempt at parsing the comment and metadata. Return |
7621 * the variable declaration statement that was parsed. | 7916 * the variable declaration statement that was parsed. |
7622 * | 7917 * |
7623 * variableDeclarationStatement ::= | 7918 * variableDeclarationStatement ::= |
7624 * variableDeclarationList ';' | 7919 * variableDeclarationList ';' |
(...skipping 238 matching lines...) Loading... |
7863 } | 8158 } |
7864 Token next = startToken.next; | 8159 Token next = startToken.next; |
7865 if (_tokenMatches(next, TokenType.CLOSE_PAREN)) { | 8160 if (_tokenMatches(next, TokenType.CLOSE_PAREN)) { |
7866 return next.next; | 8161 return next.next; |
7867 } | 8162 } |
7868 // | 8163 // |
7869 // Look to see whether the token after the open parenthesis is something | 8164 // Look to see whether the token after the open parenthesis is something |
7870 // that should only occur at the beginning of a parameter list. | 8165 // that should only occur at the beginning of a parameter list. |
7871 // | 8166 // |
7872 if (next.matchesAny([ | 8167 if (next.matchesAny([ |
7873 TokenType.AT, | 8168 TokenType.AT, |
7874 TokenType.OPEN_SQUARE_BRACKET, | 8169 TokenType.OPEN_SQUARE_BRACKET, |
7875 TokenType.OPEN_CURLY_BRACKET | 8170 TokenType.OPEN_CURLY_BRACKET |
7876 ]) || | 8171 ]) || |
7877 _tokenMatchesKeyword(next, Keyword.VOID) || | 8172 _tokenMatchesKeyword(next, Keyword.VOID) || |
7878 (_tokenMatchesIdentifier(next) && | 8173 (_tokenMatchesIdentifier(next) && |
7879 (next.next.matchesAny([TokenType.COMMA, TokenType.CLOSE_PAREN])))) { | 8174 (next.next.matchesAny([TokenType.COMMA, TokenType.CLOSE_PAREN])))) { |
7880 return _skipPastMatchingToken(startToken); | 8175 return _skipPastMatchingToken(startToken); |
7881 } | 8176 } |
7882 // | 8177 // |
7883 // Look to see whether the first parameter is a function typed parameter | 8178 // Look to see whether the first parameter is a function typed parameter |
7884 // without a return type. | 8179 // without a return type. |
7885 // | 8180 // |
7886 if (_tokenMatchesIdentifier(next) && | 8181 if (_tokenMatchesIdentifier(next) && |
(...skipping 459 matching lines...) Loading... |
8346 int fourthDigit = lexeme.codeUnitAt(currentIndex + 3); | 8641 int fourthDigit = lexeme.codeUnitAt(currentIndex + 3); |
8347 if (!_isHexDigit(firstDigit) || | 8642 if (!_isHexDigit(firstDigit) || |
8348 !_isHexDigit(secondDigit) || | 8643 !_isHexDigit(secondDigit) || |
8349 !_isHexDigit(thirdDigit) || | 8644 !_isHexDigit(thirdDigit) || |
8350 !_isHexDigit(fourthDigit)) { | 8645 !_isHexDigit(fourthDigit)) { |
8351 // Illegal escape sequence: invalid hex digits | 8646 // Illegal escape sequence: invalid hex digits |
8352 _reportErrorForCurrentToken(ParserErrorCode.INVALID_UNICODE_ESCAPE); | 8647 _reportErrorForCurrentToken(ParserErrorCode.INVALID_UNICODE_ESCAPE); |
8353 } else { | 8648 } else { |
8354 _appendScalarValue( | 8649 _appendScalarValue( |
8355 buffer, | 8650 buffer, |
8356 lexeme | 8651 lexeme.substring(index, currentIndex + 1), |
8357 .substring( | |
8358 index, | |
8359 currentIndex + 1), | |
8360 (((((Character.digit(firstDigit, 16) << 4) + | 8652 (((((Character.digit(firstDigit, 16) << 4) + |
8361 Character.digit(secondDigit, 16)) << | 8653 Character.digit(secondDigit, 16)) << |
8362 4) + | 8654 4) + |
8363 Character.digit(thirdDigit, 16)) << | 8655 Character.digit(thirdDigit, 16)) << |
8364 4) + | 8656 4) + |
8365 Character | 8657 Character.digit(fourthDigit, 16), |
8366 .digit(fourthDigit, 16), | |
8367 index, | 8658 index, |
8368 currentIndex + | 8659 currentIndex + 3); |
8369 3); | |
8370 } | 8660 } |
8371 return currentIndex + 4; | 8661 return currentIndex + 4; |
8372 } | 8662 } |
8373 } else { | 8663 } else { |
8374 buffer.writeCharCode(currentChar); | 8664 buffer.writeCharCode(currentChar); |
8375 } | 8665 } |
8376 return currentIndex + 1; | 8666 return currentIndex + 1; |
8377 } | 8667 } |
8378 | 8668 |
8379 /** | 8669 /** |
(...skipping 321 matching lines...) Loading... |
8701 } | 8991 } |
8702 if (modifiers.finalKeyword != null) { | 8992 if (modifiers.finalKeyword != null) { |
8703 _reportErrorForToken( | 8993 _reportErrorForToken( |
8704 ParserErrorCode.FINAL_TYPEDEF, modifiers.finalKeyword); | 8994 ParserErrorCode.FINAL_TYPEDEF, modifiers.finalKeyword); |
8705 } | 8995 } |
8706 if (modifiers.varKeyword != null) { | 8996 if (modifiers.varKeyword != null) { |
8707 _reportErrorForToken(ParserErrorCode.VAR_TYPEDEF, modifiers.varKeyword); | 8997 _reportErrorForToken(ParserErrorCode.VAR_TYPEDEF, modifiers.varKeyword); |
8708 } | 8998 } |
8709 } | 8999 } |
8710 } | 9000 } |
| 9001 |
8711 /** | 9002 /** |
8712 * A synthetic keyword token. | 9003 * A synthetic keyword token. |
8713 */ | 9004 */ |
8714 class Parser_SyntheticKeywordToken extends KeywordToken { | 9005 class Parser_SyntheticKeywordToken extends KeywordToken { |
8715 /** | 9006 /** |
8716 * Initialize a newly created token to represent the given [keyword] at the | 9007 * Initialize a newly created token to represent the given [keyword] at the |
8717 * given [offset]. | 9008 * given [offset]. |
8718 */ | 9009 */ |
8719 Parser_SyntheticKeywordToken(Keyword keyword, int offset) | 9010 Parser_SyntheticKeywordToken(Keyword keyword, int offset) |
8720 : super(keyword, offset); | 9011 : super(keyword, offset); |
(...skipping 208 matching lines...) Loading... |
8929 'EXTERNAL_SETTER_WITH_BODY', "External setters cannot have a body"); | 9220 'EXTERNAL_SETTER_WITH_BODY', "External setters cannot have a body"); |
8930 | 9221 |
8931 static const ParserErrorCode EXTERNAL_TYPEDEF = const ParserErrorCode( | 9222 static const ParserErrorCode EXTERNAL_TYPEDEF = const ParserErrorCode( |
8932 'EXTERNAL_TYPEDEF', "Type aliases cannot be declared to be 'external'"); | 9223 'EXTERNAL_TYPEDEF', "Type aliases cannot be declared to be 'external'"); |
8933 | 9224 |
8934 static const ParserErrorCode FACTORY_TOP_LEVEL_DECLARATION = | 9225 static const ParserErrorCode FACTORY_TOP_LEVEL_DECLARATION = |
8935 const ParserErrorCode('FACTORY_TOP_LEVEL_DECLARATION', | 9226 const ParserErrorCode('FACTORY_TOP_LEVEL_DECLARATION', |
8936 "Top-level declarations cannot be declared to be 'factory'"); | 9227 "Top-level declarations cannot be declared to be 'factory'"); |
8937 | 9228 |
8938 static const ParserErrorCode FACTORY_WITH_INITIALIZERS = | 9229 static const ParserErrorCode FACTORY_WITH_INITIALIZERS = |
8939 const ParserErrorCode('FACTORY_WITH_INITIALIZERS', | 9230 const ParserErrorCode( |
| 9231 'FACTORY_WITH_INITIALIZERS', |
8940 "A 'factory' constructor cannot have initializers", | 9232 "A 'factory' constructor cannot have initializers", |
8941 "Either remove the 'factory' keyword to make this a generative " | 9233 "Either remove the 'factory' keyword to make this a generative " |
8942 "constructor or remove the initializers."); | 9234 "constructor or remove the initializers."); |
8943 | 9235 |
8944 static const ParserErrorCode FACTORY_WITHOUT_BODY = const ParserErrorCode( | 9236 static const ParserErrorCode FACTORY_WITHOUT_BODY = const ParserErrorCode( |
8945 'FACTORY_WITHOUT_BODY', | 9237 'FACTORY_WITHOUT_BODY', |
8946 "A non-redirecting 'factory' constructor must have a body"); | 9238 "A non-redirecting 'factory' constructor must have a body"); |
8947 | 9239 |
8948 static const ParserErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = | 9240 static const ParserErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = |
8949 const ParserErrorCode('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', | 9241 const ParserErrorCode('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', |
(...skipping 248 matching lines...) Loading... |
9198 | 9490 |
9199 static const ParserErrorCode NON_IDENTIFIER_LIBRARY_NAME = | 9491 static const ParserErrorCode NON_IDENTIFIER_LIBRARY_NAME = |
9200 const ParserErrorCode('NON_IDENTIFIER_LIBRARY_NAME', | 9492 const ParserErrorCode('NON_IDENTIFIER_LIBRARY_NAME', |
9201 "The name of a library must be an identifier"); | 9493 "The name of a library must be an identifier"); |
9202 | 9494 |
9203 static const ParserErrorCode NON_PART_OF_DIRECTIVE_IN_PART = | 9495 static const ParserErrorCode NON_PART_OF_DIRECTIVE_IN_PART = |
9204 const ParserErrorCode('NON_PART_OF_DIRECTIVE_IN_PART', | 9496 const ParserErrorCode('NON_PART_OF_DIRECTIVE_IN_PART', |
9205 "The part-of directive must be the only directive in a part"); | 9497 "The part-of directive must be the only directive in a part"); |
9206 | 9498 |
9207 static const ParserErrorCode NON_STRING_LITERAL_AS_URI = | 9499 static const ParserErrorCode NON_STRING_LITERAL_AS_URI = |
9208 const ParserErrorCode('NON_STRING_LITERAL_AS_URI', | 9500 const ParserErrorCode( |
| 9501 'NON_STRING_LITERAL_AS_URI', |
9209 "The URI must be a string literal", | 9502 "The URI must be a string literal", |
9210 "Enclose the URI in either single or double quotes."); | 9503 "Enclose the URI in either single or double quotes."); |
9211 | 9504 |
9212 static const ParserErrorCode NON_USER_DEFINABLE_OPERATOR = | 9505 static const ParserErrorCode NON_USER_DEFINABLE_OPERATOR = |
9213 const ParserErrorCode('NON_USER_DEFINABLE_OPERATOR', | 9506 const ParserErrorCode('NON_USER_DEFINABLE_OPERATOR', |
9214 "The operator '{0}' is not user definable"); | 9507 "The operator '{0}' is not user definable"); |
9215 | 9508 |
9216 static const ParserErrorCode NORMAL_BEFORE_OPTIONAL_PARAMETERS = | 9509 static const ParserErrorCode NORMAL_BEFORE_OPTIONAL_PARAMETERS = |
9217 const ParserErrorCode('NORMAL_BEFORE_OPTIONAL_PARAMETERS', | 9510 const ParserErrorCode('NORMAL_BEFORE_OPTIONAL_PARAMETERS', |
9218 "Normal parameters must occur before optional parameters"); | 9511 "Normal parameters must occur before optional parameters"); |
(...skipping 142 matching lines...) Loading... |
9361 | 9654 |
9362 @override | 9655 @override |
9363 bool visitAdjacentStrings(AdjacentStrings node) { | 9656 bool visitAdjacentStrings(AdjacentStrings node) { |
9364 AdjacentStrings toNode = this._toNode as AdjacentStrings; | 9657 AdjacentStrings toNode = this._toNode as AdjacentStrings; |
9365 return _isEqualNodeLists(node.strings, toNode.strings); | 9658 return _isEqualNodeLists(node.strings, toNode.strings); |
9366 } | 9659 } |
9367 | 9660 |
9368 @override | 9661 @override |
9369 bool visitAnnotation(Annotation node) { | 9662 bool visitAnnotation(Annotation node) { |
9370 Annotation toNode = this._toNode as Annotation; | 9663 Annotation toNode = this._toNode as Annotation; |
9371 if (_and(_isEqualTokens(node.atSign, toNode.atSign), | 9664 if (_and( |
| 9665 _isEqualTokens(node.atSign, toNode.atSign), |
9372 _isEqualNodes(node.name, toNode.name), | 9666 _isEqualNodes(node.name, toNode.name), |
9373 _isEqualTokens(node.period, toNode.period), | 9667 _isEqualTokens(node.period, toNode.period), |
9374 _isEqualNodes(node.constructorName, toNode.constructorName), | 9668 _isEqualNodes(node.constructorName, toNode.constructorName), |
9375 _isEqualNodes(node.arguments, toNode.arguments))) { | 9669 _isEqualNodes(node.arguments, toNode.arguments))) { |
9376 toNode.element = node.element; | 9670 toNode.element = node.element; |
9377 return true; | 9671 return true; |
9378 } | 9672 } |
9379 return false; | 9673 return false; |
9380 } | 9674 } |
9381 | 9675 |
9382 @override | 9676 @override |
9383 bool visitArgumentList(ArgumentList node) { | 9677 bool visitArgumentList(ArgumentList node) { |
9384 ArgumentList toNode = this._toNode as ArgumentList; | 9678 ArgumentList toNode = this._toNode as ArgumentList; |
9385 return _and(_isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), | 9679 return _and( |
| 9680 _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), |
9386 _isEqualNodeLists(node.arguments, toNode.arguments), | 9681 _isEqualNodeLists(node.arguments, toNode.arguments), |
9387 _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis)); | 9682 _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis)); |
9388 } | 9683 } |
9389 | 9684 |
9390 @override | 9685 @override |
9391 bool visitAsExpression(AsExpression node) { | 9686 bool visitAsExpression(AsExpression node) { |
9392 AsExpression toNode = this._toNode as AsExpression; | 9687 AsExpression toNode = this._toNode as AsExpression; |
9393 if (_and(_isEqualNodes(node.expression, toNode.expression), | 9688 if (_and( |
| 9689 _isEqualNodes(node.expression, toNode.expression), |
9394 _isEqualTokens(node.asOperator, toNode.asOperator), | 9690 _isEqualTokens(node.asOperator, toNode.asOperator), |
9395 _isEqualNodes(node.type, toNode.type))) { | 9691 _isEqualNodes(node.type, toNode.type))) { |
9396 toNode.propagatedType = node.propagatedType; | 9692 toNode.propagatedType = node.propagatedType; |
9397 toNode.staticType = node.staticType; | 9693 toNode.staticType = node.staticType; |
9398 return true; | 9694 return true; |
9399 } | 9695 } |
9400 return false; | 9696 return false; |
9401 } | 9697 } |
9402 | 9698 |
9403 @override | 9699 @override |
9404 bool visitAssertStatement(AssertStatement node) { | 9700 bool visitAssertStatement(AssertStatement node) { |
9405 AssertStatement toNode = this._toNode as AssertStatement; | 9701 AssertStatement toNode = this._toNode as AssertStatement; |
9406 return _and(_isEqualTokens(node.assertKeyword, toNode.assertKeyword), | 9702 return _and( |
| 9703 _isEqualTokens(node.assertKeyword, toNode.assertKeyword), |
9407 _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), | 9704 _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), |
9408 _isEqualNodes(node.condition, toNode.condition), | 9705 _isEqualNodes(node.condition, toNode.condition), |
9409 _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis), | 9706 _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis), |
9410 _isEqualTokens(node.semicolon, toNode.semicolon)); | 9707 _isEqualTokens(node.semicolon, toNode.semicolon)); |
9411 } | 9708 } |
9412 | 9709 |
9413 @override | 9710 @override |
9414 bool visitAssignmentExpression(AssignmentExpression node) { | 9711 bool visitAssignmentExpression(AssignmentExpression node) { |
9415 AssignmentExpression toNode = this._toNode as AssignmentExpression; | 9712 AssignmentExpression toNode = this._toNode as AssignmentExpression; |
9416 if (_and(_isEqualNodes(node.leftHandSide, toNode.leftHandSide), | 9713 if (_and( |
| 9714 _isEqualNodes(node.leftHandSide, toNode.leftHandSide), |
9417 _isEqualTokens(node.operator, toNode.operator), | 9715 _isEqualTokens(node.operator, toNode.operator), |
9418 _isEqualNodes(node.rightHandSide, toNode.rightHandSide))) { | 9716 _isEqualNodes(node.rightHandSide, toNode.rightHandSide))) { |
9419 toNode.propagatedElement = node.propagatedElement; | 9717 toNode.propagatedElement = node.propagatedElement; |
9420 toNode.propagatedType = node.propagatedType; | 9718 toNode.propagatedType = node.propagatedType; |
9421 toNode.staticElement = node.staticElement; | 9719 toNode.staticElement = node.staticElement; |
9422 toNode.staticType = node.staticType; | 9720 toNode.staticType = node.staticType; |
9423 return true; | 9721 return true; |
9424 } | 9722 } |
9425 return false; | 9723 return false; |
9426 } | 9724 } |
9427 | 9725 |
9428 @override | 9726 @override |
9429 bool visitAwaitExpression(AwaitExpression node) { | 9727 bool visitAwaitExpression(AwaitExpression node) { |
9430 AwaitExpression toNode = this._toNode as AwaitExpression; | 9728 AwaitExpression toNode = this._toNode as AwaitExpression; |
9431 return _and(_isEqualTokens(node.awaitKeyword, toNode.awaitKeyword), | 9729 if (_and(_isEqualTokens(node.awaitKeyword, toNode.awaitKeyword), |
9432 _isEqualNodes(node.expression, toNode.expression)); | 9730 _isEqualNodes(node.expression, toNode.expression))) { |
| 9731 toNode.propagatedType = node.propagatedType; |
| 9732 toNode.staticType = node.staticType; |
| 9733 return true; |
| 9734 } |
| 9735 return false; |
9433 } | 9736 } |
9434 | 9737 |
9435 @override | 9738 @override |
9436 bool visitBinaryExpression(BinaryExpression node) { | 9739 bool visitBinaryExpression(BinaryExpression node) { |
9437 BinaryExpression toNode = this._toNode as BinaryExpression; | 9740 BinaryExpression toNode = this._toNode as BinaryExpression; |
9438 if (_and(_isEqualNodes(node.leftOperand, toNode.leftOperand), | 9741 if (_and( |
| 9742 _isEqualNodes(node.leftOperand, toNode.leftOperand), |
9439 _isEqualTokens(node.operator, toNode.operator), | 9743 _isEqualTokens(node.operator, toNode.operator), |
9440 _isEqualNodes(node.rightOperand, toNode.rightOperand))) { | 9744 _isEqualNodes(node.rightOperand, toNode.rightOperand))) { |
9441 toNode.propagatedElement = node.propagatedElement; | 9745 toNode.propagatedElement = node.propagatedElement; |
9442 toNode.propagatedType = node.propagatedType; | 9746 toNode.propagatedType = node.propagatedType; |
9443 toNode.staticElement = node.staticElement; | 9747 toNode.staticElement = node.staticElement; |
9444 toNode.staticType = node.staticType; | 9748 toNode.staticType = node.staticType; |
9445 return true; | 9749 return true; |
9446 } | 9750 } |
9447 return false; | 9751 return false; |
9448 } | 9752 } |
9449 | 9753 |
9450 @override | 9754 @override |
9451 bool visitBlock(Block node) { | 9755 bool visitBlock(Block node) { |
9452 Block toNode = this._toNode as Block; | 9756 Block toNode = this._toNode as Block; |
9453 return _and(_isEqualTokens(node.leftBracket, toNode.leftBracket), | 9757 return _and( |
| 9758 _isEqualTokens(node.leftBracket, toNode.leftBracket), |
9454 _isEqualNodeLists(node.statements, toNode.statements), | 9759 _isEqualNodeLists(node.statements, toNode.statements), |
9455 _isEqualTokens(node.rightBracket, toNode.rightBracket)); | 9760 _isEqualTokens(node.rightBracket, toNode.rightBracket)); |
9456 } | 9761 } |
9457 | 9762 |
9458 @override | 9763 @override |
9459 bool visitBlockFunctionBody(BlockFunctionBody node) { | 9764 bool visitBlockFunctionBody(BlockFunctionBody node) { |
9460 BlockFunctionBody toNode = this._toNode as BlockFunctionBody; | 9765 BlockFunctionBody toNode = this._toNode as BlockFunctionBody; |
9461 return _isEqualNodes(node.block, toNode.block); | 9766 return _isEqualNodes(node.block, toNode.block); |
9462 } | 9767 } |
9463 | 9768 |
9464 @override | 9769 @override |
9465 bool visitBooleanLiteral(BooleanLiteral node) { | 9770 bool visitBooleanLiteral(BooleanLiteral node) { |
9466 BooleanLiteral toNode = this._toNode as BooleanLiteral; | 9771 BooleanLiteral toNode = this._toNode as BooleanLiteral; |
9467 if (_and(_isEqualTokens(node.literal, toNode.literal), | 9772 if (_and(_isEqualTokens(node.literal, toNode.literal), |
9468 node.value == toNode.value)) { | 9773 node.value == toNode.value)) { |
9469 toNode.propagatedType = node.propagatedType; | 9774 toNode.propagatedType = node.propagatedType; |
9470 toNode.staticType = node.staticType; | 9775 toNode.staticType = node.staticType; |
9471 return true; | 9776 return true; |
9472 } | 9777 } |
9473 return false; | 9778 return false; |
9474 } | 9779 } |
9475 | 9780 |
9476 @override | 9781 @override |
9477 bool visitBreakStatement(BreakStatement node) { | 9782 bool visitBreakStatement(BreakStatement node) { |
9478 BreakStatement toNode = this._toNode as BreakStatement; | 9783 BreakStatement toNode = this._toNode as BreakStatement; |
9479 if (_and(_isEqualTokens(node.breakKeyword, toNode.breakKeyword), | 9784 if (_and( |
| 9785 _isEqualTokens(node.breakKeyword, toNode.breakKeyword), |
9480 _isEqualNodes(node.label, toNode.label), | 9786 _isEqualNodes(node.label, toNode.label), |
9481 _isEqualTokens(node.semicolon, toNode.semicolon))) { | 9787 _isEqualTokens(node.semicolon, toNode.semicolon))) { |
9482 // TODO(paulberry): map node.target to toNode.target. | 9788 // TODO(paulberry): map node.target to toNode.target. |
9483 return true; | 9789 return true; |
9484 } | 9790 } |
9485 return false; | 9791 return false; |
9486 } | 9792 } |
9487 | 9793 |
9488 @override | 9794 @override |
9489 bool visitCascadeExpression(CascadeExpression node) { | 9795 bool visitCascadeExpression(CascadeExpression node) { |
9490 CascadeExpression toNode = this._toNode as CascadeExpression; | 9796 CascadeExpression toNode = this._toNode as CascadeExpression; |
9491 if (_and(_isEqualNodes(node.target, toNode.target), | 9797 if (_and(_isEqualNodes(node.target, toNode.target), |
9492 _isEqualNodeLists(node.cascadeSections, toNode.cascadeSections))) { | 9798 _isEqualNodeLists(node.cascadeSections, toNode.cascadeSections))) { |
9493 toNode.propagatedType = node.propagatedType; | 9799 toNode.propagatedType = node.propagatedType; |
9494 toNode.staticType = node.staticType; | 9800 toNode.staticType = node.staticType; |
9495 return true; | 9801 return true; |
9496 } | 9802 } |
9497 return false; | 9803 return false; |
9498 } | 9804 } |
9499 | 9805 |
9500 @override | 9806 @override |
9501 bool visitCatchClause(CatchClause node) { | 9807 bool visitCatchClause(CatchClause node) { |
9502 CatchClause toNode = this._toNode as CatchClause; | 9808 CatchClause toNode = this._toNode as CatchClause; |
9503 return _and(_isEqualTokens(node.onKeyword, toNode.onKeyword), | 9809 return _and( |
| 9810 _isEqualTokens(node.onKeyword, toNode.onKeyword), |
9504 _isEqualNodes(node.exceptionType, toNode.exceptionType), | 9811 _isEqualNodes(node.exceptionType, toNode.exceptionType), |
9505 _isEqualTokens(node.catchKeyword, toNode.catchKeyword), | 9812 _isEqualTokens(node.catchKeyword, toNode.catchKeyword), |
9506 _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), | 9813 _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), |
9507 _isEqualNodes(node.exceptionParameter, toNode.exceptionParameter), | 9814 _isEqualNodes(node.exceptionParameter, toNode.exceptionParameter), |
9508 _isEqualTokens(node.comma, toNode.comma), | 9815 _isEqualTokens(node.comma, toNode.comma), |
9509 _isEqualNodes(node.stackTraceParameter, toNode.stackTraceParameter), | 9816 _isEqualNodes(node.stackTraceParameter, toNode.stackTraceParameter), |
9510 _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis), | 9817 _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis), |
9511 _isEqualNodes(node.body, toNode.body)); | 9818 _isEqualNodes(node.body, toNode.body)); |
9512 } | 9819 } |
9513 | 9820 |
(...skipping 41 matching lines...) Loading... |
9555 @override | 9862 @override |
9556 bool visitCommentReference(CommentReference node) { | 9863 bool visitCommentReference(CommentReference node) { |
9557 CommentReference toNode = this._toNode as CommentReference; | 9864 CommentReference toNode = this._toNode as CommentReference; |
9558 return _and(_isEqualTokens(node.newKeyword, toNode.newKeyword), | 9865 return _and(_isEqualTokens(node.newKeyword, toNode.newKeyword), |
9559 _isEqualNodes(node.identifier, toNode.identifier)); | 9866 _isEqualNodes(node.identifier, toNode.identifier)); |
9560 } | 9867 } |
9561 | 9868 |
9562 @override | 9869 @override |
9563 bool visitCompilationUnit(CompilationUnit node) { | 9870 bool visitCompilationUnit(CompilationUnit node) { |
9564 CompilationUnit toNode = this._toNode as CompilationUnit; | 9871 CompilationUnit toNode = this._toNode as CompilationUnit; |
9565 if (_and(_isEqualTokens(node.beginToken, toNode.beginToken), | 9872 if (_and( |
| 9873 _isEqualTokens(node.beginToken, toNode.beginToken), |
9566 _isEqualNodes(node.scriptTag, toNode.scriptTag), | 9874 _isEqualNodes(node.scriptTag, toNode.scriptTag), |
9567 _isEqualNodeLists(node.directives, toNode.directives), | 9875 _isEqualNodeLists(node.directives, toNode.directives), |
9568 _isEqualNodeLists(node.declarations, toNode.declarations), | 9876 _isEqualNodeLists(node.declarations, toNode.declarations), |
9569 _isEqualTokens(node.endToken, toNode.endToken))) { | 9877 _isEqualTokens(node.endToken, toNode.endToken))) { |
9570 toNode.element = node.element; | 9878 toNode.element = node.element; |
9571 return true; | 9879 return true; |
9572 } | 9880 } |
9573 return false; | 9881 return false; |
9574 } | 9882 } |
9575 | 9883 |
9576 @override | 9884 @override |
9577 bool visitConditionalExpression(ConditionalExpression node) { | 9885 bool visitConditionalExpression(ConditionalExpression node) { |
9578 ConditionalExpression toNode = this._toNode as ConditionalExpression; | 9886 ConditionalExpression toNode = this._toNode as ConditionalExpression; |
9579 if (_and(_isEqualNodes(node.condition, toNode.condition), | 9887 if (_and( |
| 9888 _isEqualNodes(node.condition, toNode.condition), |
9580 _isEqualTokens(node.question, toNode.question), | 9889 _isEqualTokens(node.question, toNode.question), |
9581 _isEqualNodes(node.thenExpression, toNode.thenExpression), | 9890 _isEqualNodes(node.thenExpression, toNode.thenExpression), |
9582 _isEqualTokens(node.colon, toNode.colon), | 9891 _isEqualTokens(node.colon, toNode.colon), |
9583 _isEqualNodes(node.elseExpression, toNode.elseExpression))) { | 9892 _isEqualNodes(node.elseExpression, toNode.elseExpression))) { |
9584 toNode.propagatedType = node.propagatedType; | 9893 toNode.propagatedType = node.propagatedType; |
9585 toNode.staticType = node.staticType; | 9894 toNode.staticType = node.staticType; |
9586 return true; | 9895 return true; |
9587 } | 9896 } |
9588 return false; | 9897 return false; |
9589 } | 9898 } |
(...skipping 18 matching lines...) Loading... |
9608 toNode.element = node.element; | 9917 toNode.element = node.element; |
9609 return true; | 9918 return true; |
9610 } | 9919 } |
9611 return false; | 9920 return false; |
9612 } | 9921 } |
9613 | 9922 |
9614 @override | 9923 @override |
9615 bool visitConstructorFieldInitializer(ConstructorFieldInitializer node) { | 9924 bool visitConstructorFieldInitializer(ConstructorFieldInitializer node) { |
9616 ConstructorFieldInitializer toNode = | 9925 ConstructorFieldInitializer toNode = |
9617 this._toNode as ConstructorFieldInitializer; | 9926 this._toNode as ConstructorFieldInitializer; |
9618 return _and(_isEqualTokens(node.thisKeyword, toNode.thisKeyword), | 9927 return _and( |
| 9928 _isEqualTokens(node.thisKeyword, toNode.thisKeyword), |
9619 _isEqualTokens(node.period, toNode.period), | 9929 _isEqualTokens(node.period, toNode.period), |
9620 _isEqualNodes(node.fieldName, toNode.fieldName), | 9930 _isEqualNodes(node.fieldName, toNode.fieldName), |
9621 _isEqualTokens(node.equals, toNode.equals), | 9931 _isEqualTokens(node.equals, toNode.equals), |
9622 _isEqualNodes(node.expression, toNode.expression)); | 9932 _isEqualNodes(node.expression, toNode.expression)); |
9623 } | 9933 } |
9624 | 9934 |
9625 @override | 9935 @override |
9626 bool visitConstructorName(ConstructorName node) { | 9936 bool visitConstructorName(ConstructorName node) { |
9627 ConstructorName toNode = this._toNode as ConstructorName; | 9937 ConstructorName toNode = this._toNode as ConstructorName; |
9628 if (_and(_isEqualNodes(node.type, toNode.type), | 9938 if (_and( |
| 9939 _isEqualNodes(node.type, toNode.type), |
9629 _isEqualTokens(node.period, toNode.period), | 9940 _isEqualTokens(node.period, toNode.period), |
9630 _isEqualNodes(node.name, toNode.name))) { | 9941 _isEqualNodes(node.name, toNode.name))) { |
9631 toNode.staticElement = node.staticElement; | 9942 toNode.staticElement = node.staticElement; |
9632 return true; | 9943 return true; |
9633 } | 9944 } |
9634 return false; | 9945 return false; |
9635 } | 9946 } |
9636 | 9947 |
9637 @override | 9948 @override |
9638 bool visitContinueStatement(ContinueStatement node) { | 9949 bool visitContinueStatement(ContinueStatement node) { |
9639 ContinueStatement toNode = this._toNode as ContinueStatement; | 9950 ContinueStatement toNode = this._toNode as ContinueStatement; |
9640 if (_and(_isEqualTokens(node.continueKeyword, toNode.continueKeyword), | 9951 if (_and( |
| 9952 _isEqualTokens(node.continueKeyword, toNode.continueKeyword), |
9641 _isEqualNodes(node.label, toNode.label), | 9953 _isEqualNodes(node.label, toNode.label), |
9642 _isEqualTokens(node.semicolon, toNode.semicolon))) { | 9954 _isEqualTokens(node.semicolon, toNode.semicolon))) { |
9643 // TODO(paulberry): map node.target to toNode.target. | 9955 // TODO(paulberry): map node.target to toNode.target. |
9644 return true; | 9956 return true; |
9645 } | 9957 } |
9646 return false; | 9958 return false; |
9647 } | 9959 } |
9648 | 9960 |
9649 @override | 9961 @override |
9650 bool visitDeclaredIdentifier(DeclaredIdentifier node) { | 9962 bool visitDeclaredIdentifier(DeclaredIdentifier node) { |
9651 DeclaredIdentifier toNode = this._toNode as DeclaredIdentifier; | 9963 DeclaredIdentifier toNode = this._toNode as DeclaredIdentifier; |
9652 return _and( | 9964 return _and( |
9653 _isEqualNodes(node.documentationComment, toNode.documentationComment), | 9965 _isEqualNodes(node.documentationComment, toNode.documentationComment), |
9654 _isEqualNodeLists(node.metadata, toNode.metadata), | 9966 _isEqualNodeLists(node.metadata, toNode.metadata), |
9655 _isEqualTokens(node.keyword, toNode.keyword), | 9967 _isEqualTokens(node.keyword, toNode.keyword), |
9656 _isEqualNodes(node.type, toNode.type), | 9968 _isEqualNodes(node.type, toNode.type), |
9657 _isEqualNodes(node.identifier, toNode.identifier)); | 9969 _isEqualNodes(node.identifier, toNode.identifier)); |
9658 } | 9970 } |
9659 | 9971 |
9660 @override | 9972 @override |
9661 bool visitDefaultFormalParameter(DefaultFormalParameter node) { | 9973 bool visitDefaultFormalParameter(DefaultFormalParameter node) { |
9662 DefaultFormalParameter toNode = this._toNode as DefaultFormalParameter; | 9974 DefaultFormalParameter toNode = this._toNode as DefaultFormalParameter; |
9663 return _and(_isEqualNodes(node.parameter, toNode.parameter), | 9975 return _and( |
| 9976 _isEqualNodes(node.parameter, toNode.parameter), |
9664 node.kind == toNode.kind, | 9977 node.kind == toNode.kind, |
9665 _isEqualTokens(node.separator, toNode.separator), | 9978 _isEqualTokens(node.separator, toNode.separator), |
9666 _isEqualNodes(node.defaultValue, toNode.defaultValue)); | 9979 _isEqualNodes(node.defaultValue, toNode.defaultValue)); |
9667 } | 9980 } |
9668 | 9981 |
9669 @override | 9982 @override |
9670 bool visitDoStatement(DoStatement node) { | 9983 bool visitDoStatement(DoStatement node) { |
9671 DoStatement toNode = this._toNode as DoStatement; | 9984 DoStatement toNode = this._toNode as DoStatement; |
9672 return _and(_isEqualTokens(node.doKeyword, toNode.doKeyword), | 9985 return _and( |
| 9986 _isEqualTokens(node.doKeyword, toNode.doKeyword), |
9673 _isEqualNodes(node.body, toNode.body), | 9987 _isEqualNodes(node.body, toNode.body), |
9674 _isEqualTokens(node.whileKeyword, toNode.whileKeyword), | 9988 _isEqualTokens(node.whileKeyword, toNode.whileKeyword), |
9675 _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), | 9989 _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), |
9676 _isEqualNodes(node.condition, toNode.condition), | 9990 _isEqualNodes(node.condition, toNode.condition), |
9677 _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis), | 9991 _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis), |
9678 _isEqualTokens(node.semicolon, toNode.semicolon)); | 9992 _isEqualTokens(node.semicolon, toNode.semicolon)); |
9679 } | 9993 } |
9680 | 9994 |
9681 @override | 9995 @override |
9682 bool visitDoubleLiteral(DoubleLiteral node) { | 9996 bool visitDoubleLiteral(DoubleLiteral node) { |
(...skipping 100 matching lines...) Loading... |
9783 _isEqualTokens(node.keyword, toNode.keyword), | 10097 _isEqualTokens(node.keyword, toNode.keyword), |
9784 _isEqualNodes(node.type, toNode.type), | 10098 _isEqualNodes(node.type, toNode.type), |
9785 _isEqualTokens(node.thisKeyword, toNode.thisKeyword), | 10099 _isEqualTokens(node.thisKeyword, toNode.thisKeyword), |
9786 _isEqualTokens(node.period, toNode.period), | 10100 _isEqualTokens(node.period, toNode.period), |
9787 _isEqualNodes(node.identifier, toNode.identifier)); | 10101 _isEqualNodes(node.identifier, toNode.identifier)); |
9788 } | 10102 } |
9789 | 10103 |
9790 @override | 10104 @override |
9791 bool visitForEachStatement(ForEachStatement node) { | 10105 bool visitForEachStatement(ForEachStatement node) { |
9792 ForEachStatement toNode = this._toNode as ForEachStatement; | 10106 ForEachStatement toNode = this._toNode as ForEachStatement; |
9793 return _and(_isEqualTokens(node.forKeyword, toNode.forKeyword), | 10107 return _and( |
| 10108 _isEqualTokens(node.forKeyword, toNode.forKeyword), |
9794 _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), | 10109 _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), |
9795 _isEqualNodes(node.loopVariable, toNode.loopVariable), | 10110 _isEqualNodes(node.loopVariable, toNode.loopVariable), |
9796 _isEqualTokens(node.inKeyword, toNode.inKeyword), | 10111 _isEqualTokens(node.inKeyword, toNode.inKeyword), |
9797 _isEqualNodes(node.iterable, toNode.iterable), | 10112 _isEqualNodes(node.iterable, toNode.iterable), |
9798 _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis), | 10113 _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis), |
9799 _isEqualNodes(node.body, toNode.body)); | 10114 _isEqualNodes(node.body, toNode.body)); |
9800 } | 10115 } |
9801 | 10116 |
9802 @override | 10117 @override |
9803 bool visitFormalParameterList(FormalParameterList node) { | 10118 bool visitFormalParameterList(FormalParameterList node) { |
9804 FormalParameterList toNode = this._toNode as FormalParameterList; | 10119 FormalParameterList toNode = this._toNode as FormalParameterList; |
9805 return _and(_isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), | 10120 return _and( |
| 10121 _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), |
9806 _isEqualNodeLists(node.parameters, toNode.parameters), | 10122 _isEqualNodeLists(node.parameters, toNode.parameters), |
9807 _isEqualTokens(node.leftDelimiter, toNode.leftDelimiter), | 10123 _isEqualTokens(node.leftDelimiter, toNode.leftDelimiter), |
9808 _isEqualTokens(node.rightDelimiter, toNode.rightDelimiter), | 10124 _isEqualTokens(node.rightDelimiter, toNode.rightDelimiter), |
9809 _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis)); | 10125 _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis)); |
9810 } | 10126 } |
9811 | 10127 |
9812 @override | 10128 @override |
9813 bool visitForStatement(ForStatement node) { | 10129 bool visitForStatement(ForStatement node) { |
9814 ForStatement toNode = this._toNode as ForStatement; | 10130 ForStatement toNode = this._toNode as ForStatement; |
9815 return _and(_isEqualTokens(node.forKeyword, toNode.forKeyword), | 10131 return _and( |
| 10132 _isEqualTokens(node.forKeyword, toNode.forKeyword), |
9816 _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), | 10133 _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), |
9817 _isEqualNodes(node.variables, toNode.variables), | 10134 _isEqualNodes(node.variables, toNode.variables), |
9818 _isEqualNodes(node.initialization, toNode.initialization), | 10135 _isEqualNodes(node.initialization, toNode.initialization), |
9819 _isEqualTokens(node.leftSeparator, toNode.leftSeparator), | 10136 _isEqualTokens(node.leftSeparator, toNode.leftSeparator), |
9820 _isEqualNodes(node.condition, toNode.condition), | 10137 _isEqualNodes(node.condition, toNode.condition), |
9821 _isEqualTokens(node.rightSeparator, toNode.rightSeparator), | 10138 _isEqualTokens(node.rightSeparator, toNode.rightSeparator), |
9822 _isEqualNodeLists(node.updaters, toNode.updaters), | 10139 _isEqualNodeLists(node.updaters, toNode.updaters), |
9823 _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis), | 10140 _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis), |
9824 _isEqualNodes(node.body, toNode.body)); | 10141 _isEqualNodes(node.body, toNode.body)); |
9825 } | 10142 } |
(...skipping 75 matching lines...) Loading... |
9901 @override | 10218 @override |
9902 bool visitHideCombinator(HideCombinator node) { | 10219 bool visitHideCombinator(HideCombinator node) { |
9903 HideCombinator toNode = this._toNode as HideCombinator; | 10220 HideCombinator toNode = this._toNode as HideCombinator; |
9904 return _and(_isEqualTokens(node.keyword, toNode.keyword), | 10221 return _and(_isEqualTokens(node.keyword, toNode.keyword), |
9905 _isEqualNodeLists(node.hiddenNames, toNode.hiddenNames)); | 10222 _isEqualNodeLists(node.hiddenNames, toNode.hiddenNames)); |
9906 } | 10223 } |
9907 | 10224 |
9908 @override | 10225 @override |
9909 bool visitIfStatement(IfStatement node) { | 10226 bool visitIfStatement(IfStatement node) { |
9910 IfStatement toNode = this._toNode as IfStatement; | 10227 IfStatement toNode = this._toNode as IfStatement; |
9911 return _and(_isEqualTokens(node.ifKeyword, toNode.ifKeyword), | 10228 return _and( |
| 10229 _isEqualTokens(node.ifKeyword, toNode.ifKeyword), |
9912 _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), | 10230 _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), |
9913 _isEqualNodes(node.condition, toNode.condition), | 10231 _isEqualNodes(node.condition, toNode.condition), |
9914 _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis), | 10232 _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis), |
9915 _isEqualNodes(node.thenStatement, toNode.thenStatement), | 10233 _isEqualNodes(node.thenStatement, toNode.thenStatement), |
9916 _isEqualTokens(node.elseKeyword, toNode.elseKeyword), | 10234 _isEqualTokens(node.elseKeyword, toNode.elseKeyword), |
9917 _isEqualNodes(node.elseStatement, toNode.elseStatement)); | 10235 _isEqualNodes(node.elseStatement, toNode.elseStatement)); |
9918 } | 10236 } |
9919 | 10237 |
9920 @override | 10238 @override |
9921 bool visitImplementsClause(ImplementsClause node) { | 10239 bool visitImplementsClause(ImplementsClause node) { |
(...skipping 17 matching lines...) Loading... |
9939 _isEqualTokens(node.semicolon, toNode.semicolon))) { | 10257 _isEqualTokens(node.semicolon, toNode.semicolon))) { |
9940 toNode.element = node.element; | 10258 toNode.element = node.element; |
9941 return true; | 10259 return true; |
9942 } | 10260 } |
9943 return false; | 10261 return false; |
9944 } | 10262 } |
9945 | 10263 |
9946 @override | 10264 @override |
9947 bool visitIndexExpression(IndexExpression node) { | 10265 bool visitIndexExpression(IndexExpression node) { |
9948 IndexExpression toNode = this._toNode as IndexExpression; | 10266 IndexExpression toNode = this._toNode as IndexExpression; |
9949 if (_and(_isEqualNodes(node.target, toNode.target), | 10267 if (_and( |
| 10268 _isEqualNodes(node.target, toNode.target), |
9950 _isEqualTokens(node.leftBracket, toNode.leftBracket), | 10269 _isEqualTokens(node.leftBracket, toNode.leftBracket), |
9951 _isEqualNodes(node.index, toNode.index), | 10270 _isEqualNodes(node.index, toNode.index), |
9952 _isEqualTokens(node.rightBracket, toNode.rightBracket))) { | 10271 _isEqualTokens(node.rightBracket, toNode.rightBracket))) { |
9953 toNode.auxiliaryElements = node.auxiliaryElements; | 10272 toNode.auxiliaryElements = node.auxiliaryElements; |
9954 toNode.propagatedElement = node.propagatedElement; | 10273 toNode.propagatedElement = node.propagatedElement; |
9955 toNode.propagatedType = node.propagatedType; | 10274 toNode.propagatedType = node.propagatedType; |
9956 toNode.staticElement = node.staticElement; | 10275 toNode.staticElement = node.staticElement; |
9957 toNode.staticType = node.staticType; | 10276 toNode.staticType = node.staticType; |
9958 return true; | 10277 return true; |
9959 } | 10278 } |
9960 return false; | 10279 return false; |
9961 } | 10280 } |
9962 | 10281 |
9963 @override | 10282 @override |
9964 bool visitInstanceCreationExpression(InstanceCreationExpression node) { | 10283 bool visitInstanceCreationExpression(InstanceCreationExpression node) { |
9965 InstanceCreationExpression toNode = | 10284 InstanceCreationExpression toNode = |
9966 this._toNode as InstanceCreationExpression; | 10285 this._toNode as InstanceCreationExpression; |
9967 if (_and(_isEqualTokens(node.keyword, toNode.keyword), | 10286 if (_and( |
| 10287 _isEqualTokens(node.keyword, toNode.keyword), |
9968 _isEqualNodes(node.constructorName, toNode.constructorName), | 10288 _isEqualNodes(node.constructorName, toNode.constructorName), |
9969 _isEqualNodes(node.argumentList, toNode.argumentList))) { | 10289 _isEqualNodes(node.argumentList, toNode.argumentList))) { |
9970 toNode.propagatedType = node.propagatedType; | 10290 toNode.propagatedType = node.propagatedType; |
9971 toNode.staticElement = node.staticElement; | 10291 toNode.staticElement = node.staticElement; |
9972 toNode.staticType = node.staticType; | 10292 toNode.staticType = node.staticType; |
9973 return true; | 10293 return true; |
9974 } | 10294 } |
9975 return false; | 10295 return false; |
9976 } | 10296 } |
9977 | 10297 |
9978 @override | 10298 @override |
9979 bool visitIntegerLiteral(IntegerLiteral node) { | 10299 bool visitIntegerLiteral(IntegerLiteral node) { |
9980 IntegerLiteral toNode = this._toNode as IntegerLiteral; | 10300 IntegerLiteral toNode = this._toNode as IntegerLiteral; |
9981 if (_and(_isEqualTokens(node.literal, toNode.literal), | 10301 if (_and(_isEqualTokens(node.literal, toNode.literal), |
9982 node.value == toNode.value)) { | 10302 node.value == toNode.value)) { |
9983 toNode.propagatedType = node.propagatedType; | 10303 toNode.propagatedType = node.propagatedType; |
9984 toNode.staticType = node.staticType; | 10304 toNode.staticType = node.staticType; |
9985 return true; | 10305 return true; |
9986 } | 10306 } |
9987 return false; | 10307 return false; |
9988 } | 10308 } |
9989 | 10309 |
9990 @override | 10310 @override |
9991 bool visitInterpolationExpression(InterpolationExpression node) { | 10311 bool visitInterpolationExpression(InterpolationExpression node) { |
9992 InterpolationExpression toNode = this._toNode as InterpolationExpression; | 10312 InterpolationExpression toNode = this._toNode as InterpolationExpression; |
9993 return _and(_isEqualTokens(node.leftBracket, toNode.leftBracket), | 10313 return _and( |
| 10314 _isEqualTokens(node.leftBracket, toNode.leftBracket), |
9994 _isEqualNodes(node.expression, toNode.expression), | 10315 _isEqualNodes(node.expression, toNode.expression), |
9995 _isEqualTokens(node.rightBracket, toNode.rightBracket)); | 10316 _isEqualTokens(node.rightBracket, toNode.rightBracket)); |
9996 } | 10317 } |
9997 | 10318 |
9998 @override | 10319 @override |
9999 bool visitInterpolationString(InterpolationString node) { | 10320 bool visitInterpolationString(InterpolationString node) { |
10000 InterpolationString toNode = this._toNode as InterpolationString; | 10321 InterpolationString toNode = this._toNode as InterpolationString; |
10001 return _and(_isEqualTokens(node.contents, toNode.contents), | 10322 return _and(_isEqualTokens(node.contents, toNode.contents), |
10002 node.value == toNode.value); | 10323 node.value == toNode.value); |
10003 } | 10324 } |
10004 | 10325 |
10005 @override | 10326 @override |
10006 bool visitIsExpression(IsExpression node) { | 10327 bool visitIsExpression(IsExpression node) { |
10007 IsExpression toNode = this._toNode as IsExpression; | 10328 IsExpression toNode = this._toNode as IsExpression; |
10008 if (_and(_isEqualNodes(node.expression, toNode.expression), | 10329 if (_and( |
| 10330 _isEqualNodes(node.expression, toNode.expression), |
10009 _isEqualTokens(node.isOperator, toNode.isOperator), | 10331 _isEqualTokens(node.isOperator, toNode.isOperator), |
10010 _isEqualTokens(node.notOperator, toNode.notOperator), | 10332 _isEqualTokens(node.notOperator, toNode.notOperator), |
10011 _isEqualNodes(node.type, toNode.type))) { | 10333 _isEqualNodes(node.type, toNode.type))) { |
10012 toNode.propagatedType = node.propagatedType; | 10334 toNode.propagatedType = node.propagatedType; |
10013 toNode.staticType = node.staticType; | 10335 toNode.staticType = node.staticType; |
10014 return true; | 10336 return true; |
10015 } | 10337 } |
10016 return false; | 10338 return false; |
10017 } | 10339 } |
10018 | 10340 |
10019 @override | 10341 @override |
10020 bool visitLabel(Label node) { | 10342 bool visitLabel(Label node) { |
10021 Label toNode = this._toNode as Label; | 10343 Label toNode = this._toNode as Label; |
10022 return _and(_isEqualNodes(node.label, toNode.label), | 10344 return _and(_isEqualNodes(node.label, toNode.label), |
10023 _isEqualTokens(node.colon, toNode.colon)); | 10345 _isEqualTokens(node.colon, toNode.colon)); |
10024 } | 10346 } |
10025 | 10347 |
10026 @override | 10348 @override |
10027 bool visitLabeledStatement(LabeledStatement node) { | 10349 bool visitLabeledStatement(LabeledStatement node) { |
10028 LabeledStatement toNode = this._toNode as LabeledStatement; | 10350 LabeledStatement toNode = this._toNode as LabeledStatement; |
10029 return _and(_isEqualNodeLists(node.labels, toNode.labels), | 10351 return _and(_isEqualNodeLists(node.labels, toNode.labels), |
10030 _isEqualNodes(node.statement, toNode.statement)); | 10352 _isEqualNodes(node.statement, toNode.statement)); |
10031 } | 10353 } |
10032 | 10354 |
10033 @override | 10355 @override |
10034 bool visitLibraryDirective(LibraryDirective node) { | 10356 bool visitLibraryDirective(LibraryDirective node) { |
10035 LibraryDirective toNode = this._toNode as LibraryDirective; | 10357 LibraryDirective toNode = this._toNode as LibraryDirective; |
10036 return _and( | 10358 if (_and( |
10037 _isEqualNodes(node.documentationComment, toNode.documentationComment), | 10359 _isEqualNodes(node.documentationComment, toNode.documentationComment), |
10038 _isEqualNodeLists(node.metadata, toNode.metadata), | 10360 _isEqualNodeLists(node.metadata, toNode.metadata), |
10039 _isEqualTokens(node.libraryKeyword, toNode.libraryKeyword), | 10361 _isEqualTokens(node.libraryKeyword, toNode.libraryKeyword), |
10040 _isEqualNodes(node.name, toNode.name), | 10362 _isEqualNodes(node.name, toNode.name), |
10041 _isEqualTokens(node.semicolon, toNode.semicolon)); | 10363 _isEqualTokens(node.semicolon, toNode.semicolon))) { |
| 10364 toNode.element = node.element; |
| 10365 return true; |
| 10366 } |
| 10367 return false; |
10042 } | 10368 } |
10043 | 10369 |
10044 @override | 10370 @override |
10045 bool visitLibraryIdentifier(LibraryIdentifier node) { | 10371 bool visitLibraryIdentifier(LibraryIdentifier node) { |
10046 LibraryIdentifier toNode = this._toNode as LibraryIdentifier; | 10372 LibraryIdentifier toNode = this._toNode as LibraryIdentifier; |
10047 if (_isEqualNodeLists(node.components, toNode.components)) { | 10373 if (_isEqualNodeLists(node.components, toNode.components)) { |
10048 toNode.propagatedType = node.propagatedType; | 10374 toNode.propagatedType = node.propagatedType; |
10049 toNode.staticType = node.staticType; | 10375 toNode.staticType = node.staticType; |
10050 return true; | 10376 return true; |
10051 } | 10377 } |
10052 return false; | 10378 return false; |
10053 } | 10379 } |
10054 | 10380 |
10055 @override | 10381 @override |
10056 bool visitListLiteral(ListLiteral node) { | 10382 bool visitListLiteral(ListLiteral node) { |
10057 ListLiteral toNode = this._toNode as ListLiteral; | 10383 ListLiteral toNode = this._toNode as ListLiteral; |
10058 if (_and(_isEqualTokens(node.constKeyword, toNode.constKeyword), | 10384 if (_and( |
| 10385 _isEqualTokens(node.constKeyword, toNode.constKeyword), |
10059 _isEqualNodes(node.typeArguments, toNode.typeArguments), | 10386 _isEqualNodes(node.typeArguments, toNode.typeArguments), |
10060 _isEqualTokens(node.leftBracket, toNode.leftBracket), | 10387 _isEqualTokens(node.leftBracket, toNode.leftBracket), |
10061 _isEqualNodeLists(node.elements, toNode.elements), | 10388 _isEqualNodeLists(node.elements, toNode.elements), |
10062 _isEqualTokens(node.rightBracket, toNode.rightBracket))) { | 10389 _isEqualTokens(node.rightBracket, toNode.rightBracket))) { |
10063 toNode.propagatedType = node.propagatedType; | 10390 toNode.propagatedType = node.propagatedType; |
10064 toNode.staticType = node.staticType; | 10391 toNode.staticType = node.staticType; |
10065 return true; | 10392 return true; |
10066 } | 10393 } |
10067 return false; | 10394 return false; |
10068 } | 10395 } |
10069 | 10396 |
10070 @override | 10397 @override |
10071 bool visitMapLiteral(MapLiteral node) { | 10398 bool visitMapLiteral(MapLiteral node) { |
10072 MapLiteral toNode = this._toNode as MapLiteral; | 10399 MapLiteral toNode = this._toNode as MapLiteral; |
10073 if (_and(_isEqualTokens(node.constKeyword, toNode.constKeyword), | 10400 if (_and( |
| 10401 _isEqualTokens(node.constKeyword, toNode.constKeyword), |
10074 _isEqualNodes(node.typeArguments, toNode.typeArguments), | 10402 _isEqualNodes(node.typeArguments, toNode.typeArguments), |
10075 _isEqualTokens(node.leftBracket, toNode.leftBracket), | 10403 _isEqualTokens(node.leftBracket, toNode.leftBracket), |
10076 _isEqualNodeLists(node.entries, toNode.entries), | 10404 _isEqualNodeLists(node.entries, toNode.entries), |
10077 _isEqualTokens(node.rightBracket, toNode.rightBracket))) { | 10405 _isEqualTokens(node.rightBracket, toNode.rightBracket))) { |
10078 toNode.propagatedType = node.propagatedType; | 10406 toNode.propagatedType = node.propagatedType; |
10079 toNode.staticType = node.staticType; | 10407 toNode.staticType = node.staticType; |
10080 return true; | 10408 return true; |
10081 } | 10409 } |
10082 return false; | 10410 return false; |
10083 } | 10411 } |
10084 | 10412 |
10085 @override | 10413 @override |
10086 bool visitMapLiteralEntry(MapLiteralEntry node) { | 10414 bool visitMapLiteralEntry(MapLiteralEntry node) { |
10087 MapLiteralEntry toNode = this._toNode as MapLiteralEntry; | 10415 MapLiteralEntry toNode = this._toNode as MapLiteralEntry; |
10088 return _and(_isEqualNodes(node.key, toNode.key), | 10416 return _and( |
| 10417 _isEqualNodes(node.key, toNode.key), |
10089 _isEqualTokens(node.separator, toNode.separator), | 10418 _isEqualTokens(node.separator, toNode.separator), |
10090 _isEqualNodes(node.value, toNode.value)); | 10419 _isEqualNodes(node.value, toNode.value)); |
10091 } | 10420 } |
10092 | 10421 |
10093 @override | 10422 @override |
10094 bool visitMethodDeclaration(MethodDeclaration node) { | 10423 bool visitMethodDeclaration(MethodDeclaration node) { |
10095 MethodDeclaration toNode = this._toNode as MethodDeclaration; | 10424 MethodDeclaration toNode = this._toNode as MethodDeclaration; |
10096 return _and( | 10425 return _and( |
10097 _isEqualNodes(node.documentationComment, toNode.documentationComment), | 10426 _isEqualNodes(node.documentationComment, toNode.documentationComment), |
10098 _isEqualNodeLists(node.metadata, toNode.metadata), | 10427 _isEqualNodeLists(node.metadata, toNode.metadata), |
10099 _isEqualTokens(node.externalKeyword, toNode.externalKeyword), | 10428 _isEqualTokens(node.externalKeyword, toNode.externalKeyword), |
10100 _isEqualTokens(node.modifierKeyword, toNode.modifierKeyword), | 10429 _isEqualTokens(node.modifierKeyword, toNode.modifierKeyword), |
10101 _isEqualNodes(node.returnType, toNode.returnType), | 10430 _isEqualNodes(node.returnType, toNode.returnType), |
10102 _isEqualTokens(node.propertyKeyword, toNode.propertyKeyword), | 10431 _isEqualTokens(node.propertyKeyword, toNode.propertyKeyword), |
10103 _isEqualTokens(node.propertyKeyword, toNode.propertyKeyword), | 10432 _isEqualTokens(node.propertyKeyword, toNode.propertyKeyword), |
10104 _isEqualNodes(node.name, toNode.name), | 10433 _isEqualNodes(node.name, toNode.name), |
10105 _isEqualNodes(node.parameters, toNode.parameters), | 10434 _isEqualNodes(node.parameters, toNode.parameters), |
10106 _isEqualNodes(node.body, toNode.body)); | 10435 _isEqualNodes(node.body, toNode.body)); |
10107 } | 10436 } |
10108 | 10437 |
10109 @override | 10438 @override |
10110 bool visitMethodInvocation(MethodInvocation node) { | 10439 bool visitMethodInvocation(MethodInvocation node) { |
10111 MethodInvocation toNode = this._toNode as MethodInvocation; | 10440 MethodInvocation toNode = this._toNode as MethodInvocation; |
10112 if (_and(_isEqualNodes(node.target, toNode.target), | 10441 if (_and( |
| 10442 _isEqualNodes(node.target, toNode.target), |
10113 _isEqualTokens(node.operator, toNode.operator), | 10443 _isEqualTokens(node.operator, toNode.operator), |
10114 _isEqualNodes(node.methodName, toNode.methodName), | 10444 _isEqualNodes(node.methodName, toNode.methodName), |
10115 _isEqualNodes(node.argumentList, toNode.argumentList))) { | 10445 _isEqualNodes(node.argumentList, toNode.argumentList))) { |
10116 toNode.propagatedType = node.propagatedType; | 10446 toNode.propagatedType = node.propagatedType; |
10117 toNode.staticType = node.staticType; | 10447 toNode.staticType = node.staticType; |
10118 return true; | 10448 return true; |
10119 } | 10449 } |
10120 return false; | 10450 return false; |
10121 } | 10451 } |
10122 | 10452 |
(...skipping 12 matching lines...) Loading... |
10135 @override | 10465 @override |
10136 bool visitNativeClause(NativeClause node) { | 10466 bool visitNativeClause(NativeClause node) { |
10137 NativeClause toNode = this._toNode as NativeClause; | 10467 NativeClause toNode = this._toNode as NativeClause; |
10138 return _and(_isEqualTokens(node.nativeKeyword, toNode.nativeKeyword), | 10468 return _and(_isEqualTokens(node.nativeKeyword, toNode.nativeKeyword), |
10139 _isEqualNodes(node.name, toNode.name)); | 10469 _isEqualNodes(node.name, toNode.name)); |
10140 } | 10470 } |
10141 | 10471 |
10142 @override | 10472 @override |
10143 bool visitNativeFunctionBody(NativeFunctionBody node) { | 10473 bool visitNativeFunctionBody(NativeFunctionBody node) { |
10144 NativeFunctionBody toNode = this._toNode as NativeFunctionBody; | 10474 NativeFunctionBody toNode = this._toNode as NativeFunctionBody; |
10145 return _and(_isEqualTokens(node.nativeKeyword, toNode.nativeKeyword), | 10475 return _and( |
| 10476 _isEqualTokens(node.nativeKeyword, toNode.nativeKeyword), |
10146 _isEqualNodes(node.stringLiteral, toNode.stringLiteral), | 10477 _isEqualNodes(node.stringLiteral, toNode.stringLiteral), |
10147 _isEqualTokens(node.semicolon, toNode.semicolon)); | 10478 _isEqualTokens(node.semicolon, toNode.semicolon)); |
10148 } | 10479 } |
10149 | 10480 |
10150 @override | 10481 @override |
10151 bool visitNullLiteral(NullLiteral node) { | 10482 bool visitNullLiteral(NullLiteral node) { |
10152 NullLiteral toNode = this._toNode as NullLiteral; | 10483 NullLiteral toNode = this._toNode as NullLiteral; |
10153 if (_isEqualTokens(node.literal, toNode.literal)) { | 10484 if (_isEqualTokens(node.literal, toNode.literal)) { |
10154 toNode.propagatedType = node.propagatedType; | 10485 toNode.propagatedType = node.propagatedType; |
10155 toNode.staticType = node.staticType; | 10486 toNode.staticType = node.staticType; |
10156 return true; | 10487 return true; |
10157 } | 10488 } |
10158 return false; | 10489 return false; |
10159 } | 10490 } |
10160 | 10491 |
10161 @override | 10492 @override |
10162 bool visitParenthesizedExpression(ParenthesizedExpression node) { | 10493 bool visitParenthesizedExpression(ParenthesizedExpression node) { |
10163 ParenthesizedExpression toNode = this._toNode as ParenthesizedExpression; | 10494 ParenthesizedExpression toNode = this._toNode as ParenthesizedExpression; |
10164 if (_and(_isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), | 10495 if (_and( |
| 10496 _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), |
10165 _isEqualNodes(node.expression, toNode.expression), | 10497 _isEqualNodes(node.expression, toNode.expression), |
10166 _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis))) { | 10498 _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis))) { |
10167 toNode.propagatedType = node.propagatedType; | 10499 toNode.propagatedType = node.propagatedType; |
10168 toNode.staticType = node.staticType; | 10500 toNode.staticType = node.staticType; |
10169 return true; | 10501 return true; |
10170 } | 10502 } |
10171 return false; | 10503 return false; |
10172 } | 10504 } |
10173 | 10505 |
10174 @override | 10506 @override |
(...skipping 37 matching lines...) Loading... |
10212 toNode.staticElement = node.staticElement; | 10544 toNode.staticElement = node.staticElement; |
10213 toNode.staticType = node.staticType; | 10545 toNode.staticType = node.staticType; |
10214 return true; | 10546 return true; |
10215 } | 10547 } |
10216 return false; | 10548 return false; |
10217 } | 10549 } |
10218 | 10550 |
10219 @override | 10551 @override |
10220 bool visitPrefixedIdentifier(PrefixedIdentifier node) { | 10552 bool visitPrefixedIdentifier(PrefixedIdentifier node) { |
10221 PrefixedIdentifier toNode = this._toNode as PrefixedIdentifier; | 10553 PrefixedIdentifier toNode = this._toNode as PrefixedIdentifier; |
10222 if (_and(_isEqualNodes(node.prefix, toNode.prefix), | 10554 if (_and( |
| 10555 _isEqualNodes(node.prefix, toNode.prefix), |
10223 _isEqualTokens(node.period, toNode.period), | 10556 _isEqualTokens(node.period, toNode.period), |
10224 _isEqualNodes(node.identifier, toNode.identifier))) { | 10557 _isEqualNodes(node.identifier, toNode.identifier))) { |
10225 toNode.propagatedType = node.propagatedType; | 10558 toNode.propagatedType = node.propagatedType; |
10226 toNode.staticType = node.staticType; | 10559 toNode.staticType = node.staticType; |
10227 return true; | 10560 return true; |
10228 } | 10561 } |
10229 return false; | 10562 return false; |
10230 } | 10563 } |
10231 | 10564 |
10232 @override | 10565 @override |
10233 bool visitPrefixExpression(PrefixExpression node) { | 10566 bool visitPrefixExpression(PrefixExpression node) { |
10234 PrefixExpression toNode = this._toNode as PrefixExpression; | 10567 PrefixExpression toNode = this._toNode as PrefixExpression; |
10235 if (_and(_isEqualTokens(node.operator, toNode.operator), | 10568 if (_and(_isEqualTokens(node.operator, toNode.operator), |
10236 _isEqualNodes(node.operand, toNode.operand))) { | 10569 _isEqualNodes(node.operand, toNode.operand))) { |
10237 toNode.propagatedElement = node.propagatedElement; | 10570 toNode.propagatedElement = node.propagatedElement; |
10238 toNode.propagatedType = node.propagatedType; | 10571 toNode.propagatedType = node.propagatedType; |
10239 toNode.staticElement = node.staticElement; | 10572 toNode.staticElement = node.staticElement; |
10240 toNode.staticType = node.staticType; | 10573 toNode.staticType = node.staticType; |
10241 return true; | 10574 return true; |
10242 } | 10575 } |
10243 return false; | 10576 return false; |
10244 } | 10577 } |
10245 | 10578 |
10246 @override | 10579 @override |
10247 bool visitPropertyAccess(PropertyAccess node) { | 10580 bool visitPropertyAccess(PropertyAccess node) { |
10248 PropertyAccess toNode = this._toNode as PropertyAccess; | 10581 PropertyAccess toNode = this._toNode as PropertyAccess; |
10249 if (_and(_isEqualNodes(node.target, toNode.target), | 10582 if (_and( |
| 10583 _isEqualNodes(node.target, toNode.target), |
10250 _isEqualTokens(node.operator, toNode.operator), | 10584 _isEqualTokens(node.operator, toNode.operator), |
10251 _isEqualNodes(node.propertyName, toNode.propertyName))) { | 10585 _isEqualNodes(node.propertyName, toNode.propertyName))) { |
10252 toNode.propagatedType = node.propagatedType; | 10586 toNode.propagatedType = node.propagatedType; |
10253 toNode.staticType = node.staticType; | 10587 toNode.staticType = node.staticType; |
10254 return true; | 10588 return true; |
10255 } | 10589 } |
10256 return false; | 10590 return false; |
10257 } | 10591 } |
10258 | 10592 |
10259 @override | 10593 @override |
10260 bool visitRedirectingConstructorInvocation( | 10594 bool visitRedirectingConstructorInvocation( |
10261 RedirectingConstructorInvocation node) { | 10595 RedirectingConstructorInvocation node) { |
10262 RedirectingConstructorInvocation toNode = | 10596 RedirectingConstructorInvocation toNode = |
10263 this._toNode as RedirectingConstructorInvocation; | 10597 this._toNode as RedirectingConstructorInvocation; |
10264 if (_and(_isEqualTokens(node.thisKeyword, toNode.thisKeyword), | 10598 if (_and( |
| 10599 _isEqualTokens(node.thisKeyword, toNode.thisKeyword), |
10265 _isEqualTokens(node.period, toNode.period), | 10600 _isEqualTokens(node.period, toNode.period), |
10266 _isEqualNodes(node.constructorName, toNode.constructorName), | 10601 _isEqualNodes(node.constructorName, toNode.constructorName), |
10267 _isEqualNodes(node.argumentList, toNode.argumentList))) { | 10602 _isEqualNodes(node.argumentList, toNode.argumentList))) { |
10268 toNode.staticElement = node.staticElement; | 10603 toNode.staticElement = node.staticElement; |
10269 return true; | 10604 return true; |
10270 } | 10605 } |
10271 return false; | 10606 return false; |
10272 } | 10607 } |
10273 | 10608 |
10274 @override | 10609 @override |
10275 bool visitRethrowExpression(RethrowExpression node) { | 10610 bool visitRethrowExpression(RethrowExpression node) { |
10276 RethrowExpression toNode = this._toNode as RethrowExpression; | 10611 RethrowExpression toNode = this._toNode as RethrowExpression; |
10277 if (_isEqualTokens(node.rethrowKeyword, toNode.rethrowKeyword)) { | 10612 if (_isEqualTokens(node.rethrowKeyword, toNode.rethrowKeyword)) { |
10278 toNode.propagatedType = node.propagatedType; | 10613 toNode.propagatedType = node.propagatedType; |
10279 toNode.staticType = node.staticType; | 10614 toNode.staticType = node.staticType; |
10280 return true; | 10615 return true; |
10281 } | 10616 } |
10282 return false; | 10617 return false; |
10283 } | 10618 } |
10284 | 10619 |
10285 @override | 10620 @override |
10286 bool visitReturnStatement(ReturnStatement node) { | 10621 bool visitReturnStatement(ReturnStatement node) { |
10287 ReturnStatement toNode = this._toNode as ReturnStatement; | 10622 ReturnStatement toNode = this._toNode as ReturnStatement; |
10288 return _and(_isEqualTokens(node.returnKeyword, toNode.returnKeyword), | 10623 return _and( |
| 10624 _isEqualTokens(node.returnKeyword, toNode.returnKeyword), |
10289 _isEqualNodes(node.expression, toNode.expression), | 10625 _isEqualNodes(node.expression, toNode.expression), |
10290 _isEqualTokens(node.semicolon, toNode.semicolon)); | 10626 _isEqualTokens(node.semicolon, toNode.semicolon)); |
10291 } | 10627 } |
10292 | 10628 |
10293 @override | 10629 @override |
10294 bool visitScriptTag(ScriptTag node) { | 10630 bool visitScriptTag(ScriptTag node) { |
10295 ScriptTag toNode = this._toNode as ScriptTag; | 10631 ScriptTag toNode = this._toNode as ScriptTag; |
10296 return _isEqualTokens(node.scriptTag, toNode.scriptTag); | 10632 return _isEqualTokens(node.scriptTag, toNode.scriptTag); |
10297 } | 10633 } |
10298 | 10634 |
(...skipping 49 matching lines...) Loading... |
10348 toNode.staticType = node.staticType; | 10684 toNode.staticType = node.staticType; |
10349 return true; | 10685 return true; |
10350 } | 10686 } |
10351 return false; | 10687 return false; |
10352 } | 10688 } |
10353 | 10689 |
10354 @override | 10690 @override |
10355 bool visitSuperConstructorInvocation(SuperConstructorInvocation node) { | 10691 bool visitSuperConstructorInvocation(SuperConstructorInvocation node) { |
10356 SuperConstructorInvocation toNode = | 10692 SuperConstructorInvocation toNode = |
10357 this._toNode as SuperConstructorInvocation; | 10693 this._toNode as SuperConstructorInvocation; |
10358 if (_and(_isEqualTokens(node.superKeyword, toNode.superKeyword), | 10694 if (_and( |
| 10695 _isEqualTokens(node.superKeyword, toNode.superKeyword), |
10359 _isEqualTokens(node.period, toNode.period), | 10696 _isEqualTokens(node.period, toNode.period), |
10360 _isEqualNodes(node.constructorName, toNode.constructorName), | 10697 _isEqualNodes(node.constructorName, toNode.constructorName), |
10361 _isEqualNodes(node.argumentList, toNode.argumentList))) { | 10698 _isEqualNodes(node.argumentList, toNode.argumentList))) { |
10362 toNode.staticElement = node.staticElement; | 10699 toNode.staticElement = node.staticElement; |
10363 return true; | 10700 return true; |
10364 } | 10701 } |
10365 return false; | 10702 return false; |
10366 } | 10703 } |
10367 | 10704 |
10368 @override | 10705 @override |
10369 bool visitSuperExpression(SuperExpression node) { | 10706 bool visitSuperExpression(SuperExpression node) { |
10370 SuperExpression toNode = this._toNode as SuperExpression; | 10707 SuperExpression toNode = this._toNode as SuperExpression; |
10371 if (_isEqualTokens(node.superKeyword, toNode.superKeyword)) { | 10708 if (_isEqualTokens(node.superKeyword, toNode.superKeyword)) { |
10372 toNode.propagatedType = node.propagatedType; | 10709 toNode.propagatedType = node.propagatedType; |
10373 toNode.staticType = node.staticType; | 10710 toNode.staticType = node.staticType; |
10374 return true; | 10711 return true; |
10375 } | 10712 } |
10376 return false; | 10713 return false; |
10377 } | 10714 } |
10378 | 10715 |
10379 @override | 10716 @override |
10380 bool visitSwitchCase(SwitchCase node) { | 10717 bool visitSwitchCase(SwitchCase node) { |
10381 SwitchCase toNode = this._toNode as SwitchCase; | 10718 SwitchCase toNode = this._toNode as SwitchCase; |
10382 return _and(_isEqualNodeLists(node.labels, toNode.labels), | 10719 return _and( |
| 10720 _isEqualNodeLists(node.labels, toNode.labels), |
10383 _isEqualTokens(node.keyword, toNode.keyword), | 10721 _isEqualTokens(node.keyword, toNode.keyword), |
10384 _isEqualNodes(node.expression, toNode.expression), | 10722 _isEqualNodes(node.expression, toNode.expression), |
10385 _isEqualTokens(node.colon, toNode.colon), | 10723 _isEqualTokens(node.colon, toNode.colon), |
10386 _isEqualNodeLists(node.statements, toNode.statements)); | 10724 _isEqualNodeLists(node.statements, toNode.statements)); |
10387 } | 10725 } |
10388 | 10726 |
10389 @override | 10727 @override |
10390 bool visitSwitchDefault(SwitchDefault node) { | 10728 bool visitSwitchDefault(SwitchDefault node) { |
10391 SwitchDefault toNode = this._toNode as SwitchDefault; | 10729 SwitchDefault toNode = this._toNode as SwitchDefault; |
10392 return _and(_isEqualNodeLists(node.labels, toNode.labels), | 10730 return _and( |
| 10731 _isEqualNodeLists(node.labels, toNode.labels), |
10393 _isEqualTokens(node.keyword, toNode.keyword), | 10732 _isEqualTokens(node.keyword, toNode.keyword), |
10394 _isEqualTokens(node.colon, toNode.colon), | 10733 _isEqualTokens(node.colon, toNode.colon), |
10395 _isEqualNodeLists(node.statements, toNode.statements)); | 10734 _isEqualNodeLists(node.statements, toNode.statements)); |
10396 } | 10735 } |
10397 | 10736 |
10398 @override | 10737 @override |
10399 bool visitSwitchStatement(SwitchStatement node) { | 10738 bool visitSwitchStatement(SwitchStatement node) { |
10400 SwitchStatement toNode = this._toNode as SwitchStatement; | 10739 SwitchStatement toNode = this._toNode as SwitchStatement; |
10401 return _and(_isEqualTokens(node.switchKeyword, toNode.switchKeyword), | 10740 return _and( |
| 10741 _isEqualTokens(node.switchKeyword, toNode.switchKeyword), |
10402 _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), | 10742 _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), |
10403 _isEqualNodes(node.expression, toNode.expression), | 10743 _isEqualNodes(node.expression, toNode.expression), |
10404 _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis), | 10744 _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis), |
10405 _isEqualTokens(node.leftBracket, toNode.leftBracket), | 10745 _isEqualTokens(node.leftBracket, toNode.leftBracket), |
10406 _isEqualNodeLists(node.members, toNode.members), | 10746 _isEqualNodeLists(node.members, toNode.members), |
10407 _isEqualTokens(node.rightBracket, toNode.rightBracket)); | 10747 _isEqualTokens(node.rightBracket, toNode.rightBracket)); |
10408 } | 10748 } |
10409 | 10749 |
10410 @override | 10750 @override |
10411 bool visitSymbolLiteral(SymbolLiteral node) { | 10751 bool visitSymbolLiteral(SymbolLiteral node) { |
(...skipping 37 matching lines...) Loading... |
10449 return _and( | 10789 return _and( |
10450 _isEqualNodes(node.documentationComment, toNode.documentationComment), | 10790 _isEqualNodes(node.documentationComment, toNode.documentationComment), |
10451 _isEqualNodeLists(node.metadata, toNode.metadata), | 10791 _isEqualNodeLists(node.metadata, toNode.metadata), |
10452 _isEqualNodes(node.variables, toNode.variables), | 10792 _isEqualNodes(node.variables, toNode.variables), |
10453 _isEqualTokens(node.semicolon, toNode.semicolon)); | 10793 _isEqualTokens(node.semicolon, toNode.semicolon)); |
10454 } | 10794 } |
10455 | 10795 |
10456 @override | 10796 @override |
10457 bool visitTryStatement(TryStatement node) { | 10797 bool visitTryStatement(TryStatement node) { |
10458 TryStatement toNode = this._toNode as TryStatement; | 10798 TryStatement toNode = this._toNode as TryStatement; |
10459 return _and(_isEqualTokens(node.tryKeyword, toNode.tryKeyword), | 10799 return _and( |
| 10800 _isEqualTokens(node.tryKeyword, toNode.tryKeyword), |
10460 _isEqualNodes(node.body, toNode.body), | 10801 _isEqualNodes(node.body, toNode.body), |
10461 _isEqualNodeLists(node.catchClauses, toNode.catchClauses), | 10802 _isEqualNodeLists(node.catchClauses, toNode.catchClauses), |
10462 _isEqualTokens(node.finallyKeyword, toNode.finallyKeyword), | 10803 _isEqualTokens(node.finallyKeyword, toNode.finallyKeyword), |
10463 _isEqualNodes(node.finallyBlock, toNode.finallyBlock)); | 10804 _isEqualNodes(node.finallyBlock, toNode.finallyBlock)); |
10464 } | 10805 } |
10465 | 10806 |
10466 @override | 10807 @override |
10467 bool visitTypeArgumentList(TypeArgumentList node) { | 10808 bool visitTypeArgumentList(TypeArgumentList node) { |
10468 TypeArgumentList toNode = this._toNode as TypeArgumentList; | 10809 TypeArgumentList toNode = this._toNode as TypeArgumentList; |
10469 return _and(_isEqualTokens(node.leftBracket, toNode.leftBracket), | 10810 return _and( |
| 10811 _isEqualTokens(node.leftBracket, toNode.leftBracket), |
10470 _isEqualNodeLists(node.arguments, toNode.arguments), | 10812 _isEqualNodeLists(node.arguments, toNode.arguments), |
10471 _isEqualTokens(node.rightBracket, toNode.rightBracket)); | 10813 _isEqualTokens(node.rightBracket, toNode.rightBracket)); |
10472 } | 10814 } |
10473 | 10815 |
10474 @override | 10816 @override |
10475 bool visitTypeName(TypeName node) { | 10817 bool visitTypeName(TypeName node) { |
10476 TypeName toNode = this._toNode as TypeName; | 10818 TypeName toNode = this._toNode as TypeName; |
10477 if (_and(_isEqualNodes(node.name, toNode.name), | 10819 if (_and(_isEqualNodes(node.name, toNode.name), |
10478 _isEqualNodes(node.typeArguments, toNode.typeArguments))) { | 10820 _isEqualNodes(node.typeArguments, toNode.typeArguments))) { |
10479 toNode.type = node.type; | 10821 toNode.type = node.type; |
10480 return true; | 10822 return true; |
10481 } | 10823 } |
10482 return false; | 10824 return false; |
10483 } | 10825 } |
10484 | 10826 |
10485 @override | 10827 @override |
10486 bool visitTypeParameter(TypeParameter node) { | 10828 bool visitTypeParameter(TypeParameter node) { |
10487 TypeParameter toNode = this._toNode as TypeParameter; | 10829 TypeParameter toNode = this._toNode as TypeParameter; |
10488 return _and( | 10830 return _and( |
10489 _isEqualNodes(node.documentationComment, toNode.documentationComment), | 10831 _isEqualNodes(node.documentationComment, toNode.documentationComment), |
10490 _isEqualNodeLists(node.metadata, toNode.metadata), | 10832 _isEqualNodeLists(node.metadata, toNode.metadata), |
10491 _isEqualNodes(node.name, toNode.name), | 10833 _isEqualNodes(node.name, toNode.name), |
10492 _isEqualTokens(node.extendsKeyword, toNode.extendsKeyword), | 10834 _isEqualTokens(node.extendsKeyword, toNode.extendsKeyword), |
10493 _isEqualNodes(node.bound, toNode.bound)); | 10835 _isEqualNodes(node.bound, toNode.bound)); |
10494 } | 10836 } |
10495 | 10837 |
10496 @override | 10838 @override |
10497 bool visitTypeParameterList(TypeParameterList node) { | 10839 bool visitTypeParameterList(TypeParameterList node) { |
10498 TypeParameterList toNode = this._toNode as TypeParameterList; | 10840 TypeParameterList toNode = this._toNode as TypeParameterList; |
10499 return _and(_isEqualTokens(node.leftBracket, toNode.leftBracket), | 10841 return _and( |
| 10842 _isEqualTokens(node.leftBracket, toNode.leftBracket), |
10500 _isEqualNodeLists(node.typeParameters, toNode.typeParameters), | 10843 _isEqualNodeLists(node.typeParameters, toNode.typeParameters), |
10501 _isEqualTokens(node.rightBracket, toNode.rightBracket)); | 10844 _isEqualTokens(node.rightBracket, toNode.rightBracket)); |
10502 } | 10845 } |
10503 | 10846 |
10504 @override | 10847 @override |
10505 bool visitVariableDeclaration(VariableDeclaration node) { | 10848 bool visitVariableDeclaration(VariableDeclaration node) { |
10506 VariableDeclaration toNode = this._toNode as VariableDeclaration; | 10849 VariableDeclaration toNode = this._toNode as VariableDeclaration; |
10507 return _and( | 10850 return _and( |
10508 _isEqualNodes(node.documentationComment, toNode.documentationComment), | 10851 _isEqualNodes(node.documentationComment, toNode.documentationComment), |
10509 _isEqualNodeLists(node.metadata, toNode.metadata), | 10852 _isEqualNodeLists(node.metadata, toNode.metadata), |
(...skipping 17 matching lines...) Loading... |
10527 bool visitVariableDeclarationStatement(VariableDeclarationStatement node) { | 10870 bool visitVariableDeclarationStatement(VariableDeclarationStatement node) { |
10528 VariableDeclarationStatement toNode = | 10871 VariableDeclarationStatement toNode = |
10529 this._toNode as VariableDeclarationStatement; | 10872 this._toNode as VariableDeclarationStatement; |
10530 return _and(_isEqualNodes(node.variables, toNode.variables), | 10873 return _and(_isEqualNodes(node.variables, toNode.variables), |
10531 _isEqualTokens(node.semicolon, toNode.semicolon)); | 10874 _isEqualTokens(node.semicolon, toNode.semicolon)); |
10532 } | 10875 } |
10533 | 10876 |
10534 @override | 10877 @override |
10535 bool visitWhileStatement(WhileStatement node) { | 10878 bool visitWhileStatement(WhileStatement node) { |
10536 WhileStatement toNode = this._toNode as WhileStatement; | 10879 WhileStatement toNode = this._toNode as WhileStatement; |
10537 return _and(_isEqualTokens(node.whileKeyword, toNode.whileKeyword), | 10880 return _and( |
| 10881 _isEqualTokens(node.whileKeyword, toNode.whileKeyword), |
10538 _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), | 10882 _isEqualTokens(node.leftParenthesis, toNode.leftParenthesis), |
10539 _isEqualNodes(node.condition, toNode.condition), | 10883 _isEqualNodes(node.condition, toNode.condition), |
10540 _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis), | 10884 _isEqualTokens(node.rightParenthesis, toNode.rightParenthesis), |
10541 _isEqualNodes(node.body, toNode.body)); | 10885 _isEqualNodes(node.body, toNode.body)); |
10542 } | 10886 } |
10543 | 10887 |
10544 @override | 10888 @override |
10545 bool visitWithClause(WithClause node) { | 10889 bool visitWithClause(WithClause node) { |
10546 WithClause toNode = this._toNode as WithClause; | 10890 WithClause toNode = this._toNode as WithClause; |
10547 return _and(_isEqualTokens(node.withKeyword, toNode.withKeyword), | 10891 return _and(_isEqualTokens(node.withKeyword, toNode.withKeyword), |
10548 _isEqualNodeLists(node.mixinTypes, toNode.mixinTypes)); | 10892 _isEqualNodeLists(node.mixinTypes, toNode.mixinTypes)); |
10549 } | 10893 } |
10550 | 10894 |
10551 @override | 10895 @override |
10552 bool visitYieldStatement(YieldStatement node) { | 10896 bool visitYieldStatement(YieldStatement node) { |
10553 YieldStatement toNode = this._toNode as YieldStatement; | 10897 YieldStatement toNode = this._toNode as YieldStatement; |
10554 return _and(_isEqualTokens(node.yieldKeyword, toNode.yieldKeyword), | 10898 return _and( |
| 10899 _isEqualTokens(node.yieldKeyword, toNode.yieldKeyword), |
10555 _isEqualNodes(node.expression, toNode.expression), | 10900 _isEqualNodes(node.expression, toNode.expression), |
10556 _isEqualTokens(node.semicolon, toNode.semicolon)); | 10901 _isEqualTokens(node.semicolon, toNode.semicolon)); |
10557 } | 10902 } |
10558 | 10903 |
10559 /** | 10904 /** |
10560 * Return `true` if all of the parameters are `true`. | 10905 * Return `true` if all of the parameters are `true`. |
10561 */ | 10906 */ |
10562 bool _and(bool b1, bool b2, [bool b3 = true, bool b4 = true, bool b5 = true, | 10907 bool _and(bool b1, bool b2, |
10563 bool b6 = true, bool b7 = true, bool b8 = true, bool b9 = true, | 10908 [bool b3 = true, |
10564 bool b10 = true, bool b11 = true, bool b12 = true, bool b13 = true]) { | 10909 bool b4 = true, |
| 10910 bool b5 = true, |
| 10911 bool b6 = true, |
| 10912 bool b7 = true, |
| 10913 bool b8 = true, |
| 10914 bool b9 = true, |
| 10915 bool b10 = true, |
| 10916 bool b11 = true, |
| 10917 bool b12 = true, |
| 10918 bool b13 = true]) { |
10565 // TODO(brianwilkerson) Inline this method. | 10919 // TODO(brianwilkerson) Inline this method. |
10566 return b1 && | 10920 return b1 && |
10567 b2 && | 10921 b2 && |
10568 b3 && | 10922 b3 && |
10569 b4 && | 10923 b4 && |
10570 b5 && | 10924 b5 && |
10571 b6 && | 10925 b6 && |
10572 b7 && | 10926 b7 && |
10573 b8 && | 10927 b8 && |
10574 b9 && | 10928 b9 && |
(...skipping 89 matching lines...) Loading... |
10664 } | 11018 } |
10665 | 11019 |
10666 /** | 11020 /** |
10667 * Copy resolution data from the [fromNode] to the [toNode]. | 11021 * Copy resolution data from the [fromNode] to the [toNode]. |
10668 */ | 11022 */ |
10669 static void copyResolutionData(AstNode fromNode, AstNode toNode) { | 11023 static void copyResolutionData(AstNode fromNode, AstNode toNode) { |
10670 ResolutionCopier copier = new ResolutionCopier(); | 11024 ResolutionCopier copier = new ResolutionCopier(); |
10671 copier._isEqualNodes(fromNode, toNode); | 11025 copier._isEqualNodes(fromNode, toNode); |
10672 } | 11026 } |
10673 } | 11027 } |
OLD | NEW |