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

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

Issue 22685007: Implement updated method overriding rules in the vm. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 4 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // A null script means no source and a negative token_pos means no position. 155 // A null script means no source and a negative token_pos means no position.
156 static RawError* FormatError(const Script& script, 156 static RawError* FormatError(const Script& script,
157 intptr_t token_pos, 157 intptr_t token_pos,
158 const char* message_header, 158 const char* message_header,
159 const char* format, 159 const char* format,
160 va_list args); 160 va_list args);
161 static RawError* FormatErrorMsg(const Script& script, 161 static RawError* FormatErrorMsg(const Script& script,
162 intptr_t token_pos, 162 intptr_t token_pos,
163 const char* message_header, 163 const char* message_header,
164 const char* format, ...) 164 const char* format, ...)
165 PRINTF_ATTRIBUTE(4, 5); 165 PRINTF_ATTRIBUTE(4, 5);
166 166
167 // Same as FormatError, but appends the new error to the 'prev_error'. 167 // Same as FormatError, but appends the new error to the 'prev_error'.
168 static RawError* FormatErrorWithAppend(const Error& prev_error, 168 static RawError* FormatErrorWithAppend(const Error& prev_error,
169 const Script& script, 169 const Script& script,
170 intptr_t token_pos, 170 intptr_t token_pos,
171 const char* message_header, 171 const char* message_header,
172 const char* format, 172 const char* format,
173 va_list args); 173 va_list args);
174 174
175 static void AddImplicitConstructor(const Class& cls);
176
175 private: 177 private:
176 friend class EffectGraphVisitor; // For BuildNoSuchMethodArguments. 178 friend class EffectGraphVisitor; // For BuildNoSuchMethodArguments.
177 179
178 struct Block; 180 struct Block;
179 class TryBlocks; 181 class TryBlocks;
180 182
181 Parser(const Script& script, const Library& library, intptr_t token_pos); 183 Parser(const Script& script, const Library& library, intptr_t token_pos);
182 Parser(const Script& script, ParsedFunction* function, intptr_t token_pos); 184 Parser(const Script& script, ParsedFunction* function, intptr_t token_pos);
183 185
184 // The function for which we will generate code. 186 // The function for which we will generate code.
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 Function& constructor, 293 Function& constructor,
292 const AbstractTypeArguments& type_arguments); 294 const AbstractTypeArguments& type_arguments);
293 295
294 // A null script means no source and a negative token_pos means no position. 296 // A null script means no source and a negative token_pos means no position.
295 static RawString* FormatMessage(const Script& script, 297 static RawString* FormatMessage(const Script& script,
296 intptr_t token_pos, 298 intptr_t token_pos,
297 const char* message_header, 299 const char* message_header,
298 const char* format, 300 const char* format,
299 va_list args); 301 va_list args);
300 302
301 // Reports error/warning message at location of current token. 303 // Reports error/warning msg at location of current token in current script.
302 void ErrorMsg(const char* msg, ...) PRINTF_ATTRIBUTE(2, 3); 304 void ErrorMsg(const char* msg, ...) PRINTF_ATTRIBUTE(2, 3);
303 void Warning(const char* msg, ...) PRINTF_ATTRIBUTE(2, 3); 305 void Warning(const char* msg, ...) PRINTF_ATTRIBUTE(2, 3);
304 void Unimplemented(const char* msg); 306 void Unimplemented(const char* msg);
305 307
306 // Reports error message at given location. 308 // Reports error message at given location in current script.
307 void ErrorMsg(intptr_t token_pos, const char* msg, ...) const 309 void ErrorMsg(intptr_t token_pos, const char* msg, ...) const
308 PRINTF_ATTRIBUTE(3, 4); 310 PRINTF_ATTRIBUTE(3, 4);
309 void Warning(intptr_t token_pos, const char* msg, ...) 311 void Warning(intptr_t token_pos, const char* msg, ...)
310 PRINTF_ATTRIBUTE(3, 4); 312 PRINTF_ATTRIBUTE(3, 4);
311 313
312 // Reports an already formatted error message. 314 // Reports an already formatted error message.
313 void ErrorMsg(const Error& error); 315 static void ErrorMsg(const Error& error);
314 316
315 // Concatenates two error messages, the previous and the current one. 317 // Concatenates two error messages, the previous and the current one.
316 void AppendErrorMsg( 318 void AppendErrorMsg(
317 const Error& prev_error, intptr_t token_pos, const char* format, ...) 319 const Error& prev_error, intptr_t token_pos, const char* format, ...)
318 PRINTF_ATTRIBUTE(4, 5); 320 PRINTF_ATTRIBUTE(4, 5);
319 321
320 const Instance& EvaluateConstExpr(AstNode* expr); 322 const Instance& EvaluateConstExpr(AstNode* expr);
321 AstNode* RunStaticFieldInitializer(const Field& field); 323 AstNode* RunStaticFieldInitializer(const Field& field);
322 RawObject* EvaluateConstConstructorCall( 324 RawObject* EvaluateConstConstructorCall(
323 const Class& type_class, 325 const Class& type_class,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 void ParseFieldDefinition(ClassDesc* members, MemberDesc* field); 366 void ParseFieldDefinition(ClassDesc* members, MemberDesc* field);
365 void ParseClassMemberDefinition(ClassDesc* members, 367 void ParseClassMemberDefinition(ClassDesc* members,
366 intptr_t metadata_pos); 368 intptr_t metadata_pos);
367 void ParseFormalParameter(bool allow_explicit_default_value, 369 void ParseFormalParameter(bool allow_explicit_default_value,
368 ParamList* params); 370 ParamList* params);
369 void ParseFormalParameters(bool allow_explicit_default_values, 371 void ParseFormalParameters(bool allow_explicit_default_values,
370 ParamList* params); 372 ParamList* params);
371 void ParseFormalParameterList(bool allow_explicit_default_values, 373 void ParseFormalParameterList(bool allow_explicit_default_values,
372 ParamList* params); 374 ParamList* params);
373 void CheckConstFieldsInitialized(const Class& cls); 375 void CheckConstFieldsInitialized(const Class& cls);
374 void AddImplicitConstructor(const Class& cls);
375 void CheckConstructors(ClassDesc* members); 376 void CheckConstructors(ClassDesc* members);
376 AstNode* ParseExternalInitializedField(const Field& field); 377 AstNode* ParseExternalInitializedField(const Field& field);
377 void ParseInitializedInstanceFields( 378 void ParseInitializedInstanceFields(
378 const Class& cls, 379 const Class& cls,
379 LocalVariable* receiver, 380 LocalVariable* receiver,
380 GrowableArray<Field*>* initialized_fields); 381 GrowableArray<Field*>* initialized_fields);
381 void CheckDuplicateFieldInit(intptr_t init_pos, 382 void CheckDuplicateFieldInit(intptr_t init_pos,
382 GrowableArray<Field*>* initialized_fields, 383 GrowableArray<Field*>* initialized_fields,
383 Field* field); 384 Field* field);
384 void GenerateSuperConstructorCall(const Class& cls, 385 void GenerateSuperConstructorCall(const Class& cls,
(...skipping 30 matching lines...) Expand all
415 AstNode* ParseSuperCall(const String& function_name); 416 AstNode* ParseSuperCall(const String& function_name);
416 AstNode* ParseSuperFieldAccess(const String& field_name); 417 AstNode* ParseSuperFieldAccess(const String& field_name);
417 AstNode* ParseSuperOperator(); 418 AstNode* ParseSuperOperator();
418 AstNode* BuildUnarySuperOperator(Token::Kind op, PrimaryNode* super); 419 AstNode* BuildUnarySuperOperator(Token::Kind op, PrimaryNode* super);
419 420
420 static void SetupDefaultsForOptionalParams(const ParamList* params, 421 static void SetupDefaultsForOptionalParams(const ParamList* params,
421 Array& default_values); 422 Array& default_values);
422 AstNode* CreateImplicitClosureNode(const Function& func, 423 AstNode* CreateImplicitClosureNode(const Function& func,
423 intptr_t token_pos, 424 intptr_t token_pos,
424 AstNode* receiver); 425 AstNode* receiver);
425 void AddFormalParamsToFunction(const ParamList* params, const Function& func); 426 static void AddFormalParamsToFunction(const ParamList* params,
427 const Function& func);
426 void AddFormalParamsToScope(const ParamList* params, LocalScope* scope); 428 void AddFormalParamsToScope(const ParamList* params, LocalScope* scope);
427 429
428 SequenceNode* ParseConstructor(const Function& func, 430 SequenceNode* ParseConstructor(const Function& func,
429 Array& default_parameter_values); 431 Array& default_parameter_values);
430 SequenceNode* ParseFunc(const Function& func, 432 SequenceNode* ParseFunc(const Function& func,
431 Array& default_parameter_values); 433 Array& default_parameter_values);
432 434
433 void ParseNativeFunctionBlock(const ParamList* params, const Function& func); 435 void ParseNativeFunctionBlock(const ParamList* params, const Function& func);
434 436
435 SequenceNode* ParseInstanceGetter(const Function& func); 437 SequenceNode* ParseInstanceGetter(const Function& func);
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 AstNode* GenerateStaticFieldLookup(const Field& field, 550 AstNode* GenerateStaticFieldLookup(const Field& field,
549 intptr_t ident_pos); 551 intptr_t ident_pos);
550 AstNode* ParseStaticFieldAccess(const Class& cls, 552 AstNode* ParseStaticFieldAccess(const Class& cls,
551 const String& field_name, 553 const String& field_name,
552 intptr_t ident_pos, 554 intptr_t ident_pos,
553 bool consume_cascades); 555 bool consume_cascades);
554 556
555 LocalVariable* LookupLocalScope(const String& ident); 557 LocalVariable* LookupLocalScope(const String& ident);
556 void CheckInstanceFieldAccess(intptr_t field_pos, const String& field_name); 558 void CheckInstanceFieldAccess(intptr_t field_pos, const String& field_name);
557 bool ParsingStaticMember() const; 559 bool ParsingStaticMember() const;
558 const Type* ReceiverType() const; 560 static const AbstractType* ReceiverType(const Class& cls);
559 bool IsInstantiatorRequired() const; 561 bool IsInstantiatorRequired() const;
560 bool ResolveIdentInLocalScope(intptr_t ident_pos, 562 bool ResolveIdentInLocalScope(intptr_t ident_pos,
561 const String &ident, 563 const String &ident,
562 AstNode** node); 564 AstNode** node);
563 static const bool kResolveLocally = true; 565 static const bool kResolveLocally = true;
564 static const bool kResolveIncludingImports = false; 566 static const bool kResolveIncludingImports = false;
565 567
566 // Resolve a primary identifier in the library or prefix scope and 568 // Resolve a primary identifier in the library or prefix scope and
567 // generate the corresponding AstNode. 569 // generate the corresponding AstNode.
568 AstNode* ResolveIdentInCurrentLibraryScope(intptr_t ident_pos, 570 AstNode* ResolveIdentInCurrentLibraryScope(intptr_t ident_pos,
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 // Each try in this function gets its own try index. 691 // Each try in this function gets its own try index.
690 intptr_t AllocateTryIndex() { return ++last_used_try_index_; } 692 intptr_t AllocateTryIndex() { return ++last_used_try_index_; }
691 intptr_t last_used_try_index_; 693 intptr_t last_used_try_index_;
692 694
693 DISALLOW_COPY_AND_ASSIGN(Parser); 695 DISALLOW_COPY_AND_ASSIGN(Parser);
694 }; 696 };
695 697
696 } // namespace dart 698 } // namespace dart
697 699
698 #endif // VM_PARSER_H_ 700 #endif // VM_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698