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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 const Script& script); | 198 const Script& script); |
199 | 199 |
200 // Parse top level of a class and register all functions/fields. | 200 // Parse top level of a class and register all functions/fields. |
201 static void ParseClass(const Class& cls); | 201 static void ParseClass(const Class& cls); |
202 | 202 |
203 static void ParseFunction(ParsedFunction* parsed_function); | 203 static void ParseFunction(ParsedFunction* parsed_function); |
204 | 204 |
205 // Parse and evaluate the metadata expressions at token_pos in the | 205 // Parse and evaluate the metadata expressions at token_pos in the |
206 // class namespace of class cls (which can be the implicit toplevel | 206 // class namespace of class cls (which can be the implicit toplevel |
207 // class if the metadata is at the top-level). | 207 // class if the metadata is at the top-level). |
208 static RawObject* ParseMetadata(const Class& cls, intptr_t token_pos); | 208 static RawObject* ParseMetadata(const Field& meta_data); |
209 | 209 |
210 // Build a function containing the initializer expression of the | 210 // Build a function containing the initializer expression of the |
211 // given static field. | 211 // given static field. |
212 static ParsedFunction* ParseStaticFieldInitializer(const Field& field); | 212 static ParsedFunction* ParseStaticFieldInitializer(const Field& field); |
213 | 213 |
214 // Parse a function to retrieve parameter information that is not retained in | 214 // Parse a function to retrieve parameter information that is not retained in |
215 // the dart::Function object. Returns either an error if the parse fails | 215 // the dart::Function object. Returns either an error if the parse fails |
216 // (which could be the case for local functions), or a flat array of entries | 216 // (which could be the case for local functions), or a flat array of entries |
217 // for each parameter. Each parameter entry contains: | 217 // for each parameter. Each parameter entry contains: |
218 // * a Dart bool indicating whether the parameter was declared final | 218 // * a Dart bool indicating whether the parameter was declared final |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
392 intptr_t field_ref_pos); | 392 intptr_t field_ref_pos); |
393 RawObject* EvaluateConstConstructorCall(const Class& type_class, | 393 RawObject* EvaluateConstConstructorCall(const Class& type_class, |
394 const TypeArguments& type_arguments, | 394 const TypeArguments& type_arguments, |
395 const Function& constructor, | 395 const Function& constructor, |
396 ArgumentListNode* arguments); | 396 ArgumentListNode* arguments); |
397 LiteralNode* FoldConstExpr(intptr_t expr_pos, AstNode* expr); | 397 LiteralNode* FoldConstExpr(intptr_t expr_pos, AstNode* expr); |
398 | 398 |
399 // Support for parsing of scripts. | 399 // Support for parsing of scripts. |
400 void ParseTopLevel(); | 400 void ParseTopLevel(); |
401 void ParseEnumDeclaration(const GrowableObjectArray& pending_classes, | 401 void ParseEnumDeclaration(const GrowableObjectArray& pending_classes, |
402 const Class& toplevel_class, | 402 const Object& tl_owner, |
403 intptr_t metadata_pos); | 403 intptr_t metadata_pos); |
404 void ParseEnumDefinition(const Class& cls); | 404 void ParseEnumDefinition(const Class& cls); |
405 void ParseClassDeclaration(const GrowableObjectArray& pending_classes, | 405 void ParseClassDeclaration(const GrowableObjectArray& pending_classes, |
406 const Class& toplevel_class, | 406 const Object& tl_owner, |
407 intptr_t metadata_pos); | 407 intptr_t metadata_pos); |
408 void ParseClassDefinition(const Class& cls); | 408 void ParseClassDefinition(const Class& cls); |
409 void ParseMixinAppAlias(const GrowableObjectArray& pending_classes, | 409 void ParseMixinAppAlias(const GrowableObjectArray& pending_classes, |
410 const Class& toplevel_class, | 410 const Object& tl_owner, |
411 intptr_t metadata_pos); | 411 intptr_t metadata_pos); |
412 void ParseTypedef(const GrowableObjectArray& pending_classes, | 412 void ParseTypedef(const GrowableObjectArray& pending_classes, |
413 const Class& toplevel_class, | 413 const Object& tl_owner, |
414 intptr_t metadata_pos); | 414 intptr_t metadata_pos); |
415 void ParseTopLevelVariable(TopLevel* top_level, intptr_t metadata_pos); | 415 void ParseTopLevelVariable(TopLevel* top_level, |
416 void ParseTopLevelFunction(TopLevel* top_level, intptr_t metadata_pos); | 416 const Object& owner, intptr_t metadata_pos); |
417 void ParseTopLevelAccessor(TopLevel* top_level, intptr_t metadata_pos); | 417 void ParseTopLevelFunction(TopLevel* top_level, |
| 418 const Object& owner, intptr_t metadata_pos); |
| 419 void ParseTopLevelAccessor(TopLevel* top_level, |
| 420 const Object& owner, intptr_t metadata_pos); |
418 RawArray* EvaluateMetadata(); | 421 RawArray* EvaluateMetadata(); |
419 | 422 |
420 RawFunction::AsyncModifier ParseFunctionModifier(); | 423 RawFunction::AsyncModifier ParseFunctionModifier(); |
421 | 424 |
422 // Support for parsing libraries. | 425 // Support for parsing libraries. |
423 RawObject* CallLibraryTagHandler(Dart_LibraryTag tag, | 426 RawObject* CallLibraryTagHandler(Dart_LibraryTag tag, |
424 intptr_t token_pos, | 427 intptr_t token_pos, |
425 const String& url); | 428 const String& url); |
426 void ParseIdentList(GrowableObjectArray* names); | 429 void ParseIdentList(GrowableObjectArray* names); |
427 void ParseLibraryDefinition(); | 430 void ParseLibraryDefinition(const Object& tl_owner); |
428 void ParseLibraryName(); | 431 void ParseLibraryName(); |
429 void ParseLibraryImportExport(intptr_t metadata_pos); | 432 void ParseLibraryImportExport(const Object& tl_owner, |
| 433 intptr_t metadata_pos); |
430 void ParseLibraryPart(); | 434 void ParseLibraryPart(); |
431 void ParsePartHeader(); | 435 void ParsePartHeader(); |
432 void ParseLibraryNameObsoleteSyntax(); | 436 void ParseLibraryNameObsoleteSyntax(); |
433 void ParseLibraryImportObsoleteSyntax(); | 437 void ParseLibraryImportObsoleteSyntax(); |
434 void ParseLibraryIncludeObsoleteSyntax(); | 438 void ParseLibraryIncludeObsoleteSyntax(); |
435 | 439 |
436 void ResolveTypeFromClass(const Class& cls, | 440 void ResolveTypeFromClass(const Class& cls, |
437 ClassFinalizer::FinalizationKind finalization, | 441 ClassFinalizer::FinalizationKind finalization, |
438 AbstractType* type); | 442 AbstractType* type); |
439 RawAbstractType* ParseType(ClassFinalizer::FinalizationKind finalization, | 443 RawAbstractType* ParseType(ClassFinalizer::FinalizationKind finalization, |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
886 | 890 |
887 // Indentation of parser trace. | 891 // Indentation of parser trace. |
888 intptr_t trace_indent_; | 892 intptr_t trace_indent_; |
889 | 893 |
890 DISALLOW_COPY_AND_ASSIGN(Parser); | 894 DISALLOW_COPY_AND_ASSIGN(Parser); |
891 }; | 895 }; |
892 | 896 |
893 } // namespace dart | 897 } // namespace dart |
894 | 898 |
895 #endif // VM_PARSER_H_ | 899 #endif // VM_PARSER_H_ |
OLD | NEW |