| 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 "vm/ast.h" | 10 #include "vm/ast.h" | 
| (...skipping 10 matching lines...) Expand all  Loading... | 
| 21 | 21 | 
| 22 struct TopLevel; | 22 struct TopLevel; | 
| 23 struct ClassDesc; | 23 struct ClassDesc; | 
| 24 struct MemberDesc; | 24 struct MemberDesc; | 
| 25 struct ParamList; | 25 struct ParamList; | 
| 26 struct QualIdent; | 26 struct QualIdent; | 
| 27 struct CatchParamDesc; | 27 struct CatchParamDesc; | 
| 28 struct FieldInitExpression; | 28 struct FieldInitExpression; | 
| 29 | 29 | 
| 30 // The class ParsedFunction holds the result of parsing a function. | 30 // The class ParsedFunction holds the result of parsing a function. | 
| 31 class ParsedFunction : ValueObject { | 31 class ParsedFunction : public ValueObject { | 
| 32  public: | 32  public: | 
| 33   static const int kFirstLocalSlotIndex = -2; | 33   static const int kFirstLocalSlotIndex = -2; | 
| 34 | 34 | 
| 35   explicit ParsedFunction(const Function& function) | 35   explicit ParsedFunction(const Function& function) | 
| 36       : function_(function), | 36       : function_(function), | 
| 37         node_sequence_(NULL), | 37         node_sequence_(NULL), | 
| 38         instantiator_(NULL), | 38         instantiator_(NULL), | 
| 39         default_parameter_values_(Array::Handle()), | 39         default_parameter_values_(Array::Handle()), | 
| 40         saved_context_var_(NULL), | 40         saved_context_var_(NULL), | 
| 41         expression_temp_var_(NULL), | 41         expression_temp_var_(NULL), | 
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 98 | 98 | 
| 99   int first_parameter_index_; | 99   int first_parameter_index_; | 
| 100   int first_stack_local_index_; | 100   int first_stack_local_index_; | 
| 101   int copied_parameter_count_; | 101   int copied_parameter_count_; | 
| 102   int stack_local_count_; | 102   int stack_local_count_; | 
| 103 | 103 | 
| 104   DISALLOW_COPY_AND_ASSIGN(ParsedFunction); | 104   DISALLOW_COPY_AND_ASSIGN(ParsedFunction); | 
| 105 }; | 105 }; | 
| 106 | 106 | 
| 107 | 107 | 
| 108 class Parser : ValueObject { | 108 class Parser : public ValueObject { | 
| 109  public: | 109  public: | 
| 110   Parser(const Script& script, const Library& library); | 110   Parser(const Script& script, const Library& library); | 
| 111   Parser(const Script& script, const Function& function, intptr_t token_pos); | 111   Parser(const Script& script, const Function& function, intptr_t token_pos); | 
| 112 | 112 | 
| 113   // Parse the top level of a whole script file and register declared classes | 113   // Parse the top level of a whole script file and register declared classes | 
| 114   // and interfaces in the given library. | 114   // and interfaces in the given library. | 
| 115   static void ParseCompilationUnit(const Library& library, | 115   static void ParseCompilationUnit(const Library& library, | 
| 116                                    const Script& script); | 116                                    const Script& script); | 
| 117 | 117 | 
| 118   static void ParseFunction(ParsedFunction* parsed_function); | 118   static void ParseFunction(ParsedFunction* parsed_function); | 
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 306   void ParseClassMemberDefinition(ClassDesc* members); | 306   void ParseClassMemberDefinition(ClassDesc* members); | 
| 307   void ParseFormalParameter(bool allow_explicit_default_value, | 307   void ParseFormalParameter(bool allow_explicit_default_value, | 
| 308                             ParamList* params); | 308                             ParamList* params); | 
| 309   void ParseFormalParameters(bool allow_explicit_default_values, | 309   void ParseFormalParameters(bool allow_explicit_default_values, | 
| 310                              ParamList* params); | 310                              ParamList* params); | 
| 311   void ParseFormalParameterList(bool allow_explicit_default_values, | 311   void ParseFormalParameterList(bool allow_explicit_default_values, | 
| 312                                 ParamList* params); | 312                                 ParamList* params); | 
| 313   void CheckConstFieldsInitialized(const Class& cls); | 313   void CheckConstFieldsInitialized(const Class& cls); | 
| 314   void AddImplicitConstructor(ClassDesc* members); | 314   void AddImplicitConstructor(ClassDesc* members); | 
| 315   void CheckConstructorCycles(ClassDesc* members); | 315   void CheckConstructorCycles(ClassDesc* members); | 
| 316   void ParseInitializedInstanceFields(const Class& cls, | 316   void ParseInitializedInstanceFields( | 
| 317            LocalVariable* receiver, | 317       const Class& cls, | 
| 318            GrowableArray<Field*>* initialized_fields); | 318       LocalVariable* receiver, | 
|  | 319       GrowableArray<Field*>* initialized_fields); | 
| 319   void CheckDuplicateFieldInit(intptr_t init_pos, | 320   void CheckDuplicateFieldInit(intptr_t init_pos, | 
| 320                                GrowableArray<Field*>* initialized_fields, | 321                                GrowableArray<Field*>* initialized_fields, | 
| 321                                Field* field); | 322                                Field* field); | 
| 322   void GenerateSuperConstructorCall(const Class& cls, | 323   void GenerateSuperConstructorCall(const Class& cls, | 
| 323                                     LocalVariable* receiver); | 324                                     LocalVariable* receiver); | 
| 324   AstNode* ParseSuperInitializer(const Class& cls, LocalVariable* receiver); | 325   AstNode* ParseSuperInitializer(const Class& cls, LocalVariable* receiver); | 
| 325   AstNode* ParseInitializer(const Class& cls, | 326   AstNode* ParseInitializer(const Class& cls, | 
| 326                             LocalVariable* receiver, | 327                             LocalVariable* receiver, | 
| 327                             GrowableArray<Field*>* initialized_fields); | 328                             GrowableArray<Field*>* initialized_fields); | 
| 328   void ParseConstructorRedirection(const Class& cls, LocalVariable* receiver); | 329   void ParseConstructorRedirection(const Class& cls, LocalVariable* receiver); | 
| 329   void ParseInitializers(const Class& cls, | 330   void ParseInitializers(const Class& cls, | 
| 330                          LocalVariable* receiver, | 331                          LocalVariable* receiver, | 
| 331                          GrowableArray<Field*>* initialized_fields); | 332                          GrowableArray<Field*>* initialized_fields); | 
| 332   String& ParseNativeDeclaration(); | 333   String& ParseNativeDeclaration(); | 
| 333   // TODO(srdjan): Return TypeArguments instead of Array? | 334   // TODO(srdjan): Return TypeArguments instead of Array? | 
| 334   RawArray* ParseInterfaceList(); | 335   RawArray* ParseInterfaceList(); | 
|  | 336   void AddInterfaceIfUnique(intptr_t interfaces_pos, | 
|  | 337                             const GrowableObjectArray& interface_list, | 
|  | 338                             const AbstractType& interface); | 
| 335   void AddInterfaces(intptr_t interfaces_pos, | 339   void AddInterfaces(intptr_t interfaces_pos, | 
| 336                      const Class& cls, | 340                      const Class& cls, | 
| 337                      const Array& interfaces); | 341                      const Array& interfaces); | 
| 338   ArgumentListNode* BuildNoSuchMethodArguments( | 342   ArgumentListNode* BuildNoSuchMethodArguments( | 
| 339       const String& function_name, const ArgumentListNode& function_args); | 343       const String& function_name, const ArgumentListNode& function_args); | 
| 340   RawFunction* GetSuperFunction(intptr_t token_pos, | 344   RawFunction* GetSuperFunction(intptr_t token_pos, | 
| 341                                 const String& name, | 345                                 const String& name, | 
| 342                                 bool* is_no_such_method); | 346                                 bool* is_no_such_method); | 
| 343   AstNode* ParseSuperCall(const String& function_name); | 347   AstNode* ParseSuperCall(const String& function_name); | 
| 344   AstNode* ParseSuperFieldAccess(const String& field_name); | 348   AstNode* ParseSuperFieldAccess(const String& field_name); | 
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 590 | 594 | 
| 591   // Allocate temporary only once per function. | 595   // Allocate temporary only once per function. | 
| 592   LocalVariable* expression_temp_; | 596   LocalVariable* expression_temp_; | 
| 593 | 597 | 
| 594   DISALLOW_COPY_AND_ASSIGN(Parser); | 598   DISALLOW_COPY_AND_ASSIGN(Parser); | 
| 595 }; | 599 }; | 
| 596 | 600 | 
| 597 }  // namespace dart | 601 }  // namespace dart | 
| 598 | 602 | 
| 599 #endif  // VM_PARSER_H_ | 603 #endif  // VM_PARSER_H_ | 
| OLD | NEW | 
|---|