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

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

Issue 15979010: Fix two bugs in the Dart VM's super-noSuchMethod invocation. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 6 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
« no previous file with comments | « runtime/vm/flow_graph_inliner.cc ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 return expression_temp_var_; 94 return expression_temp_var_;
95 } 95 }
96 void set_expression_temp_var(LocalVariable* value) { 96 void set_expression_temp_var(LocalVariable* value) {
97 ASSERT(!has_expression_temp_var()); 97 ASSERT(!has_expression_temp_var());
98 expression_temp_var_ = value; 98 expression_temp_var_ = value;
99 } 99 }
100 bool has_expression_temp_var() const { 100 bool has_expression_temp_var() const {
101 return expression_temp_var_ != NULL; 101 return expression_temp_var_ != NULL;
102 } 102 }
103 static LocalVariable* CreateExpressionTempVar(intptr_t token_pos); 103 static LocalVariable* CreateExpressionTempVar(intptr_t token_pos);
104 LocalVariable* EnsureExpressionTemp();
104 105
105 int first_parameter_index() const { return first_parameter_index_; } 106 int first_parameter_index() const { return first_parameter_index_; }
106 int first_stack_local_index() const { return first_stack_local_index_; } 107 int first_stack_local_index() const { return first_stack_local_index_; }
107 int num_copied_params() const { return num_copied_params_; } 108 int num_copied_params() const { return num_copied_params_; }
108 int num_stack_locals() const { return num_stack_locals_; } 109 int num_stack_locals() const { return num_stack_locals_; }
109 110
110 void AllocateVariables(); 111 void AllocateVariables();
111 112
112 private: 113 private:
113 const Function& function_; 114 const Function& function_;
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 162
162 // Same as FormatError, but appends the new error to the 'prev_error'. 163 // Same as FormatError, but appends the new error to the 'prev_error'.
163 static RawError* FormatErrorWithAppend(const Error& prev_error, 164 static RawError* FormatErrorWithAppend(const Error& prev_error,
164 const Script& script, 165 const Script& script,
165 intptr_t token_pos, 166 intptr_t token_pos,
166 const char* message_header, 167 const char* message_header,
167 const char* format, 168 const char* format,
168 va_list args); 169 va_list args);
169 170
170 private: 171 private:
172 friend class EffectGraphVisitor; // For BuildNoSuchMethodArguments.
173
171 struct Block; 174 struct Block;
172 class TryBlocks; 175 class TryBlocks;
173 176
174 Parser(const Script& script, const Library& library, intptr_t token_pos); 177 Parser(const Script& script, const Library& library, intptr_t token_pos);
175 Parser(const Script& script, ParsedFunction* function, intptr_t token_pos); 178 Parser(const Script& script, ParsedFunction* function, intptr_t token_pos);
176 179
177 // The function for which we will generate code. 180 // The function for which we will generate code.
178 const Function& current_function() const; 181 const Function& current_function() const;
179 182
180 // The innermost function being parsed. 183 // The innermost function being parsed.
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 AstNode* ParseInitializer(const Class& cls, 381 AstNode* ParseInitializer(const Class& cls,
379 LocalVariable* receiver, 382 LocalVariable* receiver,
380 GrowableArray<Field*>* initialized_fields); 383 GrowableArray<Field*>* initialized_fields);
381 void ParseConstructorRedirection(const Class& cls, LocalVariable* receiver); 384 void ParseConstructorRedirection(const Class& cls, LocalVariable* receiver);
382 void ParseInitializers(const Class& cls, 385 void ParseInitializers(const Class& cls,
383 LocalVariable* receiver, 386 LocalVariable* receiver,
384 GrowableArray<Field*>* initialized_fields); 387 GrowableArray<Field*>* initialized_fields);
385 String& ParseNativeDeclaration(); 388 String& ParseNativeDeclaration();
386 void ParseInterfaceList(const Class& cls); 389 void ParseInterfaceList(const Class& cls);
387 RawAbstractType* ParseMixins(const AbstractType& super_type); 390 RawAbstractType* ParseMixins(const AbstractType& super_type);
388 StaticCallNode* BuildInvocationMirrorAllocation( 391 static StaticCallNode* BuildInvocationMirrorAllocation(
389 intptr_t call_pos, 392 intptr_t call_pos,
390 const String& function_name, 393 const String& function_name,
391 const ArgumentListNode& function_args); 394 const ArgumentListNode& function_args,
392 ArgumentListNode* BuildNoSuchMethodArguments( 395 const LocalVariable* temp = NULL);
396 // Build arguments for a NoSuchMethodCall. If LocalVariable temp is not NULL,
397 // the last argument is stored in temp.
398 static ArgumentListNode* BuildNoSuchMethodArguments(
393 intptr_t call_pos, 399 intptr_t call_pos,
394 const String& function_name, 400 const String& function_name,
395 const ArgumentListNode& function_args); 401 const ArgumentListNode& function_args,
402 const LocalVariable* temp = NULL);
396 RawFunction* GetSuperFunction(intptr_t token_pos, 403 RawFunction* GetSuperFunction(intptr_t token_pos,
397 const String& name, 404 const String& name,
398 ArgumentListNode* arguments, 405 ArgumentListNode* arguments,
399 bool resolve_getter, 406 bool resolve_getter,
400 bool* is_no_such_method); 407 bool* is_no_such_method);
401 AstNode* ParseSuperCall(const String& function_name); 408 AstNode* ParseSuperCall(const String& function_name);
402 AstNode* ParseSuperFieldAccess(const String& field_name); 409 AstNode* ParseSuperFieldAccess(const String& field_name);
403 AstNode* ParseSuperOperator(); 410 AstNode* ParseSuperOperator();
404 AstNode* BuildUnarySuperOperator(Token::Kind op, PrimaryNode* super); 411 AstNode* BuildUnarySuperOperator(Token::Kind op, PrimaryNode* super);
405 412
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 AstNode* MakeAssertCall(intptr_t begin, intptr_t end); 610 AstNode* MakeAssertCall(intptr_t begin, intptr_t end);
604 AstNode* ThrowTypeError(intptr_t type_pos, const AbstractType& type); 611 AstNode* ThrowTypeError(intptr_t type_pos, const AbstractType& type);
605 AstNode* ThrowNoSuchMethodError(intptr_t call_pos, 612 AstNode* ThrowNoSuchMethodError(intptr_t call_pos,
606 const Class& cls, 613 const Class& cls,
607 const String& function_name, 614 const String& function_name,
608 InvocationMirror::Call call, 615 InvocationMirror::Call call,
609 InvocationMirror::Type type); 616 InvocationMirror::Type type);
610 617
611 void CheckOperatorArity(const MemberDesc& member); 618 void CheckOperatorArity(const MemberDesc& member);
612 619
613 const LocalVariable* GetIncrementTempLocal();
614 void EnsureExpressionTemp(); 620 void EnsureExpressionTemp();
615 void EnsureSavedCurrentContext(); 621 void EnsureSavedCurrentContext();
616 AstNode* CreateAssignmentNode(AstNode* original, AstNode* rhs); 622 AstNode* CreateAssignmentNode(AstNode* original, AstNode* rhs);
617 AstNode* InsertClosureCallNodes(AstNode* condition); 623 AstNode* InsertClosureCallNodes(AstNode* condition);
618 624
619 ConstructorCallNode* CreateConstructorCallNode( 625 ConstructorCallNode* CreateConstructorCallNode(
620 intptr_t token_pos, 626 intptr_t token_pos,
621 const AbstractTypeArguments& type_arguments, 627 const AbstractTypeArguments& type_arguments,
622 const Function& constructor, 628 const Function& constructor,
623 ArgumentListNode* arguments); 629 ArgumentListNode* arguments);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
663 // code at all points in the try block where an exit from the block is 669 // code at all points in the try block where an exit from the block is
664 // done using 'return', 'break' or 'continue' statements. 670 // done using 'return', 'break' or 'continue' statements.
665 TryBlocks* try_blocks_list_; 671 TryBlocks* try_blocks_list_;
666 672
667 DISALLOW_COPY_AND_ASSIGN(Parser); 673 DISALLOW_COPY_AND_ASSIGN(Parser);
668 }; 674 };
669 675
670 } // namespace dart 676 } // namespace dart
671 677
672 #endif // VM_PARSER_H_ 678 #endif // VM_PARSER_H_
OLDNEW
« no previous file with comments | « runtime/vm/flow_graph_inliner.cc ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698