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

Unified Diff: runtime/vm/flow_graph_builder.cc

Issue 23482004: Evaluates arguments before throwing a NoSuchMethodError in constructor (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/flow_graph_builder.h ('k') | runtime/vm/parser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/flow_graph_builder.cc
===================================================================
--- runtime/vm/flow_graph_builder.cc (revision 26748)
+++ runtime/vm/flow_graph_builder.cc (working copy)
@@ -2748,6 +2748,7 @@
node->token_pos(),
node->cls(),
getter_name,
+ NULL, // No Arguments to getter.
InvocationMirror::EncodeType(
node->cls().IsTopLevel() ?
InvocationMirror::kTopLevel :
@@ -2797,10 +2798,13 @@
result_is_needed); // Save last arg if result is needed.
} else {
// Throw a NoSuchMethodError.
+ ArgumentListNode* arguments = new ArgumentListNode(node->token_pos());
+ arguments->Add(node->value());
call = BuildThrowNoSuchMethodError(
node->token_pos(),
node->cls(),
setter_name,
+ arguments, // Argument is the value passed to the setter.
InvocationMirror::EncodeType(
node->cls().IsTopLevel() ?
InvocationMirror::kTopLevel :
@@ -3566,6 +3570,7 @@
intptr_t token_pos,
const Class& function_class,
const String& function_name,
+ ArgumentListNode* function_arguments,
int invocation_type) {
ZoneGrowableArray<PushArgumentInstr*>* arguments =
new ZoneGrowableArray<PushArgumentInstr*>();
@@ -3590,13 +3595,25 @@
Smi::ZoneHandle(Smi::New(invocation_type))));
arguments->Add(PushArgument(invocation_type_value));
// List arguments.
- // TODO(regis): Pass arguments.
- Value* arguments_value = Bind(new ConstantInstr(Array::ZoneHandle()));
- arguments->Add(PushArgument(arguments_value));
+ if (function_arguments == NULL) {
+ Value* arguments_value = Bind(new ConstantInstr(Array::ZoneHandle()));
+ arguments->Add(PushArgument(arguments_value));
+ } else {
+ ValueGraphVisitor array_val(owner(), temp_index());
+ ArrayNode* array =
+ new ArrayNode(token_pos, Type::ZoneHandle(Type::ArrayType()),
+ function_arguments->nodes());
+ array->Visit(&array_val);
+ Append(array_val);
+ arguments->Add(PushArgument(array_val.value()));
+ }
// List argumentNames.
- Value* argument_names_value =
- Bind(new ConstantInstr(Array::ZoneHandle()));
+ ConstantInstr* cinstr = new ConstantInstr(
+ (function_arguments == NULL) ? Array::ZoneHandle()
+ : function_arguments->names());
+ Value* argument_names_value = Bind(cinstr);
arguments->Add(PushArgument(argument_names_value));
+
// List existingArgumentNames.
Value* existing_argument_names_value =
Bind(new ConstantInstr(Array::ZoneHandle()));
« no previous file with comments | « runtime/vm/flow_graph_builder.h ('k') | runtime/vm/parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698