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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
137 // Parse top level of a class and register all functions/fields. | 137 // Parse top level of a class and register all functions/fields. |
138 static void ParseClass(const Class& cls); | 138 static void ParseClass(const Class& cls); |
139 | 139 |
140 static void ParseFunction(ParsedFunction* parsed_function); | 140 static void ParseFunction(ParsedFunction* parsed_function); |
141 | 141 |
142 // Parse and evaluate the metadata expressions at token_pos in the | 142 // Parse and evaluate the metadata expressions at token_pos in the |
143 // class namespace of class cls (which can be the implicit toplevel | 143 // class namespace of class cls (which can be the implicit toplevel |
144 // class if the metadata is at the top-level). | 144 // class if the metadata is at the top-level). |
145 static RawObject* ParseMetadata(const Class& cls, intptr_t token_pos); | 145 static RawObject* ParseMetadata(const Class& cls, intptr_t token_pos); |
146 | 146 |
147 // Parse a function func and retrieve parameter information that can not be | 147 // Parse a function func and retrieve parameter information that cannot be |
148 // found in its function object. Returns either an error if the parser fails | 148 // found in its function object. Returns either an error if the parser fails |
149 // (which could be the case for local functions), or a flat array of the size | 149 // (which could be the case for local functions), or a flat array of the size |
150 // (2*number_of_parameters). For each parameter i in this array, (2*i) | 150 // (3*number_of_parameters). For each parameter i in this array, (3*i) |
151 // contains a bool indicating whether the parameter has been final, and | 151 // contains a bool indicating whether the parameter has been final, (3*i+1) |
siva
2013/08/28 23:26:48
Ditto comment about '3' here.
| |
152 // (2*i+1) contains an array of its default values (or null if it has no | 152 // contains an array of its default values (or null if it has no default |
153 // default values). | 153 // values), and (3*i+2) contains an array of metadata (or null if no metadata |
154 // was declared). | |
154 static RawObject* ParseFunctionParameters(const Function& func); | 155 static RawObject* ParseFunctionParameters(const Function& func); |
155 | 156 |
156 // Format and print a message with source location. | 157 // Format and print a message with source location. |
157 // A null script means no source and a negative token_pos means no position. | 158 // A null script means no source and a negative token_pos means no position. |
158 static void PrintMessage(const Script& script, | 159 static void PrintMessage(const Script& script, |
159 intptr_t token_pos, | 160 intptr_t token_pos, |
160 const char* message_header, | 161 const char* message_header, |
161 const char* format, ...) PRINTF_ATTRIBUTE(4, 5); | 162 const char* format, ...) PRINTF_ATTRIBUTE(4, 5); |
162 | 163 |
163 // Build an error object containing a formatted error or warning message. | 164 // Build an error object containing a formatted error or warning message. |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
375 RawAbstractType* ParseType(ClassFinalizer::FinalizationKind finalization); | 376 RawAbstractType* ParseType(ClassFinalizer::FinalizationKind finalization); |
376 void ParseTypeParameters(const Class& cls); | 377 void ParseTypeParameters(const Class& cls); |
377 RawAbstractTypeArguments* ParseTypeArguments( | 378 RawAbstractTypeArguments* ParseTypeArguments( |
378 ClassFinalizer::FinalizationKind finalization); | 379 ClassFinalizer::FinalizationKind finalization); |
379 void ParseQualIdent(QualIdent* qual_ident); | 380 void ParseQualIdent(QualIdent* qual_ident); |
380 void ParseMethodOrConstructor(ClassDesc* members, MemberDesc* method); | 381 void ParseMethodOrConstructor(ClassDesc* members, MemberDesc* method); |
381 void ParseFieldDefinition(ClassDesc* members, MemberDesc* field); | 382 void ParseFieldDefinition(ClassDesc* members, MemberDesc* field); |
382 void ParseClassMemberDefinition(ClassDesc* members, | 383 void ParseClassMemberDefinition(ClassDesc* members, |
383 intptr_t metadata_pos); | 384 intptr_t metadata_pos); |
384 void ParseFormalParameter(bool allow_explicit_default_value, | 385 void ParseFormalParameter(bool allow_explicit_default_value, |
386 bool evaluate_metadata, | |
385 ParamList* params); | 387 ParamList* params); |
386 void ParseFormalParameters(bool allow_explicit_default_values, | 388 void ParseFormalParameters(bool allow_explicit_default_values, |
389 bool evaluate_metadata, | |
387 ParamList* params); | 390 ParamList* params); |
388 void ParseFormalParameterList(bool allow_explicit_default_values, | 391 void ParseFormalParameterList(bool allow_explicit_default_values, |
392 bool evaluate_metadata, | |
389 ParamList* params); | 393 ParamList* params); |
390 void CheckConstFieldsInitialized(const Class& cls); | 394 void CheckConstFieldsInitialized(const Class& cls); |
391 void CheckConstructors(ClassDesc* members); | 395 void CheckConstructors(ClassDesc* members); |
392 AstNode* ParseExternalInitializedField(const Field& field); | 396 AstNode* ParseExternalInitializedField(const Field& field); |
393 void ParseInitializedInstanceFields( | 397 void ParseInitializedInstanceFields( |
394 const Class& cls, | 398 const Class& cls, |
395 LocalVariable* receiver, | 399 LocalVariable* receiver, |
396 GrowableArray<Field*>* initialized_fields); | 400 GrowableArray<Field*>* initialized_fields); |
397 void CheckDuplicateFieldInit(intptr_t init_pos, | 401 void CheckDuplicateFieldInit(intptr_t init_pos, |
398 GrowableArray<Field*>* initialized_fields, | 402 GrowableArray<Field*>* initialized_fields, |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
708 intptr_t last_used_try_index_; | 712 intptr_t last_used_try_index_; |
709 | 713 |
710 bool unregister_pending_function_; | 714 bool unregister_pending_function_; |
711 | 715 |
712 DISALLOW_COPY_AND_ASSIGN(Parser); | 716 DISALLOW_COPY_AND_ASSIGN(Parser); |
713 }; | 717 }; |
714 | 718 |
715 } // namespace dart | 719 } // namespace dart |
716 | 720 |
717 #endif // VM_PARSER_H_ | 721 #endif // VM_PARSER_H_ |
OLD | NEW |