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

Unified Diff: runtime/vm/parser.cc

Issue 37193002: VM: Fix evaluation order when throwing an AbstractClassInstantiationError. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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 | « no previous file | tests/co19/co19-runtime.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/parser.cc
===================================================================
--- runtime/vm/parser.cc (revision 29071)
+++ runtime/vm/parser.cc (working copy)
@@ -9827,14 +9827,21 @@
// a dynamic error to instantiate an abstract class.
ASSERT(!constructor.IsNull());
if (type_class.is_abstract() && !constructor.IsFactory()) {
- ArgumentListNode* arguments = new ArgumentListNode(type_pos);
- arguments->Add(new LiteralNode(
+ // Evaluate arguments before throwing.
+ LetNode * result = new LetNode(call_pos);
zra 2013/10/23 14:46:06 Extra space between LetNode and *
Florian Schneider 2013/10/23 16:31:15 Done.
+ for (intptr_t i = 0; i < arguments->length(); ++i) {
+ result->AddNode(arguments->NodeAt(i));
+ }
+ ArgumentListNode* error_arguments = new ArgumentListNode(type_pos);
+ error_arguments->Add(new LiteralNode(
TokenPos(), Integer::ZoneHandle(Integer::New(type_pos))));
- arguments->Add(new LiteralNode(
+ error_arguments->Add(new LiteralNode(
TokenPos(), String::ZoneHandle(type_class_name.raw())));
- return MakeStaticCall(Symbols::AbstractClassInstantiationError(),
- Library::PrivateCoreLibName(Symbols::ThrowNew()),
- arguments);
+ result->AddNode(
+ MakeStaticCall(Symbols::AbstractClassInstantiationError(),
+ Library::PrivateCoreLibName(Symbols::ThrowNew()),
+ error_arguments));
+ return result;
}
String& error_message = String::Handle();
if (!constructor.AreValidArguments(arguments_length,
« no previous file with comments | « no previous file | tests/co19/co19-runtime.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698