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 29 matching lines...) Expand all Loading... |
40 public: | 40 public: |
41 explicit ParsedFunction(const Function& function) | 41 explicit ParsedFunction(const Function& function) |
42 : function_(function), | 42 : function_(function), |
43 code_(Code::Handle(function.unoptimized_code())), | 43 code_(Code::Handle(function.unoptimized_code())), |
44 node_sequence_(NULL), | 44 node_sequence_(NULL), |
45 instantiator_(NULL), | 45 instantiator_(NULL), |
46 default_parameter_values_(Array::ZoneHandle()), | 46 default_parameter_values_(Array::ZoneHandle()), |
47 saved_current_context_var_(NULL), | 47 saved_current_context_var_(NULL), |
48 saved_entry_context_var_(NULL), | 48 saved_entry_context_var_(NULL), |
49 expression_temp_var_(NULL), | 49 expression_temp_var_(NULL), |
| 50 deferred_prefixes_(NULL), |
50 first_parameter_index_(0), | 51 first_parameter_index_(0), |
51 first_stack_local_index_(0), | 52 first_stack_local_index_(0), |
52 num_copied_params_(0), | 53 num_copied_params_(0), |
53 num_stack_locals_(0) { | 54 num_stack_locals_(0) { |
54 ASSERT(function.IsZoneHandle()); | 55 ASSERT(function.IsZoneHandle()); |
55 } | 56 } |
56 | 57 |
57 const Function& function() const { return function_; } | 58 const Function& function() const { return function_; } |
58 RawCode* code() const { return code_.raw(); } | 59 RawCode* code() const { return code_.raw(); } |
59 | 60 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 void set_expression_temp_var(LocalVariable* value) { | 102 void set_expression_temp_var(LocalVariable* value) { |
102 ASSERT(!has_expression_temp_var()); | 103 ASSERT(!has_expression_temp_var()); |
103 expression_temp_var_ = value; | 104 expression_temp_var_ = value; |
104 } | 105 } |
105 bool has_expression_temp_var() const { | 106 bool has_expression_temp_var() const { |
106 return expression_temp_var_ != NULL; | 107 return expression_temp_var_ != NULL; |
107 } | 108 } |
108 static LocalVariable* CreateExpressionTempVar(intptr_t token_pos); | 109 static LocalVariable* CreateExpressionTempVar(intptr_t token_pos); |
109 LocalVariable* EnsureExpressionTemp(); | 110 LocalVariable* EnsureExpressionTemp(); |
110 | 111 |
| 112 bool HasDeferredPrefixes() const { return deferred_prefixes_ != NULL; } |
| 113 GrowableObjectArray* DeferredPrefixes() const { return deferred_prefixes_; } |
| 114 void AddDeferredPrefix(const LibraryPrefix& prefix); |
| 115 |
111 int first_parameter_index() const { return first_parameter_index_; } | 116 int first_parameter_index() const { return first_parameter_index_; } |
112 int first_stack_local_index() const { return first_stack_local_index_; } | 117 int first_stack_local_index() const { return first_stack_local_index_; } |
113 int num_copied_params() const { return num_copied_params_; } | 118 int num_copied_params() const { return num_copied_params_; } |
114 int num_stack_locals() const { return num_stack_locals_; } | 119 int num_stack_locals() const { return num_stack_locals_; } |
115 | 120 |
116 void AllocateVariables(); | 121 void AllocateVariables(); |
117 | 122 |
118 private: | 123 private: |
119 const Function& function_; | 124 const Function& function_; |
120 Code& code_; | 125 Code& code_; |
121 SequenceNode* node_sequence_; | 126 SequenceNode* node_sequence_; |
122 AstNode* instantiator_; | 127 AstNode* instantiator_; |
123 Array& default_parameter_values_; | 128 Array& default_parameter_values_; |
124 LocalVariable* saved_current_context_var_; | 129 LocalVariable* saved_current_context_var_; |
125 LocalVariable* saved_entry_context_var_; | 130 LocalVariable* saved_entry_context_var_; |
126 LocalVariable* expression_temp_var_; | 131 LocalVariable* expression_temp_var_; |
| 132 GrowableObjectArray* deferred_prefixes_; |
127 | 133 |
128 int first_parameter_index_; | 134 int first_parameter_index_; |
129 int first_stack_local_index_; | 135 int first_stack_local_index_; |
130 int num_copied_params_; | 136 int num_copied_params_; |
131 int num_stack_locals_; | 137 int num_stack_locals_; |
132 | 138 |
133 DISALLOW_COPY_AND_ASSIGN(ParsedFunction); | 139 DISALLOW_COPY_AND_ASSIGN(ParsedFunction); |
134 }; | 140 }; |
135 | 141 |
136 | 142 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 void ParseLibraryImportExport(intptr_t metadata_pos); | 355 void ParseLibraryImportExport(intptr_t metadata_pos); |
350 void ParseLibraryPart(); | 356 void ParseLibraryPart(); |
351 void ParsePartHeader(); | 357 void ParsePartHeader(); |
352 void ParseLibraryNameObsoleteSyntax(); | 358 void ParseLibraryNameObsoleteSyntax(); |
353 void ParseLibraryImportObsoleteSyntax(); | 359 void ParseLibraryImportObsoleteSyntax(); |
354 void ParseLibraryIncludeObsoleteSyntax(); | 360 void ParseLibraryIncludeObsoleteSyntax(); |
355 | 361 |
356 void ResolveTypeFromClass(const Class& cls, | 362 void ResolveTypeFromClass(const Class& cls, |
357 ClassFinalizer::FinalizationKind finalization, | 363 ClassFinalizer::FinalizationKind finalization, |
358 AbstractType* type); | 364 AbstractType* type); |
359 RawAbstractType* ParseType(ClassFinalizer::FinalizationKind finalization); | 365 RawAbstractType* ParseType(ClassFinalizer::FinalizationKind finalization, |
| 366 bool allow_deferred_type = false); |
360 void ParseTypeParameters(const Class& cls); | 367 void ParseTypeParameters(const Class& cls); |
361 RawTypeArguments* ParseTypeArguments( | 368 RawTypeArguments* ParseTypeArguments( |
362 ClassFinalizer::FinalizationKind finalization); | 369 ClassFinalizer::FinalizationKind finalization); |
363 void ParseQualIdent(QualIdent* qual_ident); | 370 void ParseQualIdent(QualIdent* qual_ident); |
364 void ParseMethodOrConstructor(ClassDesc* members, MemberDesc* method); | 371 void ParseMethodOrConstructor(ClassDesc* members, MemberDesc* method); |
365 void ParseFieldDefinition(ClassDesc* members, MemberDesc* field); | 372 void ParseFieldDefinition(ClassDesc* members, MemberDesc* field); |
366 void CheckMemberNameConflict(ClassDesc* members, MemberDesc* member); | 373 void CheckMemberNameConflict(ClassDesc* members, MemberDesc* member); |
367 void ParseClassMemberDefinition(ClassDesc* members, | 374 void ParseClassMemberDefinition(ClassDesc* members, |
368 intptr_t metadata_pos); | 375 intptr_t metadata_pos); |
369 void ParseFormalParameter(bool allow_explicit_default_value, | 376 void ParseFormalParameter(bool allow_explicit_default_value, |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 intptr_t last_used_try_index_; | 713 intptr_t last_used_try_index_; |
707 | 714 |
708 bool unregister_pending_function_; | 715 bool unregister_pending_function_; |
709 | 716 |
710 DISALLOW_COPY_AND_ASSIGN(Parser); | 717 DISALLOW_COPY_AND_ASSIGN(Parser); |
711 }; | 718 }; |
712 | 719 |
713 } // namespace dart | 720 } // namespace dart |
714 | 721 |
715 #endif // VM_PARSER_H_ | 722 #endif // VM_PARSER_H_ |
OLD | NEW |