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

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

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

Powered by Google App Engine
This is Rietveld 408576698