| 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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 void SkipSymbolLiteral(); | 277 void SkipSymbolLiteral(); |
| 278 void SkipNewOperator(); | 278 void SkipNewOperator(); |
| 279 void SkipActualParameters(); | 279 void SkipActualParameters(); |
| 280 void SkipMapLiteral(); | 280 void SkipMapLiteral(); |
| 281 void SkipListLiteral(); | 281 void SkipListLiteral(); |
| 282 void SkipFunctionLiteral(); | 282 void SkipFunctionLiteral(); |
| 283 void SkipStringLiteral(); | 283 void SkipStringLiteral(); |
| 284 void SkipQualIdent(); | 284 void SkipQualIdent(); |
| 285 void SkipFunctionPreamble(); | 285 void SkipFunctionPreamble(); |
| 286 | 286 |
| 287 void CheckConstructorCallTypeArguments( | 287 void CheckConstructorCallTypeArguments(intptr_t pos, |
| 288 intptr_t pos, | 288 Function& constructor, |
| 289 Function& constructor, | 289 const TypeArguments& type_arguments); |
| 290 const AbstractTypeArguments& type_arguments); | |
| 291 | 290 |
| 292 // A null script means no source and a negative token_pos means no position. | 291 // A null script means no source and a negative token_pos means no position. |
| 293 static RawString* FormatMessage(const Script& script, | 292 static RawString* FormatMessage(const Script& script, |
| 294 intptr_t token_pos, | 293 intptr_t token_pos, |
| 295 LanguageError::Kind kind, | 294 LanguageError::Kind kind, |
| 296 const char* format, | 295 const char* format, |
| 297 va_list args); | 296 va_list args); |
| 298 | 297 |
| 299 // Reports error/warning msg at location of current token in current script. | 298 // Reports error/warning msg at location of current token in current script. |
| 300 void ErrorMsg(const char* msg, ...) PRINTF_ATTRIBUTE(2, 3); | 299 void ErrorMsg(const char* msg, ...) PRINTF_ATTRIBUTE(2, 3); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 313 // Concatenates two error messages, the previous and the current one. | 312 // Concatenates two error messages, the previous and the current one. |
| 314 void AppendErrorMsg( | 313 void AppendErrorMsg( |
| 315 const Error& prev_error, intptr_t token_pos, const char* format, ...) | 314 const Error& prev_error, intptr_t token_pos, const char* format, ...) |
| 316 PRINTF_ATTRIBUTE(4, 5); | 315 PRINTF_ATTRIBUTE(4, 5); |
| 317 | 316 |
| 318 void CheckRecursiveInvocation(); | 317 void CheckRecursiveInvocation(); |
| 319 | 318 |
| 320 const Instance& EvaluateConstExpr(intptr_t expr_pos, AstNode* expr); | 319 const Instance& EvaluateConstExpr(intptr_t expr_pos, AstNode* expr); |
| 321 AstNode* RunStaticFieldInitializer(const Field& field, | 320 AstNode* RunStaticFieldInitializer(const Field& field, |
| 322 intptr_t field_ref_pos); | 321 intptr_t field_ref_pos); |
| 323 RawObject* EvaluateConstConstructorCall( | 322 RawObject* EvaluateConstConstructorCall(const Class& type_class, |
| 324 const Class& type_class, | 323 const TypeArguments& type_arguments, |
| 325 const AbstractTypeArguments& type_arguments, | 324 const Function& constructor, |
| 326 const Function& constructor, | 325 ArgumentListNode* arguments); |
| 327 ArgumentListNode* arguments); | |
| 328 AstNode* FoldConstExpr(intptr_t expr_pos, AstNode* expr); | 326 AstNode* FoldConstExpr(intptr_t expr_pos, AstNode* expr); |
| 329 | 327 |
| 330 // Support for parsing of scripts. | 328 // Support for parsing of scripts. |
| 331 void ParseTopLevel(); | 329 void ParseTopLevel(); |
| 332 void ParseClassDeclaration(const GrowableObjectArray& pending_classes, | 330 void ParseClassDeclaration(const GrowableObjectArray& pending_classes, |
| 333 intptr_t metadata_pos); | 331 intptr_t metadata_pos); |
| 334 void ParseClassDefinition(const Class& cls); | 332 void ParseClassDefinition(const Class& cls); |
| 335 void ParseMixinAppAlias(const GrowableObjectArray& pending_classes, | 333 void ParseMixinAppAlias(const GrowableObjectArray& pending_classes, |
| 336 intptr_t metadata_pos); | 334 intptr_t metadata_pos); |
| 337 void ParseTypedef(const GrowableObjectArray& pending_classes, | 335 void ParseTypedef(const GrowableObjectArray& pending_classes, |
| (...skipping 15 matching lines...) Expand all Loading... |
| 353 void ParsePartHeader(); | 351 void ParsePartHeader(); |
| 354 void ParseLibraryNameObsoleteSyntax(); | 352 void ParseLibraryNameObsoleteSyntax(); |
| 355 void ParseLibraryImportObsoleteSyntax(); | 353 void ParseLibraryImportObsoleteSyntax(); |
| 356 void ParseLibraryIncludeObsoleteSyntax(); | 354 void ParseLibraryIncludeObsoleteSyntax(); |
| 357 | 355 |
| 358 void ResolveTypeFromClass(const Class& cls, | 356 void ResolveTypeFromClass(const Class& cls, |
| 359 ClassFinalizer::FinalizationKind finalization, | 357 ClassFinalizer::FinalizationKind finalization, |
| 360 AbstractType* type); | 358 AbstractType* type); |
| 361 RawAbstractType* ParseType(ClassFinalizer::FinalizationKind finalization); | 359 RawAbstractType* ParseType(ClassFinalizer::FinalizationKind finalization); |
| 362 void ParseTypeParameters(const Class& cls); | 360 void ParseTypeParameters(const Class& cls); |
| 363 RawAbstractTypeArguments* ParseTypeArguments( | 361 RawTypeArguments* ParseTypeArguments( |
| 364 ClassFinalizer::FinalizationKind finalization); | 362 ClassFinalizer::FinalizationKind finalization); |
| 365 void ParseQualIdent(QualIdent* qual_ident); | 363 void ParseQualIdent(QualIdent* qual_ident); |
| 366 void ParseMethodOrConstructor(ClassDesc* members, MemberDesc* method); | 364 void ParseMethodOrConstructor(ClassDesc* members, MemberDesc* method); |
| 367 void ParseFieldDefinition(ClassDesc* members, MemberDesc* field); | 365 void ParseFieldDefinition(ClassDesc* members, MemberDesc* field); |
| 368 void CheckMemberNameConflict(ClassDesc* members, MemberDesc* member); | 366 void CheckMemberNameConflict(ClassDesc* members, MemberDesc* member); |
| 369 void ParseClassMemberDefinition(ClassDesc* members, | 367 void ParseClassMemberDefinition(ClassDesc* members, |
| 370 intptr_t metadata_pos); | 368 intptr_t metadata_pos); |
| 371 void ParseFormalParameter(bool allow_explicit_default_value, | 369 void ParseFormalParameter(bool allow_explicit_default_value, |
| 372 bool evaluate_metadata, | 370 bool evaluate_metadata, |
| 373 ParamList* params); | 371 ParamList* params); |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 545 AstNode* ParsePostfixExpr(); | 543 AstNode* ParsePostfixExpr(); |
| 546 AstNode* ParseSelectors(AstNode* primary, bool is_cascade); | 544 AstNode* ParseSelectors(AstNode* primary, bool is_cascade); |
| 547 AstNode* ParseCascades(AstNode* expr); | 545 AstNode* ParseCascades(AstNode* expr); |
| 548 AstNode* ParsePrimary(); | 546 AstNode* ParsePrimary(); |
| 549 AstNode* ParseStringLiteral(bool allow_interpolation); | 547 AstNode* ParseStringLiteral(bool allow_interpolation); |
| 550 String* ParseImportStringLiteral(); | 548 String* ParseImportStringLiteral(); |
| 551 AstNode* ParseCompoundLiteral(); | 549 AstNode* ParseCompoundLiteral(); |
| 552 AstNode* ParseSymbolLiteral(); | 550 AstNode* ParseSymbolLiteral(); |
| 553 AstNode* ParseListLiteral(intptr_t type_pos, | 551 AstNode* ParseListLiteral(intptr_t type_pos, |
| 554 bool is_const, | 552 bool is_const, |
| 555 const AbstractTypeArguments& type_arguments); | 553 const TypeArguments& type_arguments); |
| 556 AstNode* ParseMapLiteral(intptr_t type_pos, | 554 AstNode* ParseMapLiteral(intptr_t type_pos, |
| 557 bool is_const, | 555 bool is_const, |
| 558 const AbstractTypeArguments& type_arguments); | 556 const TypeArguments& type_arguments); |
| 559 AstNode* ParseNewOperator(Token::Kind op_kind); | 557 AstNode* ParseNewOperator(Token::Kind op_kind); |
| 560 | 558 |
| 561 // An implicit argument, if non-null, is prepended to the returned list. | 559 // An implicit argument, if non-null, is prepended to the returned list. |
| 562 ArgumentListNode* ParseActualParameters(ArgumentListNode* implicit_arguments, | 560 ArgumentListNode* ParseActualParameters(ArgumentListNode* implicit_arguments, |
| 563 bool require_const); | 561 bool require_const); |
| 564 AstNode* ParseStaticCall(const Class& cls, | 562 AstNode* ParseStaticCall(const Class& cls, |
| 565 const String& method_name, | 563 const String& method_name, |
| 566 intptr_t ident_pos); | 564 intptr_t ident_pos); |
| 567 AstNode* ParseInstanceCall(AstNode* receiver, const String& method_name); | 565 AstNode* ParseInstanceCall(AstNode* receiver, const String& method_name); |
| 568 AstNode* ParseClosureCall(AstNode* closure); | 566 AstNode* ParseClosureCall(AstNode* closure); |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 void EnsureSavedCurrentContext(); | 635 void EnsureSavedCurrentContext(); |
| 638 bool IsLegalAssignableSyntax(AstNode* expr, intptr_t end_pos); | 636 bool IsLegalAssignableSyntax(AstNode* expr, intptr_t end_pos); |
| 639 AstNode* CreateAssignmentNode(AstNode* original, | 637 AstNode* CreateAssignmentNode(AstNode* original, |
| 640 AstNode* rhs, | 638 AstNode* rhs, |
| 641 const String* left_ident, | 639 const String* left_ident, |
| 642 intptr_t left_pos); | 640 intptr_t left_pos); |
| 643 AstNode* InsertClosureCallNodes(AstNode* condition); | 641 AstNode* InsertClosureCallNodes(AstNode* condition); |
| 644 | 642 |
| 645 ConstructorCallNode* CreateConstructorCallNode( | 643 ConstructorCallNode* CreateConstructorCallNode( |
| 646 intptr_t token_pos, | 644 intptr_t token_pos, |
| 647 const AbstractTypeArguments& type_arguments, | 645 const TypeArguments& type_arguments, |
| 648 const Function& constructor, | 646 const Function& constructor, |
| 649 ArgumentListNode* arguments); | 647 ArgumentListNode* arguments); |
| 650 | 648 |
| 651 void AddEqualityNullCheck(); | 649 void AddEqualityNullCheck(); |
| 652 | 650 |
| 653 RawInstance* TryCanonicalize(const Instance& instance, intptr_t token_pos); | 651 RawInstance* TryCanonicalize(const Instance& instance, intptr_t token_pos); |
| 654 | 652 |
| 655 Isolate* isolate() const { return isolate_; } | 653 Isolate* isolate() const { return isolate_; } |
| 656 | 654 |
| 657 Isolate* isolate_; // Cached current isolate. | 655 Isolate* isolate_; // Cached current isolate. |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 708 intptr_t last_used_try_index_; | 706 intptr_t last_used_try_index_; |
| 709 | 707 |
| 710 bool unregister_pending_function_; | 708 bool unregister_pending_function_; |
| 711 | 709 |
| 712 DISALLOW_COPY_AND_ASSIGN(Parser); | 710 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 713 }; | 711 }; |
| 714 | 712 |
| 715 } // namespace dart | 713 } // namespace dart |
| 716 | 714 |
| 717 #endif // VM_PARSER_H_ | 715 #endif // VM_PARSER_H_ |
| OLD | NEW |