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 "lib/invocation_mirror.h" | 10 #include "lib/invocation_mirror.h" |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 | 214 |
215 // The class being parsed. | 215 // The class being parsed. |
216 const Class& current_class() const; | 216 const Class& current_class() const; |
217 void set_current_class(const Class& value); | 217 void set_current_class(const Class& value); |
218 | 218 |
219 // ParsedFunction accessor. | 219 // ParsedFunction accessor. |
220 ParsedFunction* parsed_function() const { | 220 ParsedFunction* parsed_function() const { |
221 return parsed_function_; | 221 return parsed_function_; |
222 } | 222 } |
223 | 223 |
| 224 const Script& script() const { return script_; } |
| 225 void SetScript(const Script& script, intptr_t token_pos); |
| 226 |
| 227 const Library& library() const { return library_; } |
| 228 void set_library(const Library& value) const { library_ = value.raw(); } |
| 229 |
224 // Parsing a library or a regular source script. | 230 // Parsing a library or a regular source script. |
225 bool is_library_source() const { | 231 bool is_library_source() const { |
226 return (script_.kind() == RawScript::kScriptTag) || | 232 return (script_.kind() == RawScript::kScriptTag) || |
227 (script_.kind() == RawScript::kLibraryTag); | 233 (script_.kind() == RawScript::kLibraryTag); |
228 } | 234 } |
229 | 235 |
230 bool is_part_source() const { | 236 bool is_part_source() const { |
231 return script_.kind() == RawScript::kSourceTag; | 237 return script_.kind() == RawScript::kSourceTag; |
232 } | 238 } |
233 | 239 |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 void ParseClassMemberDefinition(ClassDesc* members); | 367 void ParseClassMemberDefinition(ClassDesc* members); |
362 void ParseFormalParameter(bool allow_explicit_default_value, | 368 void ParseFormalParameter(bool allow_explicit_default_value, |
363 ParamList* params); | 369 ParamList* params); |
364 void ParseFormalParameters(bool allow_explicit_default_values, | 370 void ParseFormalParameters(bool allow_explicit_default_values, |
365 ParamList* params); | 371 ParamList* params); |
366 void ParseFormalParameterList(bool allow_explicit_default_values, | 372 void ParseFormalParameterList(bool allow_explicit_default_values, |
367 ParamList* params); | 373 ParamList* params); |
368 void CheckConstFieldsInitialized(const Class& cls); | 374 void CheckConstFieldsInitialized(const Class& cls); |
369 void AddImplicitConstructor(const Class& cls); | 375 void AddImplicitConstructor(const Class& cls); |
370 void CheckConstructors(ClassDesc* members); | 376 void CheckConstructors(ClassDesc* members); |
| 377 AstNode* ParseExternalInitializedField(const Field& field); |
371 void ParseInitializedInstanceFields( | 378 void ParseInitializedInstanceFields( |
372 const Class& cls, | 379 const Class& cls, |
373 LocalVariable* receiver, | 380 LocalVariable* receiver, |
374 GrowableArray<Field*>* initialized_fields); | 381 GrowableArray<Field*>* initialized_fields); |
375 void CheckDuplicateFieldInit(intptr_t init_pos, | 382 void CheckDuplicateFieldInit(intptr_t init_pos, |
376 GrowableArray<Field*>* initialized_fields, | 383 GrowableArray<Field*>* initialized_fields, |
377 Field* field); | 384 Field* field); |
378 void GenerateSuperConstructorCall(const Class& cls, | 385 void GenerateSuperConstructorCall(const Class& cls, |
379 LocalVariable* receiver); | 386 LocalVariable* receiver); |
380 AstNode* ParseSuperInitializer(const Class& cls, LocalVariable* receiver); | 387 AstNode* ParseSuperInitializer(const Class& cls, LocalVariable* receiver); |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
620 AstNode* InsertClosureCallNodes(AstNode* condition); | 627 AstNode* InsertClosureCallNodes(AstNode* condition); |
621 | 628 |
622 ConstructorCallNode* CreateConstructorCallNode( | 629 ConstructorCallNode* CreateConstructorCallNode( |
623 intptr_t token_pos, | 630 intptr_t token_pos, |
624 const AbstractTypeArguments& type_arguments, | 631 const AbstractTypeArguments& type_arguments, |
625 const Function& constructor, | 632 const Function& constructor, |
626 ArgumentListNode* arguments); | 633 ArgumentListNode* arguments); |
627 | 634 |
628 LocalVariable* BuildArrayTempLocal(intptr_t token_pos); | 635 LocalVariable* BuildArrayTempLocal(intptr_t token_pos); |
629 | 636 |
630 const Script& script_; | 637 Script& script_; |
631 TokenStream::Iterator tokens_iterator_; | 638 TokenStream::Iterator tokens_iterator_; |
632 Token::Kind token_kind_; // Cached token kind for current token. | 639 Token::Kind token_kind_; // Cached token kind for current token. |
633 Block* current_block_; | 640 Block* current_block_; |
634 | 641 |
635 // is_top_level_ is true if parsing the "top level" of a compilation unit, | 642 // is_top_level_ is true if parsing the "top level" of a compilation unit, |
636 // that is class definitions, function type aliases, global functions, | 643 // that is class definitions, function type aliases, global functions, |
637 // global variables. | 644 // global variables. |
638 bool is_top_level_; | 645 bool is_top_level_; |
639 | 646 |
640 // The member currently being parsed during "top level" parsing. | 647 // The member currently being parsed during "top level" parsing. |
(...skipping 11 matching lines...) Expand all Loading... |
652 Function& innermost_function_; | 659 Function& innermost_function_; |
653 | 660 |
654 // The class currently being parsed, or the owner class of the | 661 // The class currently being parsed, or the owner class of the |
655 // function currently being parsed. It is used for primary identifier lookups. | 662 // function currently being parsed. It is used for primary identifier lookups. |
656 Class& current_class_; | 663 Class& current_class_; |
657 | 664 |
658 // The current library (and thus class dictionary) used to resolve names. | 665 // The current library (and thus class dictionary) used to resolve names. |
659 // When parsing a function, this is the library in which the function | 666 // When parsing a function, this is the library in which the function |
660 // is defined. This can be the library in which the current_class_ is | 667 // is defined. This can be the library in which the current_class_ is |
661 // defined, or the library of a mixin class where the function originates. | 668 // defined, or the library of a mixin class where the function originates. |
662 const Library& library_; | 669 Library& library_; |
663 | 670 |
664 // List of try blocks seen so far, this is used to generate inlined finally | 671 // List of try blocks seen so far, this is used to generate inlined finally |
665 // code at all points in the try block where an exit from the block is | 672 // code at all points in the try block where an exit from the block is |
666 // done using 'return', 'break' or 'continue' statements. | 673 // done using 'return', 'break' or 'continue' statements. |
667 TryBlocks* try_blocks_list_; | 674 TryBlocks* try_blocks_list_; |
668 | 675 |
669 DISALLOW_COPY_AND_ASSIGN(Parser); | 676 DISALLOW_COPY_AND_ASSIGN(Parser); |
670 }; | 677 }; |
671 | 678 |
672 } // namespace dart | 679 } // namespace dart |
673 | 680 |
674 #endif // VM_PARSER_H_ | 681 #endif // VM_PARSER_H_ |
OLD | NEW |