| 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 "vm/ast.h" | 10 #include "vm/ast.h" |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 RawObject* EvaluateConstConstructorCall( | 298 RawObject* EvaluateConstConstructorCall( |
| 299 const Class& type_class, | 299 const Class& type_class, |
| 300 const AbstractTypeArguments& type_arguments, | 300 const AbstractTypeArguments& type_arguments, |
| 301 const Function& constructor, | 301 const Function& constructor, |
| 302 ArgumentListNode* arguments); | 302 ArgumentListNode* arguments); |
| 303 AstNode* FoldConstExpr(intptr_t expr_pos, AstNode* expr); | 303 AstNode* FoldConstExpr(intptr_t expr_pos, AstNode* expr); |
| 304 | 304 |
| 305 // Support for parsing of scripts. | 305 // Support for parsing of scripts. |
| 306 void ParseTopLevel(); | 306 void ParseTopLevel(); |
| 307 void ParseClassDefinition(const GrowableObjectArray& pending_classes); | 307 void ParseClassDefinition(const GrowableObjectArray& pending_classes); |
| 308 void ParseFunctionTypeAlias(const GrowableObjectArray& pending_classes); | 308 void ParseMixinTypedef(const GrowableObjectArray& pending_classes); |
| 309 void ParseTypedef(const GrowableObjectArray& pending_classes); |
| 309 void ParseTopLevelVariable(TopLevel* top_level); | 310 void ParseTopLevelVariable(TopLevel* top_level); |
| 310 void ParseTopLevelFunction(TopLevel* top_level); | 311 void ParseTopLevelFunction(TopLevel* top_level); |
| 311 void ParseTopLevelAccessor(TopLevel* top_level); | 312 void ParseTopLevelAccessor(TopLevel* top_level); |
| 312 | 313 |
| 313 // Support for parsing libraries. | 314 // Support for parsing libraries. |
| 314 Dart_Handle CallLibraryTagHandler(Dart_LibraryTag tag, | 315 Dart_Handle CallLibraryTagHandler(Dart_LibraryTag tag, |
| 315 intptr_t token_pos, | 316 intptr_t token_pos, |
| 316 const String& url); | 317 const String& url); |
| 317 void ParseIdentList(GrowableObjectArray* names); | 318 void ParseIdentList(GrowableObjectArray* names); |
| 318 void ParseLibraryDefinition(); | 319 void ParseLibraryDefinition(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 336 void ParseMethodOrConstructor(ClassDesc* members, MemberDesc* method); | 337 void ParseMethodOrConstructor(ClassDesc* members, MemberDesc* method); |
| 337 void ParseFieldDefinition(ClassDesc* members, MemberDesc* field); | 338 void ParseFieldDefinition(ClassDesc* members, MemberDesc* field); |
| 338 void ParseClassMemberDefinition(ClassDesc* members); | 339 void ParseClassMemberDefinition(ClassDesc* members); |
| 339 void ParseFormalParameter(bool allow_explicit_default_value, | 340 void ParseFormalParameter(bool allow_explicit_default_value, |
| 340 ParamList* params); | 341 ParamList* params); |
| 341 void ParseFormalParameters(bool allow_explicit_default_values, | 342 void ParseFormalParameters(bool allow_explicit_default_values, |
| 342 ParamList* params); | 343 ParamList* params); |
| 343 void ParseFormalParameterList(bool allow_explicit_default_values, | 344 void ParseFormalParameterList(bool allow_explicit_default_values, |
| 344 ParamList* params); | 345 ParamList* params); |
| 345 void CheckConstFieldsInitialized(const Class& cls); | 346 void CheckConstFieldsInitialized(const Class& cls); |
| 346 void AddImplicitConstructor(ClassDesc* members); | 347 void AddImplicitConstructor(const Class& cls); |
| 347 void CheckConstructors(ClassDesc* members); | 348 void CheckConstructors(ClassDesc* members); |
| 348 void ParseInitializedInstanceFields( | 349 void ParseInitializedInstanceFields( |
| 349 const Class& cls, | 350 const Class& cls, |
| 350 LocalVariable* receiver, | 351 LocalVariable* receiver, |
| 351 GrowableArray<Field*>* initialized_fields); | 352 GrowableArray<Field*>* initialized_fields); |
| 352 void CheckDuplicateFieldInit(intptr_t init_pos, | 353 void CheckDuplicateFieldInit(intptr_t init_pos, |
| 353 GrowableArray<Field*>* initialized_fields, | 354 GrowableArray<Field*>* initialized_fields, |
| 354 Field* field); | 355 Field* field); |
| 355 void GenerateSuperConstructorCall(const Class& cls, | 356 void GenerateSuperConstructorCall(const Class& cls, |
| 356 LocalVariable* receiver); | 357 LocalVariable* receiver); |
| 357 AstNode* ParseSuperInitializer(const Class& cls, LocalVariable* receiver); | 358 AstNode* ParseSuperInitializer(const Class& cls, LocalVariable* receiver); |
| 358 AstNode* ParseInitializer(const Class& cls, | 359 AstNode* ParseInitializer(const Class& cls, |
| 359 LocalVariable* receiver, | 360 LocalVariable* receiver, |
| 360 GrowableArray<Field*>* initialized_fields); | 361 GrowableArray<Field*>* initialized_fields); |
| 361 void ParseConstructorRedirection(const Class& cls, LocalVariable* receiver); | 362 void ParseConstructorRedirection(const Class& cls, LocalVariable* receiver); |
| 362 void ParseInitializers(const Class& cls, | 363 void ParseInitializers(const Class& cls, |
| 363 LocalVariable* receiver, | 364 LocalVariable* receiver, |
| 364 GrowableArray<Field*>* initialized_fields); | 365 GrowableArray<Field*>* initialized_fields); |
| 365 String& ParseNativeDeclaration(); | 366 String& ParseNativeDeclaration(); |
| 366 RawArray* ParseInterfaceList(const Type& super_type); | 367 RawArray* ParseInterfaceList(const Type& super_type); |
| 368 RawType* ParseMixins(const Type& super_type); |
| 367 void AddInterfaceIfUnique(intptr_t interfaces_pos, | 369 void AddInterfaceIfUnique(intptr_t interfaces_pos, |
| 368 const GrowableObjectArray& interface_list, | 370 const GrowableObjectArray& interface_list, |
| 369 const AbstractType& interface); | 371 const AbstractType& interface); |
| 370 void AddInterfaces(intptr_t interfaces_pos, | 372 void AddInterfaces(intptr_t interfaces_pos, |
| 371 const Class& cls, | 373 const Class& cls, |
| 372 const Array& interfaces); | 374 const Array& interfaces); |
| 373 StaticCallNode* BuildInvocationMirrorAllocation( | 375 StaticCallNode* BuildInvocationMirrorAllocation( |
| 374 intptr_t call_pos, | 376 intptr_t call_pos, |
| 375 const String& function_name, | 377 const String& function_name, |
| 376 const ArgumentListNode& function_args); | 378 const ArgumentListNode& function_args); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 459 bool is_const); | 461 bool is_const); |
| 460 AstNode* ParseVariableDeclarationList(); | 462 AstNode* ParseVariableDeclarationList(); |
| 461 AstNode* ParseFunctionStatement(bool is_literal); | 463 AstNode* ParseFunctionStatement(bool is_literal); |
| 462 AstNode* ParseStatement(); | 464 AstNode* ParseStatement(); |
| 463 SequenceNode* ParseNestedStatement(bool parsing_loop_body, | 465 SequenceNode* ParseNestedStatement(bool parsing_loop_body, |
| 464 SourceLabel* label); | 466 SourceLabel* label); |
| 465 void ParseStatementSequence(); | 467 void ParseStatementSequence(); |
| 466 bool IsIdentifier(); | 468 bool IsIdentifier(); |
| 467 bool IsSimpleLiteral(const AbstractType& type, Instance* value); | 469 bool IsSimpleLiteral(const AbstractType& type, Instance* value); |
| 468 bool IsFunctionTypeAliasName(); | 470 bool IsFunctionTypeAliasName(); |
| 471 bool IsMixinTypedef(); |
| 469 bool TryParseTypeParameter(); | 472 bool TryParseTypeParameter(); |
| 470 bool TryParseOptionalType(); | 473 bool TryParseOptionalType(); |
| 471 bool TryParseReturnType(); | 474 bool TryParseReturnType(); |
| 472 bool IsVariableDeclaration(); | 475 bool IsVariableDeclaration(); |
| 473 bool IsFunctionDeclaration(); | 476 bool IsFunctionDeclaration(); |
| 474 bool IsFunctionLiteral(); | 477 bool IsFunctionLiteral(); |
| 475 bool IsForInStatement(); | 478 bool IsForInStatement(); |
| 476 bool IsTopLevelAccessor(); | 479 bool IsTopLevelAccessor(); |
| 477 | 480 |
| 478 AstNode* ParseBinaryExpr(int min_preced); | 481 AstNode* ParseBinaryExpr(int min_preced); |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 const Function& current_function_; | 630 const Function& current_function_; |
| 628 | 631 |
| 629 // The function currently being parsed. | 632 // The function currently being parsed. |
| 630 Function& innermost_function_; | 633 Function& innermost_function_; |
| 631 | 634 |
| 632 // The class currently being parsed, or the owner class of the | 635 // The class currently being parsed, or the owner class of the |
| 633 // function currently being parsed. It is used for primary identifier lookups. | 636 // function currently being parsed. It is used for primary identifier lookups. |
| 634 Class& current_class_; | 637 Class& current_class_; |
| 635 | 638 |
| 636 // The current library (and thus class dictionary) used to resolve names. | 639 // The current library (and thus class dictionary) used to resolve names. |
| 640 // When parsing a function, this is the library in which the function |
| 641 // is defined. This can be the library in which the current_class_ is |
| 642 // defined, or the library of a mixin class where the function originates. |
| 637 const Library& library_; | 643 const Library& library_; |
| 638 | 644 |
| 639 // List of try blocks seen so far, this is used to generate inlined finally | 645 // List of try blocks seen so far, this is used to generate inlined finally |
| 640 // code at all points in the try block where an exit from the block is | 646 // code at all points in the try block where an exit from the block is |
| 641 // done using 'return', 'break' or 'continue' statements. | 647 // done using 'return', 'break' or 'continue' statements. |
| 642 TryBlocks* try_blocks_list_; | 648 TryBlocks* try_blocks_list_; |
| 643 | 649 |
| 644 // Allocate temporary only once per function. | 650 // Allocate temporary only once per function. |
| 645 LocalVariable* expression_temp_; | 651 LocalVariable* expression_temp_; |
| 646 | 652 |
| 647 // Allocate saved current context only if needed. | 653 // Allocate saved current context only if needed. |
| 648 LocalVariable* saved_current_context_; | 654 LocalVariable* saved_current_context_; |
| 649 | 655 |
| 650 DISALLOW_COPY_AND_ASSIGN(Parser); | 656 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 651 }; | 657 }; |
| 652 | 658 |
| 653 } // namespace dart | 659 } // namespace dart |
| 654 | 660 |
| 655 #endif // VM_PARSER_H_ | 661 #endif // VM_PARSER_H_ |
| OLD | NEW |