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

Unified Diff: runtime/vm/compiler.cc

Issue 9965081: Detect recursion during compilation of const constructors. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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 | runtime/vm/object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/compiler.cc
===================================================================
--- runtime/vm/compiler.cc (revision 6125)
+++ runtime/vm/compiler.cc (working copy)
@@ -111,6 +111,14 @@
static RawError* CompileFunctionHelper(const Function& function,
bool optimized) {
+ if (function.is_compiling()) {
+ ASSERT(function.is_const() && function.IsConstructor());
+ const String& msg = String::Handle(String::NewFormatted(
+ "Illegal recursion in const constructor '%s'.",
+ String::Handle(function.name()).ToCString()));
+ return LanguageError::New(msg);
+ }
+ function.set_is_compiling(true);
Isolate* isolate = Isolate::Current();
Error& error = Error::Handle();
LongJump* base = isolate->long_jump_base();
@@ -303,6 +311,7 @@
isolate->object_store()->clear_sticky_error();
}
isolate->set_long_jump_base(base);
+ function.set_is_compiling(false);
return error.raw();
}
« no previous file with comments | « no previous file | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698