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