OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #ifndef VM_PARSER_H_ | 5 #ifndef VM_PARSER_H_ |
6 #define VM_PARSER_H_ | 6 #define VM_PARSER_H_ |
7 | 7 |
8 #include "include/dart_api.h" | 8 #include "include/dart_api.h" |
9 | 9 |
10 #include "platform/assert.h" | 10 #include "platform/assert.h" |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 kParameterEntrySize, | 226 kParameterEntrySize, |
227 }; | 227 }; |
228 static RawObject* ParseFunctionParameters(const Function& func); | 228 static RawObject* ParseFunctionParameters(const Function& func); |
229 | 229 |
230 private: | 230 private: |
231 friend class EffectGraphVisitor; // For BuildNoSuchMethodArguments. | 231 friend class EffectGraphVisitor; // For BuildNoSuchMethodArguments. |
232 | 232 |
233 struct Block; | 233 struct Block; |
234 class TryStack; | 234 class TryStack; |
235 | 235 |
236 Parser(const Script& script, const Library& library, intptr_t token_pos); | 236 Parser(const Script& script, |
237 Parser(const Script& script, ParsedFunction* function, intptr_t token_pos); | 237 const Library& library, |
| 238 TokenDescriptor token_pos); |
| 239 Parser(const Script& script, |
| 240 ParsedFunction* function, |
| 241 TokenDescriptor token_pos); |
238 ~Parser(); | 242 ~Parser(); |
239 | 243 |
240 // The function for which we will generate code. | 244 // The function for which we will generate code. |
241 const Function& current_function() const; | 245 const Function& current_function() const; |
242 | 246 |
243 // The innermost function being parsed. | 247 // The innermost function being parsed. |
244 const Function& innermost_function() const; | 248 const Function& innermost_function() const; |
245 | 249 |
246 // Note that a local function may be parsed multiple times. It is first parsed | 250 // Note that a local function may be parsed multiple times. It is first parsed |
247 // when its outermost enclosing function is being parsed. It is then parsed | 251 // when its outermost enclosing function is being parsed. It is then parsed |
(...skipping 19 matching lines...) Expand all Loading... |
267 // The class being parsed. | 271 // The class being parsed. |
268 const Class& current_class() const; | 272 const Class& current_class() const; |
269 void set_current_class(const Class& value); | 273 void set_current_class(const Class& value); |
270 | 274 |
271 // ParsedFunction accessor. | 275 // ParsedFunction accessor. |
272 ParsedFunction* parsed_function() const { | 276 ParsedFunction* parsed_function() const { |
273 return parsed_function_; | 277 return parsed_function_; |
274 } | 278 } |
275 | 279 |
276 const Script& script() const { return script_; } | 280 const Script& script() const { return script_; } |
277 void SetScript(const Script& script, intptr_t token_pos); | 281 void SetScript(const Script& script, TokenDescriptor token_pos); |
278 | 282 |
279 const Library& library() const { return library_; } | 283 const Library& library() const { return library_; } |
280 void set_library(const Library& value) const { library_ = value.raw(); } | 284 void set_library(const Library& value) const { library_ = value.raw(); } |
281 | 285 |
282 // Parsing a library or a regular source script. | 286 // Parsing a library or a regular source script. |
283 bool is_library_source() const { | 287 bool is_library_source() const { |
284 return (script_.kind() == RawScript::kScriptTag) || | 288 return (script_.kind() == RawScript::kScriptTag) || |
285 (script_.kind() == RawScript::kLibraryTag); | 289 (script_.kind() == RawScript::kLibraryTag); |
286 } | 290 } |
287 | 291 |
288 bool is_part_source() const { | 292 bool is_part_source() const { |
289 return script_.kind() == RawScript::kSourceTag; | 293 return script_.kind() == RawScript::kSourceTag; |
290 } | 294 } |
291 | 295 |
292 // Parsing library patch script. | 296 // Parsing library patch script. |
293 bool is_patch_source() const { | 297 bool is_patch_source() const { |
294 return script_.kind() == RawScript::kPatchTag; | 298 return script_.kind() == RawScript::kPatchTag; |
295 } | 299 } |
296 | 300 |
297 intptr_t TokenPos() const { return tokens_iterator_.CurrentPosition(); } | 301 TokenDescriptor TokenPos() const { |
298 intptr_t PrevTokenPos() const { return prev_token_pos_; } | 302 return TokenDescriptor(tokens_iterator_.CurrentPosition()); |
| 303 } |
| 304 TokenDescriptor PrevTokenPos() const { return prev_token_pos_; } |
299 | 305 |
300 Token::Kind CurrentToken() { | 306 Token::Kind CurrentToken() { |
301 if (token_kind_ == Token::kILLEGAL) { | 307 if (token_kind_ == Token::kILLEGAL) { |
302 ComputeCurrentToken(); | 308 ComputeCurrentToken(); |
303 } | 309 } |
304 return token_kind_; | 310 return token_kind_; |
305 } | 311 } |
306 | 312 |
307 void ComputeCurrentToken(); | 313 void ComputeCurrentToken(); |
308 | 314 |
309 RawLibraryPrefix* ParsePrefix(); | 315 RawLibraryPrefix* ParsePrefix(); |
310 | 316 |
311 Token::Kind LookaheadToken(int num_tokens); | 317 Token::Kind LookaheadToken(int num_tokens); |
312 String* CurrentLiteral() const; | 318 String* CurrentLiteral() const; |
313 RawDouble* CurrentDoubleLiteral() const; | 319 RawDouble* CurrentDoubleLiteral() const; |
314 RawInteger* CurrentIntegerLiteral() const; | 320 RawInteger* CurrentIntegerLiteral() const; |
315 | 321 |
316 // Sets parser to given token position in the stream. | 322 // Sets parser to given token position in the stream. |
317 void SetPosition(intptr_t position); | 323 void SetPosition(intptr_t position); |
| 324 void SetPosition(TokenDescriptor position); |
318 | 325 |
319 void ConsumeToken() { | 326 void ConsumeToken() { |
320 // Reset cache and advance the token. | 327 // Reset cache and advance the token. |
321 prev_token_pos_ = tokens_iterator_.CurrentPosition(); | 328 prev_token_pos_ = TokenDescriptor(tokens_iterator_.CurrentPosition()); |
322 token_kind_ = Token::kILLEGAL; | 329 token_kind_ = Token::kILLEGAL; |
323 tokens_iterator_.Advance(); | 330 tokens_iterator_.Advance(); |
324 INC_STAT(thread(), num_tokens_consumed, 1); | 331 INC_STAT(thread(), num_tokens_consumed, 1); |
325 } | 332 } |
326 void ConsumeRightAngleBracket(); | 333 void ConsumeRightAngleBracket(); |
327 void CheckToken(Token::Kind token_expected, const char* msg = NULL); | 334 void CheckToken(Token::Kind token_expected, const char* msg = NULL); |
328 void ExpectToken(Token::Kind token_expected); | 335 void ExpectToken(Token::Kind token_expected); |
329 void ExpectSemicolon(); | 336 void ExpectSemicolon(); |
330 void UnexpectedToken(); | 337 void UnexpectedToken(); |
331 String* ExpectUserDefinedTypeIdentifier(const char* msg); | 338 String* ExpectUserDefinedTypeIdentifier(const char* msg); |
332 String* ExpectIdentifier(const char* msg); | 339 String* ExpectIdentifier(const char* msg); |
333 bool IsAwaitKeyword(); | 340 bool IsAwaitKeyword(); |
334 bool IsYieldKeyword(); | 341 bool IsYieldKeyword(); |
335 | 342 |
336 void SkipIf(Token::Kind); | 343 void SkipIf(Token::Kind); |
337 void SkipToMatching(); | 344 void SkipToMatching(); |
338 void SkipToMatchingParenthesis(); | 345 void SkipToMatchingParenthesis(); |
339 void SkipBlock(); | 346 void SkipBlock(); |
340 intptr_t SkipMetadata(); | 347 TokenDescriptor SkipMetadata(); |
341 void SkipTypeArguments(); | 348 void SkipTypeArguments(); |
342 void SkipType(bool allow_void); | 349 void SkipType(bool allow_void); |
343 void SkipInitializers(); | 350 void SkipInitializers(); |
344 void SkipExpr(); | 351 void SkipExpr(); |
345 void SkipNestedExpr(); | 352 void SkipNestedExpr(); |
346 void SkipConditionalExpr(); | 353 void SkipConditionalExpr(); |
347 void SkipBinaryExpr(); | 354 void SkipBinaryExpr(); |
348 void SkipUnaryExpr(); | 355 void SkipUnaryExpr(); |
349 void SkipPostfixExpr(); | 356 void SkipPostfixExpr(); |
350 void SkipSelectors(); | 357 void SkipSelectors(); |
351 void SkipPrimary(); | 358 void SkipPrimary(); |
352 void SkipCompoundLiteral(); | 359 void SkipCompoundLiteral(); |
353 void SkipSymbolLiteral(); | 360 void SkipSymbolLiteral(); |
354 void SkipNewOperator(); | 361 void SkipNewOperator(); |
355 void SkipActualParameters(); | 362 void SkipActualParameters(); |
356 void SkipMapLiteral(); | 363 void SkipMapLiteral(); |
357 void SkipListLiteral(); | 364 void SkipListLiteral(); |
358 void SkipFunctionLiteral(); | 365 void SkipFunctionLiteral(); |
359 void SkipStringLiteral(); | 366 void SkipStringLiteral(); |
360 void SkipQualIdent(); | 367 void SkipQualIdent(); |
361 void SkipFunctionPreamble(); | 368 void SkipFunctionPreamble(); |
362 | 369 |
363 AstNode* DartPrint(const char* str); | 370 AstNode* DartPrint(const char* str); |
364 | 371 |
365 void CheckConstructorCallTypeArguments(intptr_t pos, | 372 void CheckConstructorCallTypeArguments(TokenDescriptor pos, |
366 const Function& constructor, | 373 const Function& constructor, |
367 const TypeArguments& type_arguments); | 374 const TypeArguments& type_arguments); |
368 | 375 |
369 // Report error if parsed code is too deeply nested; avoid stack overflow. | 376 // Report error if parsed code is too deeply nested; avoid stack overflow. |
370 void CheckStack(); | 377 void CheckStack(); |
371 | 378 |
372 // Report already formatted error. | 379 // Report already formatted error. |
373 static void ReportError(const Error& error); | 380 static void ReportError(const Error& error); |
374 | 381 |
375 // Concatenate and report an already formatted error and a new error message. | 382 // Concatenate and report an already formatted error and a new error message. |
376 static void ReportErrors(const Error& prev_error, | 383 static void ReportErrors(const Error& prev_error, |
377 const Script& script, intptr_t token_pos, | 384 const Script& script, TokenDescriptor token_pos, |
378 const char* format, ...) PRINTF_ATTRIBUTE(4, 5); | 385 const char* format, ...) PRINTF_ATTRIBUTE(4, 5); |
379 | 386 |
380 // Report error message at location of current token in current script. | 387 // Report error message at location of current token in current script. |
381 void ReportError(const char* msg, ...) const PRINTF_ATTRIBUTE(2, 3); | 388 void ReportError(const char* msg, ...) const PRINTF_ATTRIBUTE(2, 3); |
382 | 389 |
383 void ReportErrorBefore(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); | 390 void ReportErrorBefore(const char* format, ...) PRINTF_ATTRIBUTE(2, 3); |
384 | 391 |
385 // Report error message at given location in current script. | 392 // Report error message at given location in current script. |
386 void ReportError(intptr_t token_pos, | 393 void ReportError(TokenDescriptor token_pos, |
387 const char* msg, ...) const PRINTF_ATTRIBUTE(3, 4); | 394 const char* msg, ...) const PRINTF_ATTRIBUTE(3, 4); |
388 | 395 |
389 // Report warning message at location of current token in current script. | 396 // Report warning message at location of current token in current script. |
390 void ReportWarning(const char* msg, ...) const PRINTF_ATTRIBUTE(2, 3); | 397 void ReportWarning(const char* msg, ...) const PRINTF_ATTRIBUTE(2, 3); |
391 | 398 |
392 // Report warning message at given location in current script. | 399 // Report warning message at given location in current script. |
393 void ReportWarning(intptr_t token_pos, | 400 void ReportWarning(TokenDescriptor token_pos, |
394 const char* msg, ...) const PRINTF_ATTRIBUTE(3, 4); | 401 const char* msg, ...) const PRINTF_ATTRIBUTE(3, 4); |
395 | 402 |
396 void CheckRecursiveInvocation(); | 403 void CheckRecursiveInvocation(); |
397 | 404 |
398 const Instance& EvaluateConstExpr(intptr_t expr_pos, AstNode* expr); | 405 const Instance& EvaluateConstExpr(TokenDescriptor expr_pos, AstNode* expr); |
399 StaticGetterNode* RunStaticFieldInitializer(const Field& field, | 406 StaticGetterNode* RunStaticFieldInitializer(const Field& field, |
400 intptr_t field_ref_pos); | 407 TokenDescriptor field_ref_pos); |
401 RawObject* EvaluateConstConstructorCall(const Class& type_class, | 408 RawObject* EvaluateConstConstructorCall(const Class& type_class, |
402 const TypeArguments& type_arguments, | 409 const TypeArguments& type_arguments, |
403 const Function& constructor, | 410 const Function& constructor, |
404 ArgumentListNode* arguments); | 411 ArgumentListNode* arguments); |
405 LiteralNode* FoldConstExpr(intptr_t expr_pos, AstNode* expr); | 412 LiteralNode* FoldConstExpr(TokenDescriptor expr_pos, AstNode* expr); |
406 | 413 |
407 // Support for parsing of scripts. | 414 // Support for parsing of scripts. |
408 void ParseTopLevel(); | 415 void ParseTopLevel(); |
409 void ParseEnumDeclaration(const GrowableObjectArray& pending_classes, | 416 void ParseEnumDeclaration(const GrowableObjectArray& pending_classes, |
410 const Object& tl_owner, | 417 const Object& tl_owner, |
411 intptr_t metadata_pos); | 418 TokenDescriptor metadata_pos); |
412 void ParseEnumDefinition(const Class& cls); | 419 void ParseEnumDefinition(const Class& cls); |
413 void ParseClassDeclaration(const GrowableObjectArray& pending_classes, | 420 void ParseClassDeclaration(const GrowableObjectArray& pending_classes, |
414 const Object& tl_owner, | 421 const Object& tl_owner, |
415 intptr_t metadata_pos); | 422 TokenDescriptor metadata_pos); |
416 void ParseClassDefinition(const Class& cls); | 423 void ParseClassDefinition(const Class& cls); |
417 void ParseMixinAppAlias(const GrowableObjectArray& pending_classes, | 424 void ParseMixinAppAlias(const GrowableObjectArray& pending_classes, |
418 const Object& tl_owner, | 425 const Object& tl_owner, |
419 intptr_t metadata_pos); | 426 TokenDescriptor metadata_pos); |
420 void ParseTypedef(const GrowableObjectArray& pending_classes, | 427 void ParseTypedef(const GrowableObjectArray& pending_classes, |
421 const Object& tl_owner, | 428 const Object& tl_owner, |
422 intptr_t metadata_pos); | 429 TokenDescriptor metadata_pos); |
423 void ParseTopLevelVariable(TopLevel* top_level, | 430 void ParseTopLevelVariable(TopLevel* top_level, |
424 const Object& owner, intptr_t metadata_pos); | 431 const Object& owner, TokenDescriptor metadata_pos); |
425 void ParseTopLevelFunction(TopLevel* top_level, | 432 void ParseTopLevelFunction(TopLevel* top_level, |
426 const Object& owner, intptr_t metadata_pos); | 433 const Object& owner, TokenDescriptor metadata_pos); |
427 void ParseTopLevelAccessor(TopLevel* top_level, | 434 void ParseTopLevelAccessor(TopLevel* top_level, |
428 const Object& owner, intptr_t metadata_pos); | 435 const Object& owner, TokenDescriptor metadata_pos); |
429 RawArray* EvaluateMetadata(); | 436 RawArray* EvaluateMetadata(); |
430 | 437 |
431 RawFunction::AsyncModifier ParseFunctionModifier(); | 438 RawFunction::AsyncModifier ParseFunctionModifier(); |
432 | 439 |
433 // Support for parsing libraries. | 440 // Support for parsing libraries. |
434 RawObject* CallLibraryTagHandler(Dart_LibraryTag tag, | 441 RawObject* CallLibraryTagHandler(Dart_LibraryTag tag, |
435 intptr_t token_pos, | 442 TokenDescriptor token_pos, |
436 const String& url); | 443 const String& url); |
437 void ParseIdentList(GrowableObjectArray* names); | 444 void ParseIdentList(GrowableObjectArray* names); |
438 void ParseLibraryDefinition(const Object& tl_owner); | 445 void ParseLibraryDefinition(const Object& tl_owner); |
439 void ParseLibraryName(); | 446 void ParseLibraryName(); |
440 void ParseLibraryImportExport(const Object& tl_owner, | 447 void ParseLibraryImportExport(const Object& tl_owner, |
441 intptr_t metadata_pos); | 448 TokenDescriptor metadata_pos); |
442 void ParseLibraryPart(); | 449 void ParseLibraryPart(); |
443 void ParsePartHeader(); | 450 void ParsePartHeader(); |
444 void ParseLibraryNameObsoleteSyntax(); | 451 void ParseLibraryNameObsoleteSyntax(); |
445 void ParseLibraryImportObsoleteSyntax(); | 452 void ParseLibraryImportObsoleteSyntax(); |
446 void ParseLibraryIncludeObsoleteSyntax(); | 453 void ParseLibraryIncludeObsoleteSyntax(); |
447 | 454 |
448 void ResolveTypeFromClass(const Class& cls, | 455 void ResolveTypeFromClass(const Class& cls, |
449 ClassFinalizer::FinalizationKind finalization, | 456 ClassFinalizer::FinalizationKind finalization, |
450 AbstractType* type); | 457 AbstractType* type); |
451 RawAbstractType* ParseType(ClassFinalizer::FinalizationKind finalization, | 458 RawAbstractType* ParseType(ClassFinalizer::FinalizationKind finalization, |
452 bool allow_deferred_type = false, | 459 bool allow_deferred_type = false, |
453 bool consume_unresolved_prefix = true); | 460 bool consume_unresolved_prefix = true); |
454 RawAbstractType* ParseType( | 461 RawAbstractType* ParseType( |
455 ClassFinalizer::FinalizationKind finalization, | 462 ClassFinalizer::FinalizationKind finalization, |
456 bool allow_deferred_type, | 463 bool allow_deferred_type, |
457 bool consume_unresolved_prefix, | 464 bool consume_unresolved_prefix, |
458 LibraryPrefix* prefix); | 465 LibraryPrefix* prefix); |
459 | 466 |
460 void ParseTypeParameters(const Class& cls); | 467 void ParseTypeParameters(const Class& cls); |
461 RawTypeArguments* ParseTypeArguments( | 468 RawTypeArguments* ParseTypeArguments( |
462 ClassFinalizer::FinalizationKind finalization); | 469 ClassFinalizer::FinalizationKind finalization); |
463 void ParseMethodOrConstructor(ClassDesc* members, MemberDesc* method); | 470 void ParseMethodOrConstructor(ClassDesc* members, MemberDesc* method); |
464 void ParseFieldDefinition(ClassDesc* members, MemberDesc* field); | 471 void ParseFieldDefinition(ClassDesc* members, MemberDesc* field); |
465 void CheckMemberNameConflict(ClassDesc* members, MemberDesc* member); | 472 void CheckMemberNameConflict(ClassDesc* members, MemberDesc* member); |
466 void ParseClassMemberDefinition(ClassDesc* members, | 473 void ParseClassMemberDefinition(ClassDesc* members, |
467 intptr_t metadata_pos); | 474 TokenDescriptor metadata_pos); |
468 void ParseFormalParameter(bool allow_explicit_default_value, | 475 void ParseFormalParameter(bool allow_explicit_default_value, |
469 bool evaluate_metadata, | 476 bool evaluate_metadata, |
470 ParamList* params); | 477 ParamList* params); |
471 void ParseFormalParameters(bool allow_explicit_default_values, | 478 void ParseFormalParameters(bool allow_explicit_default_values, |
472 bool evaluate_metadata, | 479 bool evaluate_metadata, |
473 ParamList* params); | 480 ParamList* params); |
474 void ParseFormalParameterList(bool allow_explicit_default_values, | 481 void ParseFormalParameterList(bool allow_explicit_default_values, |
475 bool evaluate_metadata, | 482 bool evaluate_metadata, |
476 ParamList* params); | 483 ParamList* params); |
477 void CheckFieldsInitialized(const Class& cls); | 484 void CheckFieldsInitialized(const Class& cls); |
478 void AddImplicitConstructor(const Class& cls); | 485 void AddImplicitConstructor(const Class& cls); |
479 void CheckConstructors(ClassDesc* members); | 486 void CheckConstructors(ClassDesc* members); |
480 AstNode* ParseExternalInitializedField(const Field& field); | 487 AstNode* ParseExternalInitializedField(const Field& field); |
481 void ParseInitializedInstanceFields( | 488 void ParseInitializedInstanceFields( |
482 const Class& cls, | 489 const Class& cls, |
483 LocalVariable* receiver, | 490 LocalVariable* receiver, |
484 GrowableArray<Field*>* initialized_fields); | 491 GrowableArray<Field*>* initialized_fields); |
485 AstNode* CheckDuplicateFieldInit( | 492 AstNode* CheckDuplicateFieldInit( |
486 intptr_t init_pos, | 493 TokenDescriptor init_pos, |
487 GrowableArray<Field*>* initialized_fields, | 494 GrowableArray<Field*>* initialized_fields, |
488 AstNode* instance, | 495 AstNode* instance, |
489 Field* field, | 496 Field* field, |
490 AstNode* init_value); | 497 AstNode* init_value); |
491 StaticCallNode* GenerateSuperConstructorCall( | 498 StaticCallNode* GenerateSuperConstructorCall( |
492 const Class& cls, | 499 const Class& cls, |
493 intptr_t supercall_pos, | 500 TokenDescriptor supercall_pos, |
494 LocalVariable* receiver, | 501 LocalVariable* receiver, |
495 ArgumentListNode* forwarding_args); | 502 ArgumentListNode* forwarding_args); |
496 StaticCallNode* ParseSuperInitializer( | 503 StaticCallNode* ParseSuperInitializer( |
497 const Class& cls, | 504 const Class& cls, |
498 LocalVariable* receiver); | 505 LocalVariable* receiver); |
499 AstNode* ParseInitializer(const Class& cls, | 506 AstNode* ParseInitializer(const Class& cls, |
500 LocalVariable* receiver, | 507 LocalVariable* receiver, |
501 GrowableArray<Field*>* initialized_fields); | 508 GrowableArray<Field*>* initialized_fields); |
502 void ParseConstructorRedirection(const Class& cls, LocalVariable* receiver); | 509 void ParseConstructorRedirection(const Class& cls, LocalVariable* receiver); |
503 void ParseInitializers(const Class& cls, | 510 void ParseInitializers(const Class& cls, |
504 LocalVariable* receiver, | 511 LocalVariable* receiver, |
505 GrowableArray<Field*>* initialized_fields); | 512 GrowableArray<Field*>* initialized_fields); |
506 String& ParseNativeDeclaration(); | 513 String& ParseNativeDeclaration(); |
507 void ParseInterfaceList(const Class& cls); | 514 void ParseInterfaceList(const Class& cls); |
508 RawAbstractType* ParseMixins(const AbstractType& super_type); | 515 RawAbstractType* ParseMixins(const AbstractType& super_type); |
509 static StaticCallNode* BuildInvocationMirrorAllocation( | 516 static StaticCallNode* BuildInvocationMirrorAllocation( |
510 intptr_t call_pos, | 517 TokenDescriptor call_pos, |
511 const String& function_name, | 518 const String& function_name, |
512 const ArgumentListNode& function_args, | 519 const ArgumentListNode& function_args, |
513 const LocalVariable* temp, | 520 const LocalVariable* temp, |
514 bool is_super_invocation); | 521 bool is_super_invocation); |
515 // Build arguments for a NoSuchMethodCall. If LocalVariable temp is not NULL, | 522 // Build arguments for a NoSuchMethodCall. If LocalVariable temp is not NULL, |
516 // the last argument is stored in temp. | 523 // the last argument is stored in temp. |
517 static ArgumentListNode* BuildNoSuchMethodArguments( | 524 static ArgumentListNode* BuildNoSuchMethodArguments( |
518 intptr_t call_pos, | 525 TokenDescriptor call_pos, |
519 const String& function_name, | 526 const String& function_name, |
520 const ArgumentListNode& function_args, | 527 const ArgumentListNode& function_args, |
521 const LocalVariable* temp, | 528 const LocalVariable* temp, |
522 bool is_super_invocation); | 529 bool is_super_invocation); |
523 RawFunction* GetSuperFunction(intptr_t token_pos, | 530 RawFunction* GetSuperFunction(TokenDescriptor token_pos, |
524 const String& name, | 531 const String& name, |
525 ArgumentListNode* arguments, | 532 ArgumentListNode* arguments, |
526 bool resolve_getter, | 533 bool resolve_getter, |
527 bool* is_no_such_method); | 534 bool* is_no_such_method); |
528 AstNode* ParseSuperCall(const String& function_name); | 535 AstNode* ParseSuperCall(const String& function_name); |
529 AstNode* ParseSuperFieldAccess(const String& field_name, intptr_t field_pos); | 536 AstNode* ParseSuperFieldAccess(const String& field_name, |
| 537 TokenDescriptor field_pos); |
530 AstNode* ParseSuperOperator(); | 538 AstNode* ParseSuperOperator(); |
531 AstNode* BuildUnarySuperOperator(Token::Kind op, PrimaryNode* super); | 539 AstNode* BuildUnarySuperOperator(Token::Kind op, PrimaryNode* super); |
532 | 540 |
533 static bool ParseFormalParameters(const Function& func, ParamList* params); | 541 static bool ParseFormalParameters(const Function& func, ParamList* params); |
534 | 542 |
535 void SetupDefaultsForOptionalParams(const ParamList& params); | 543 void SetupDefaultsForOptionalParams(const ParamList& params); |
536 ClosureNode* CreateImplicitClosureNode(const Function& func, | 544 ClosureNode* CreateImplicitClosureNode(const Function& func, |
537 intptr_t token_pos, | 545 TokenDescriptor token_pos, |
538 AstNode* receiver); | 546 AstNode* receiver); |
539 static void AddFormalParamsToFunction(const ParamList* params, | 547 static void AddFormalParamsToFunction(const ParamList* params, |
540 const Function& func); | 548 const Function& func); |
541 void AddFormalParamsToScope(const ParamList* params, LocalScope* scope); | 549 void AddFormalParamsToScope(const ParamList* params, LocalScope* scope); |
542 | 550 |
543 SequenceNode* ParseConstructor(const Function& func); | 551 SequenceNode* ParseConstructor(const Function& func); |
544 SequenceNode* ParseFunc(const Function& func, bool check_semicolon); | 552 SequenceNode* ParseFunc(const Function& func, bool check_semicolon); |
545 | 553 |
546 void ParseNativeFunctionBlock(const ParamList* params, const Function& func); | 554 void ParseNativeFunctionBlock(const ParamList* params, const Function& func); |
547 | 555 |
548 SequenceNode* ParseInstanceGetter(const Function& func); | 556 SequenceNode* ParseInstanceGetter(const Function& func); |
549 SequenceNode* ParseInstanceSetter(const Function& func); | 557 SequenceNode* ParseInstanceSetter(const Function& func); |
550 SequenceNode* ParseStaticFinalGetter(const Function& func); | 558 SequenceNode* ParseStaticFinalGetter(const Function& func); |
551 SequenceNode* ParseStaticInitializer(); | 559 SequenceNode* ParseStaticInitializer(); |
552 SequenceNode* ParseMethodExtractor(const Function& func); | 560 SequenceNode* ParseMethodExtractor(const Function& func); |
553 SequenceNode* ParseNoSuchMethodDispatcher(const Function& func); | 561 SequenceNode* ParseNoSuchMethodDispatcher(const Function& func); |
554 SequenceNode* ParseInvokeFieldDispatcher(const Function& func); | 562 SequenceNode* ParseInvokeFieldDispatcher(const Function& func); |
555 SequenceNode* ParseImplicitClosure(const Function& func); | 563 SequenceNode* ParseImplicitClosure(const Function& func); |
556 SequenceNode* ParseConstructorClosure(const Function& func); | 564 SequenceNode* ParseConstructorClosure(const Function& func); |
557 | 565 |
558 void BuildDispatcherScope(const Function& func, | 566 void BuildDispatcherScope(const Function& func, |
559 const ArgumentsDescriptor& desc); | 567 const ArgumentsDescriptor& desc); |
560 | 568 |
561 void EnsureHasReturnStatement(SequenceNode* seq, intptr_t return_pos); | 569 void EnsureHasReturnStatement(SequenceNode* seq, TokenDescriptor return_pos); |
562 void ChainNewBlock(LocalScope* outer_scope); | 570 void ChainNewBlock(LocalScope* outer_scope); |
563 void OpenBlock(); | 571 void OpenBlock(); |
564 void OpenLoopBlock(); | 572 void OpenLoopBlock(); |
565 void OpenFunctionBlock(const Function& func); | 573 void OpenFunctionBlock(const Function& func); |
566 void OpenAsyncClosure(); | 574 void OpenAsyncClosure(); |
567 RawFunction* OpenAsyncFunction(intptr_t formal_param_pos); | 575 RawFunction* OpenAsyncFunction(TokenDescriptor formal_param_pos); |
568 RawFunction* OpenSyncGeneratorFunction(intptr_t func_pos); | 576 RawFunction* OpenSyncGeneratorFunction(TokenDescriptor func_pos); |
569 SequenceNode* CloseSyncGenFunction(const Function& closure, | 577 SequenceNode* CloseSyncGenFunction(const Function& closure, |
570 SequenceNode* closure_node); | 578 SequenceNode* closure_node); |
571 void AddSyncGenClosureParameters(ParamList* params); | 579 void AddSyncGenClosureParameters(ParamList* params); |
572 void AddAsyncGenClosureParameters(ParamList* params); | 580 void AddAsyncGenClosureParameters(ParamList* params); |
573 | 581 |
574 // Support for async* functions. | 582 // Support for async* functions. |
575 RawFunction* OpenAsyncGeneratorFunction(intptr_t func_pos); | 583 RawFunction* OpenAsyncGeneratorFunction(TokenDescriptor func_pos); |
576 SequenceNode* CloseAsyncGeneratorFunction(const Function& closure, | 584 SequenceNode* CloseAsyncGeneratorFunction(const Function& closure, |
577 SequenceNode* closure_node); | 585 SequenceNode* closure_node); |
578 void OpenAsyncGeneratorClosure(); | 586 void OpenAsyncGeneratorClosure(); |
579 SequenceNode* CloseAsyncGeneratorClosure(SequenceNode* body); | 587 SequenceNode* CloseAsyncGeneratorClosure(SequenceNode* body); |
580 | 588 |
581 void OpenAsyncTryBlock(); | 589 void OpenAsyncTryBlock(); |
582 SequenceNode* CloseBlock(); | 590 SequenceNode* CloseBlock(); |
583 SequenceNode* CloseAsyncFunction(const Function& closure, | 591 SequenceNode* CloseAsyncFunction(const Function& closure, |
584 SequenceNode* closure_node); | 592 SequenceNode* closure_node); |
585 | 593 |
586 SequenceNode* CloseAsyncClosure(SequenceNode* body); | 594 SequenceNode* CloseAsyncClosure(SequenceNode* body); |
587 SequenceNode* CloseAsyncTryBlock(SequenceNode* try_block); | 595 SequenceNode* CloseAsyncTryBlock(SequenceNode* try_block); |
588 SequenceNode* CloseAsyncGeneratorTryBlock(SequenceNode *body); | 596 SequenceNode* CloseAsyncGeneratorTryBlock(SequenceNode *body); |
589 | 597 |
590 void AddAsyncClosureParameters(ParamList* params); | 598 void AddAsyncClosureParameters(ParamList* params); |
591 void AddContinuationVariables(); | 599 void AddContinuationVariables(); |
592 void AddAsyncClosureVariables(); | 600 void AddAsyncClosureVariables(); |
593 void AddAsyncGeneratorVariables(); | 601 void AddAsyncGeneratorVariables(); |
594 | 602 |
595 LocalVariable* LookupReceiver(LocalScope* from_scope, bool test_only); | 603 LocalVariable* LookupReceiver(LocalScope* from_scope, bool test_only); |
596 LocalVariable* LookupTypeArgumentsParameter(LocalScope* from_scope, | 604 LocalVariable* LookupTypeArgumentsParameter(LocalScope* from_scope, |
597 bool test_only); | 605 bool test_only); |
598 void CaptureInstantiator(); | 606 void CaptureInstantiator(); |
599 AstNode* LoadReceiver(intptr_t token_pos); | 607 AstNode* LoadReceiver(TokenDescriptor token_pos); |
600 AstNode* LoadFieldIfUnresolved(AstNode* node); | 608 AstNode* LoadFieldIfUnresolved(AstNode* node); |
601 AstNode* LoadClosure(PrimaryNode* primary); | 609 AstNode* LoadClosure(PrimaryNode* primary); |
602 InstanceGetterNode* CallGetter(intptr_t token_pos, | 610 InstanceGetterNode* CallGetter(TokenDescriptor token_pos, |
603 AstNode* object, | 611 AstNode* object, |
604 const String& name); | 612 const String& name); |
605 | 613 |
606 AstNode* ParseAssertStatement(); | 614 AstNode* ParseAssertStatement(); |
607 AstNode* ParseJump(String* label_name); | 615 AstNode* ParseJump(String* label_name); |
608 AstNode* ParseIfStatement(String* label_name); | 616 AstNode* ParseIfStatement(String* label_name); |
609 AstNode* ParseWhileStatement(String* label_name); | 617 AstNode* ParseWhileStatement(String* label_name); |
610 AstNode* ParseDoWhileStatement(String* label_name); | 618 AstNode* ParseDoWhileStatement(String* label_name); |
611 AstNode* ParseForStatement(String* label_name); | 619 AstNode* ParseForStatement(String* label_name); |
612 AstNode* ParseAwaitForStatement(String* label_name); | 620 AstNode* ParseAwaitForStatement(String* label_name); |
613 AstNode* ParseForInStatement(intptr_t forin_pos, SourceLabel* label); | 621 AstNode* ParseForInStatement(TokenDescriptor forin_pos, SourceLabel* label); |
614 RawClass* CheckCaseExpressions(const GrowableArray<LiteralNode*>& values); | 622 RawClass* CheckCaseExpressions(const GrowableArray<LiteralNode*>& values); |
615 CaseNode* ParseCaseClause(LocalVariable* switch_expr_value, | 623 CaseNode* ParseCaseClause(LocalVariable* switch_expr_value, |
616 GrowableArray<LiteralNode*>* case_expr_values, | 624 GrowableArray<LiteralNode*>* case_expr_values, |
617 SourceLabel* case_label); | 625 SourceLabel* case_label); |
618 AstNode* ParseSwitchStatement(String* label_name); | 626 AstNode* ParseSwitchStatement(String* label_name); |
619 | 627 |
620 // try/catch/finally parsing. | 628 // try/catch/finally parsing. |
621 void AddCatchParamsToScope(CatchParamDesc* exception_param, | 629 void AddCatchParamsToScope(CatchParamDesc* exception_param, |
622 CatchParamDesc* stack_trace_param, | 630 CatchParamDesc* stack_trace_param, |
623 LocalScope* scope); | 631 LocalScope* scope); |
624 void SetupExceptionVariables(LocalScope* try_scope, | 632 void SetupExceptionVariables(LocalScope* try_scope, |
625 bool is_async, | 633 bool is_async, |
626 LocalVariable** context_var, | 634 LocalVariable** context_var, |
627 LocalVariable** exception_var, | 635 LocalVariable** exception_var, |
628 LocalVariable** stack_trace_var, | 636 LocalVariable** stack_trace_var, |
629 LocalVariable** saved_exception_var, | 637 LocalVariable** saved_exception_var, |
630 LocalVariable** saved_stack_trace_var); | 638 LocalVariable** saved_stack_trace_var); |
631 void SaveExceptionAndStacktrace(SequenceNode* statements, | 639 void SaveExceptionAndStacktrace(SequenceNode* statements, |
632 LocalVariable* exception_var, | 640 LocalVariable* exception_var, |
633 LocalVariable* stack_trace_var, | 641 LocalVariable* stack_trace_var, |
634 LocalVariable* saved_exception_var, | 642 LocalVariable* saved_exception_var, |
635 LocalVariable* saved_stack_trace_var); | 643 LocalVariable* saved_stack_trace_var); |
636 // Parse all the catch clause of a try. | 644 // Parse all the catch clause of a try. |
637 SequenceNode* ParseCatchClauses(intptr_t handler_pos, | 645 SequenceNode* ParseCatchClauses(TokenDescriptor handler_pos, |
638 bool is_async, | 646 bool is_async, |
639 LocalVariable* exception_var, | 647 LocalVariable* exception_var, |
640 LocalVariable* stack_trace_var, | 648 LocalVariable* stack_trace_var, |
641 LocalVariable* rethrow_exception_var, | 649 LocalVariable* rethrow_exception_var, |
642 LocalVariable* rethrow_stack_trace_var, | 650 LocalVariable* rethrow_stack_trace_var, |
643 const GrowableObjectArray& handler_types, | 651 const GrowableObjectArray& handler_types, |
644 bool* needs_stack_trace); | 652 bool* needs_stack_trace); |
645 // Parse or generate a finally clause. | 653 // Parse or generate a finally clause. |
646 SequenceNode* EnsureFinallyClause(bool parse, | 654 SequenceNode* EnsureFinallyClause(bool parse, |
647 bool is_async, | 655 bool is_async, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
710 AstNode* ParseUnaryExpr(); | 718 AstNode* ParseUnaryExpr(); |
711 AstNode* ParsePostfixExpr(); | 719 AstNode* ParsePostfixExpr(); |
712 AstNode* ParseSelectors(AstNode* primary, bool is_cascade); | 720 AstNode* ParseSelectors(AstNode* primary, bool is_cascade); |
713 AstNode* ParseClosurization(AstNode* primary); | 721 AstNode* ParseClosurization(AstNode* primary); |
714 AstNode* ParseCascades(AstNode* expr); | 722 AstNode* ParseCascades(AstNode* expr); |
715 AstNode* ParsePrimary(); | 723 AstNode* ParsePrimary(); |
716 AstNode* ParseStringLiteral(bool allow_interpolation); | 724 AstNode* ParseStringLiteral(bool allow_interpolation); |
717 String* ParseImportStringLiteral(); | 725 String* ParseImportStringLiteral(); |
718 AstNode* ParseCompoundLiteral(); | 726 AstNode* ParseCompoundLiteral(); |
719 AstNode* ParseSymbolLiteral(); | 727 AstNode* ParseSymbolLiteral(); |
720 AstNode* ParseListLiteral(intptr_t type_pos, | 728 AstNode* ParseListLiteral(TokenDescriptor type_pos, |
721 bool is_const, | 729 bool is_const, |
722 const TypeArguments& type_arguments); | 730 const TypeArguments& type_arguments); |
723 AstNode* ParseMapLiteral(intptr_t type_pos, | 731 AstNode* ParseMapLiteral(TokenDescriptor type_pos, |
724 bool is_const, | 732 bool is_const, |
725 const TypeArguments& type_arguments); | 733 const TypeArguments& type_arguments); |
726 | 734 |
727 RawFunction* BuildConstructorClosureFunction(const Function& ctr, | 735 RawFunction* BuildConstructorClosureFunction(const Function& ctr, |
728 intptr_t token_pos); | 736 TokenDescriptor token_pos); |
729 AstNode* ParseNewOperator(Token::Kind op_kind); | 737 AstNode* ParseNewOperator(Token::Kind op_kind); |
730 void ParseConstructorClosurization(Function* constructor, | 738 void ParseConstructorClosurization(Function* constructor, |
731 TypeArguments* type_arguments); | 739 TypeArguments* type_arguments); |
732 | 740 |
733 // An implicit argument, if non-null, is prepended to the returned list. | 741 // An implicit argument, if non-null, is prepended to the returned list. |
734 ArgumentListNode* ParseActualParameters(ArgumentListNode* implicit_arguments, | 742 ArgumentListNode* ParseActualParameters(ArgumentListNode* implicit_arguments, |
735 bool require_const); | 743 bool require_const); |
736 AstNode* ParseStaticCall(const Class& cls, | 744 AstNode* ParseStaticCall(const Class& cls, |
737 const String& method_name, | 745 const String& method_name, |
738 intptr_t ident_pos); | 746 TokenDescriptor ident_pos); |
739 AstNode* ParseInstanceCall(AstNode* receiver, | 747 AstNode* ParseInstanceCall(AstNode* receiver, |
740 const String& method_name, | 748 const String& method_name, |
741 intptr_t ident_pos, | 749 TokenDescriptor ident_pos, |
742 bool is_conditional); | 750 bool is_conditional); |
743 AstNode* ParseClosureCall(AstNode* closure); | 751 AstNode* ParseClosureCall(AstNode* closure); |
744 AstNode* GenerateStaticFieldLookup(const Field& field, | 752 AstNode* GenerateStaticFieldLookup(const Field& field, |
745 intptr_t ident_pos); | 753 TokenDescriptor ident_pos); |
746 AstNode* GenerateStaticFieldAccess(const Class& cls, | 754 AstNode* GenerateStaticFieldAccess(const Class& cls, |
747 const String& field_name, | 755 const String& field_name, |
748 intptr_t ident_pos); | 756 TokenDescriptor ident_pos); |
749 | 757 |
750 LocalVariable* LookupLocalScope(const String& ident); | 758 LocalVariable* LookupLocalScope(const String& ident); |
751 void CheckInstanceFieldAccess(intptr_t field_pos, const String& field_name); | 759 void CheckInstanceFieldAccess(TokenDescriptor field_pos, |
| 760 const String& field_name); |
752 bool ParsingStaticMember() const; | 761 bool ParsingStaticMember() const; |
753 const AbstractType* ReceiverType(const Class& cls); | 762 const AbstractType* ReceiverType(const Class& cls); |
754 bool IsInstantiatorRequired() const; | 763 bool IsInstantiatorRequired() const; |
755 bool ResolveIdentInLocalScope(intptr_t ident_pos, | 764 bool ResolveIdentInLocalScope(TokenDescriptor ident_pos, |
756 const String &ident, | 765 const String &ident, |
757 AstNode** node); | 766 AstNode** node); |
758 static const bool kResolveLocally = true; | 767 static const bool kResolveLocally = true; |
759 static const bool kResolveIncludingImports = false; | 768 static const bool kResolveIncludingImports = false; |
760 | 769 |
761 // Resolve a primary identifier in the library or prefix scope and | 770 // Resolve a primary identifier in the library or prefix scope and |
762 // generate the corresponding AstNode. | 771 // generate the corresponding AstNode. |
763 AstNode* ResolveIdentInCurrentLibraryScope(intptr_t ident_pos, | 772 AstNode* ResolveIdentInCurrentLibraryScope(TokenDescriptor ident_pos, |
764 const String& ident); | 773 const String& ident); |
765 AstNode* ResolveIdentInPrefixScope(intptr_t ident_pos, | 774 AstNode* ResolveIdentInPrefixScope(TokenDescriptor ident_pos, |
766 const LibraryPrefix& prefix, | 775 const LibraryPrefix& prefix, |
767 const String& ident); | 776 const String& ident); |
768 | 777 |
769 AstNode* ResolveIdent(intptr_t ident_pos, | 778 AstNode* ResolveIdent(TokenDescriptor ident_pos, |
770 const String& ident, | 779 const String& ident, |
771 bool allow_closure_names); | 780 bool allow_closure_names); |
772 RawString* ResolveImportVar(intptr_t ident_pos, const String& ident); | 781 RawString* ResolveImportVar(TokenDescriptor ident_pos, const String& ident); |
773 AstNode* OptimizeBinaryOpNode(intptr_t op_pos, | 782 AstNode* OptimizeBinaryOpNode(TokenDescriptor op_pos, |
774 Token::Kind binary_op, | 783 Token::Kind binary_op, |
775 AstNode* lhs, | 784 AstNode* lhs, |
776 AstNode* rhs); | 785 AstNode* rhs); |
777 AstNode* ExpandAssignableOp(intptr_t op_pos, | 786 AstNode* ExpandAssignableOp(TokenDescriptor op_pos, |
778 Token::Kind assignment_op, | 787 Token::Kind assignment_op, |
779 AstNode* lhs, | 788 AstNode* lhs, |
780 AstNode* rhs); | 789 AstNode* rhs); |
781 LetNode* PrepareCompoundAssignmentNodes(AstNode** expr); | 790 LetNode* PrepareCompoundAssignmentNodes(AstNode** expr); |
782 LocalVariable* CreateTempConstVariable(intptr_t token_pos, const char* s); | 791 LocalVariable* CreateTempConstVariable(TokenDescriptor token_pos, |
| 792 const char* s); |
783 | 793 |
784 static SequenceNode* NodeAsSequenceNode(intptr_t sequence_pos, | 794 static SequenceNode* NodeAsSequenceNode(TokenDescriptor sequence_pos, |
785 AstNode* node, | 795 AstNode* node, |
786 LocalScope* scope); | 796 LocalScope* scope); |
787 | 797 |
788 SequenceNode* MakeImplicitConstructor(const Function& func); | 798 SequenceNode* MakeImplicitConstructor(const Function& func); |
789 AstNode* MakeStaticCall(const String& cls_name, | 799 AstNode* MakeStaticCall(const String& cls_name, |
790 const String& func_name, | 800 const String& func_name, |
791 ArgumentListNode* arguments); | 801 ArgumentListNode* arguments); |
792 String& Interpolate(const GrowableArray<AstNode*>& values); | 802 String& Interpolate(const GrowableArray<AstNode*>& values); |
793 AstNode* MakeAssertCall(intptr_t begin, intptr_t end); | 803 AstNode* MakeAssertCall(TokenDescriptor begin, TokenDescriptor end); |
794 AstNode* ThrowTypeError(intptr_t type_pos, const AbstractType& type, | 804 AstNode* ThrowTypeError(TokenDescriptor type_pos, |
795 LibraryPrefix* prefix = NULL); | 805 const AbstractType& type, |
796 AstNode* ThrowNoSuchMethodError(intptr_t call_pos, | 806 LibraryPrefix* prefix = NULL); |
| 807 AstNode* ThrowNoSuchMethodError(TokenDescriptor call_pos, |
797 const Class& cls, | 808 const Class& cls, |
798 const String& function_name, | 809 const String& function_name, |
799 ArgumentListNode* function_arguments, | 810 ArgumentListNode* function_arguments, |
800 InvocationMirror::Call call, | 811 InvocationMirror::Call call, |
801 InvocationMirror::Type type, | 812 InvocationMirror::Type type, |
802 const Function* func, | 813 const Function* func, |
803 const LibraryPrefix* prefix = NULL); | 814 const LibraryPrefix* prefix = NULL); |
804 | 815 |
805 void SetupSavedTryContext(LocalVariable* saved_try_context); | 816 void SetupSavedTryContext(LocalVariable* saved_try_context); |
806 | 817 |
807 void CheckOperatorArity(const MemberDesc& member); | 818 void CheckOperatorArity(const MemberDesc& member); |
808 | 819 |
809 void EnsureExpressionTemp(); | 820 void EnsureExpressionTemp(); |
810 bool IsLegalAssignableSyntax(AstNode* expr, intptr_t end_pos); | 821 bool IsLegalAssignableSyntax(AstNode* expr, TokenDescriptor end_pos); |
811 AstNode* CreateAssignmentNode(AstNode* original, | 822 AstNode* CreateAssignmentNode(AstNode* original, |
812 AstNode* rhs, | 823 AstNode* rhs, |
813 const String* left_ident, | 824 const String* left_ident, |
814 intptr_t left_pos, | 825 TokenDescriptor left_pos, |
815 bool is_compound = false); | 826 bool is_compound = false); |
816 AstNode* InsertClosureCallNodes(AstNode* condition); | 827 AstNode* InsertClosureCallNodes(AstNode* condition); |
817 | 828 |
818 ConstructorCallNode* CreateConstructorCallNode( | 829 ConstructorCallNode* CreateConstructorCallNode( |
819 intptr_t token_pos, | 830 TokenDescriptor token_pos, |
820 const TypeArguments& type_arguments, | 831 const TypeArguments& type_arguments, |
821 const Function& constructor, | 832 const Function& constructor, |
822 ArgumentListNode* arguments); | 833 ArgumentListNode* arguments); |
823 | 834 |
824 void AddEqualityNullCheck(); | 835 void AddEqualityNullCheck(); |
825 | 836 |
826 AstNode* BuildClosureCall(intptr_t token_pos, | 837 AstNode* BuildClosureCall(TokenDescriptor token_pos, |
827 AstNode* closure, | 838 AstNode* closure, |
828 ArgumentListNode* arguments); | 839 ArgumentListNode* arguments); |
829 | 840 |
830 RawInstance* TryCanonicalize(const Instance& instance, intptr_t token_pos); | 841 RawInstance* TryCanonicalize(const Instance& instance, |
831 void CacheConstantValue(intptr_t token_pos, const Instance& value); | 842 TokenDescriptor token_pos); |
832 bool GetCachedConstant(intptr_t token_pos, Instance* value); | 843 void CacheConstantValue(TokenDescriptor token_pos, const Instance& value); |
| 844 bool GetCachedConstant(TokenDescriptor token_pos, Instance* value); |
833 | 845 |
834 Thread* thread() const { return thread_; } | 846 Thread* thread() const { return thread_; } |
835 Isolate* isolate() const { return isolate_; } | 847 Isolate* isolate() const { return isolate_; } |
836 Zone* zone() const { return thread_->zone(); } | 848 Zone* zone() const { return thread_->zone(); } |
837 | 849 |
838 Isolate* isolate_; // Cached current isolate. | 850 Isolate* isolate_; // Cached current isolate. |
839 Thread* thread_; | 851 Thread* thread_; |
840 | 852 |
841 Script& script_; | 853 Script& script_; |
842 TokenStream::Iterator tokens_iterator_; | 854 TokenStream::Iterator tokens_iterator_; |
843 Token::Kind token_kind_; // Cached token kind for current token. | 855 Token::Kind token_kind_; // Cached token kind for current token. |
844 intptr_t prev_token_pos_; | 856 TokenDescriptor prev_token_pos_; |
845 Block* current_block_; | 857 Block* current_block_; |
846 | 858 |
847 // is_top_level_ is true if parsing the "top level" of a compilation unit, | 859 // is_top_level_ is true if parsing the "top level" of a compilation unit, |
848 // that is class definitions, function type aliases, global functions, | 860 // that is class definitions, function type aliases, global functions, |
849 // global variables. | 861 // global variables. |
850 bool is_top_level_; | 862 bool is_top_level_; |
851 | 863 |
852 // await_is_keyword_ is true if we are parsing an async or generator | 864 // await_is_keyword_ is true if we are parsing an async or generator |
853 // function. In this context the identifiers await, async and yield | 865 // function. In this context the identifiers await, async and yield |
854 // are treated as keywords. | 866 // are treated as keywords. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
900 | 912 |
901 intptr_t recursion_counter_; | 913 intptr_t recursion_counter_; |
902 friend class RecursionChecker; | 914 friend class RecursionChecker; |
903 | 915 |
904 DISALLOW_COPY_AND_ASSIGN(Parser); | 916 DISALLOW_COPY_AND_ASSIGN(Parser); |
905 }; | 917 }; |
906 | 918 |
907 } // namespace dart | 919 } // namespace dart |
908 | 920 |
909 #endif // VM_PARSER_H_ | 921 #endif // VM_PARSER_H_ |
OLD | NEW |