Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(343)

Side by Side Diff: runtime/vm/parser.h

Issue 14820028: Delay Class parsing until the class is actually used. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 int first_stack_local_index_; 136 int first_stack_local_index_;
137 int num_copied_params_; 137 int num_copied_params_;
138 int num_stack_locals_; 138 int num_stack_locals_;
139 139
140 DISALLOW_COPY_AND_ASSIGN(ParsedFunction); 140 DISALLOW_COPY_AND_ASSIGN(ParsedFunction);
141 }; 141 };
142 142
143 143
144 class Parser : public ValueObject { 144 class Parser : public ValueObject {
145 public: 145 public:
146 Parser(const Script& script, const Library& library); 146 Parser(const Script& script, const Library& library, intptr_t token_pos);
Ivan Posva 2013/05/23 05:10:37 Do these constructors need to be public?
siva 2013/05/23 20:19:46 Made them private. On 2013/05/23 05:10:37, Ivan P
147 Parser(const Script& script, ParsedFunction* function, intptr_t token_pos); 147 Parser(const Script& script, ParsedFunction* function, intptr_t token_pos);
148 148
149 // Parse the top level of a whole script file and register declared classes 149 // Parse the top level of a whole script file and register declared classes
150 // in the given library. 150 // in the given library.
151 static void ParseCompilationUnit(const Library& library, 151 static void ParseCompilationUnit(const Library& library,
152 const Script& script); 152 const Script& script);
153 153
154 // Parse top level of a class and register all functions/fields.
155 static void ParseClass(const Class& cls);
156
154 static void ParseFunction(ParsedFunction* parsed_function); 157 static void ParseFunction(ParsedFunction* parsed_function);
155 158
156 // Format and print a message with source location. 159 // Format and print a message with source location.
157 // A null script means no source and a negative token_pos means no position. 160 // A null script means no source and a negative token_pos means no position.
158 static void PrintMessage(const Script& script, 161 static void PrintMessage(const Script& script,
159 intptr_t token_pos, 162 intptr_t token_pos,
160 const char* message_header, 163 const char* message_header,
161 const char* format, ...) PRINTF_ATTRIBUTE(4, 5); 164 const char* format, ...) PRINTF_ATTRIBUTE(4, 5);
162 165
163 // Build an error object containing a formatted error or warning message. 166 // Build an error object containing a formatted error or warning message.
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 AstNode* RunStaticFieldInitializer(const Field& field); 328 AstNode* RunStaticFieldInitializer(const Field& field);
326 RawObject* EvaluateConstConstructorCall( 329 RawObject* EvaluateConstConstructorCall(
327 const Class& type_class, 330 const Class& type_class,
328 const AbstractTypeArguments& type_arguments, 331 const AbstractTypeArguments& type_arguments,
329 const Function& constructor, 332 const Function& constructor,
330 ArgumentListNode* arguments); 333 ArgumentListNode* arguments);
331 AstNode* FoldConstExpr(intptr_t expr_pos, AstNode* expr); 334 AstNode* FoldConstExpr(intptr_t expr_pos, AstNode* expr);
332 335
333 // Support for parsing of scripts. 336 // Support for parsing of scripts.
334 void ParseTopLevel(); 337 void ParseTopLevel();
335 void ParseClassDefinition(const GrowableObjectArray& pending_classes); 338 void ParseClassDeclaration(const GrowableObjectArray& pending_classes);
339 void ParseClassDefinition(const Class& cls);
336 void ParseMixinTypedef(const GrowableObjectArray& pending_classes); 340 void ParseMixinTypedef(const GrowableObjectArray& pending_classes);
337 void ParseTypedef(const GrowableObjectArray& pending_classes); 341 void ParseTypedef(const GrowableObjectArray& pending_classes);
338 void ParseTopLevelVariable(TopLevel* top_level); 342 void ParseTopLevelVariable(TopLevel* top_level);
339 void ParseTopLevelFunction(TopLevel* top_level); 343 void ParseTopLevelFunction(TopLevel* top_level);
340 void ParseTopLevelAccessor(TopLevel* top_level); 344 void ParseTopLevelAccessor(TopLevel* top_level);
341 345
342 // Support for parsing libraries. 346 // Support for parsing libraries.
343 RawObject* CallLibraryTagHandler(Dart_LibraryTag tag, 347 RawObject* CallLibraryTagHandler(Dart_LibraryTag tag,
344 intptr_t token_pos, 348 intptr_t token_pos,
345 const String& url); 349 const String& url);
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
672 // code at all points in the try block where an exit from the block is 676 // code at all points in the try block where an exit from the block is
673 // done using 'return', 'break' or 'continue' statements. 677 // done using 'return', 'break' or 'continue' statements.
674 TryBlocks* try_blocks_list_; 678 TryBlocks* try_blocks_list_;
675 679
676 DISALLOW_COPY_AND_ASSIGN(Parser); 680 DISALLOW_COPY_AND_ASSIGN(Parser);
677 }; 681 };
678 682
679 } // namespace dart 683 } // namespace dart
680 684
681 #endif // VM_PARSER_H_ 685 #endif // VM_PARSER_H_
OLDNEW
« runtime/vm/compiler.cc ('K') | « runtime/vm/object_test.cc ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698