| 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 to retrieve parameter information that is not retained in |
| 148 // found in its function object. Returns either an error if the parser fails | 148 // the dart::Function object. Returns either an error if the parse 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 entries |
| 150 // (2*number_of_parameters). For each parameter i in this array, (2*i) | 150 // for each parameter. Each parameter entry contains: |
| 151 // contains a bool indicating whether the parameter has been final, and | 151 // * a Dart bool indicating whether the parameter was declared final |
| 152 // (2*i+1) contains an array of its default values (or null if it has no | 152 // * its default value (or null if none was declared) |
| 153 // default values). | 153 // * an array of metadata (or null if no metadata was declared). |
| 154 enum { |
| 155 kParameterIsFinalOffset, |
| 156 kParameterDefaultValueOffset, |
| 157 kParameterMetadataOffset, |
| 158 kParameterEntrySize, |
| 159 }; |
| 154 static RawObject* ParseFunctionParameters(const Function& func); | 160 static RawObject* ParseFunctionParameters(const Function& func); |
| 155 | 161 |
| 156 // Format and print a message with source location. | 162 // Format and print a message with source location. |
| 157 // A null script means no source and a negative token_pos means no position. | 163 // A null script means no source and a negative token_pos means no position. |
| 158 static void PrintMessage(const Script& script, | 164 static void PrintMessage(const Script& script, |
| 159 intptr_t token_pos, | 165 intptr_t token_pos, |
| 160 const char* message_header, | 166 const char* message_header, |
| 161 const char* format, ...) PRINTF_ATTRIBUTE(4, 5); | 167 const char* format, ...) PRINTF_ATTRIBUTE(4, 5); |
| 162 | 168 |
| 163 // Build an error object containing a formatted error or warning message. | 169 // 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); | 381 RawAbstractType* ParseType(ClassFinalizer::FinalizationKind finalization); |
| 376 void ParseTypeParameters(const Class& cls); | 382 void ParseTypeParameters(const Class& cls); |
| 377 RawAbstractTypeArguments* ParseTypeArguments( | 383 RawAbstractTypeArguments* ParseTypeArguments( |
| 378 ClassFinalizer::FinalizationKind finalization); | 384 ClassFinalizer::FinalizationKind finalization); |
| 379 void ParseQualIdent(QualIdent* qual_ident); | 385 void ParseQualIdent(QualIdent* qual_ident); |
| 380 void ParseMethodOrConstructor(ClassDesc* members, MemberDesc* method); | 386 void ParseMethodOrConstructor(ClassDesc* members, MemberDesc* method); |
| 381 void ParseFieldDefinition(ClassDesc* members, MemberDesc* field); | 387 void ParseFieldDefinition(ClassDesc* members, MemberDesc* field); |
| 382 void ParseClassMemberDefinition(ClassDesc* members, | 388 void ParseClassMemberDefinition(ClassDesc* members, |
| 383 intptr_t metadata_pos); | 389 intptr_t metadata_pos); |
| 384 void ParseFormalParameter(bool allow_explicit_default_value, | 390 void ParseFormalParameter(bool allow_explicit_default_value, |
| 391 bool evaluate_metadata, |
| 385 ParamList* params); | 392 ParamList* params); |
| 386 void ParseFormalParameters(bool allow_explicit_default_values, | 393 void ParseFormalParameters(bool allow_explicit_default_values, |
| 394 bool evaluate_metadata, |
| 387 ParamList* params); | 395 ParamList* params); |
| 388 void ParseFormalParameterList(bool allow_explicit_default_values, | 396 void ParseFormalParameterList(bool allow_explicit_default_values, |
| 397 bool evaluate_metadata, |
| 389 ParamList* params); | 398 ParamList* params); |
| 390 void CheckConstFieldsInitialized(const Class& cls); | 399 void CheckConstFieldsInitialized(const Class& cls); |
| 391 void CheckConstructors(ClassDesc* members); | 400 void CheckConstructors(ClassDesc* members); |
| 392 AstNode* ParseExternalInitializedField(const Field& field); | 401 AstNode* ParseExternalInitializedField(const Field& field); |
| 393 void ParseInitializedInstanceFields( | 402 void ParseInitializedInstanceFields( |
| 394 const Class& cls, | 403 const Class& cls, |
| 395 LocalVariable* receiver, | 404 LocalVariable* receiver, |
| 396 GrowableArray<Field*>* initialized_fields); | 405 GrowableArray<Field*>* initialized_fields); |
| 397 void CheckDuplicateFieldInit(intptr_t init_pos, | 406 void CheckDuplicateFieldInit(intptr_t init_pos, |
| 398 GrowableArray<Field*>* initialized_fields, | 407 GrowableArray<Field*>* initialized_fields, |
| (...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 intptr_t last_used_try_index_; | 718 intptr_t last_used_try_index_; |
| 710 | 719 |
| 711 bool unregister_pending_function_; | 720 bool unregister_pending_function_; |
| 712 | 721 |
| 713 DISALLOW_COPY_AND_ASSIGN(Parser); | 722 DISALLOW_COPY_AND_ASSIGN(Parser); |
| 714 }; | 723 }; |
| 715 | 724 |
| 716 } // namespace dart | 725 } // namespace dart |
| 717 | 726 |
| 718 #endif // VM_PARSER_H_ | 727 #endif // VM_PARSER_H_ |
| OLD | NEW |