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

Unified Diff: runtime/lib/error.cc

Issue 9316100: Fix for issue 1307: throw runtime exception instead of reporting a compile time error if a static... (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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/lib/error.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/error.cc
===================================================================
--- runtime/lib/error.cc (revision 3908)
+++ runtime/lib/error.cc (working copy)
@@ -203,6 +203,34 @@
}
+// Allocate and throw StaticResolutionException.
+// Arg0: index of the static call that was not resolved at compile time.
+// Return value: none, throws an exception.
+DEFINE_NATIVE_ENTRY(StaticResolutionException_throwNew, 1) {
+ GET_NATIVE_ARGUMENT(Smi, smi_pos, arguments->At(0));
+ intptr_t call_pos = smi_pos.Value();
+ // Allocate a new instance of type StaticResolutionException.
+ const Instance& resolution_exception =
+ Instance::Handle(NewInstance("StaticResolutionException"));
+ ASSERT(!resolution_exception.IsNull());
+
+ // Initialize 'url', 'line', and 'column' fields.
+ DartFrameIterator iterator;
+ iterator.NextFrame(); // Skip native call.
+ const Script& script = Script::Handle(GetCallerScript(&iterator));
+ const Class& cls = Class::Handle(resolution_exception.clazz());
+ SetLocationFields(resolution_exception, cls, script, call_pos);
+
+ intptr_t line, column;
+ script.GetTokenLocation(call_pos, &line, &column);
+ SetField(resolution_exception, cls, "failedResolutionLine",
+ String::Handle(script.GetLine(line)));
+
+ Exceptions::Throw(resolution_exception);
+ UNREACHABLE();
+}
+
+
// Check that the type of the given instance is assignable to the given type.
// Arg0: index of the token of the assignment (source location).
// Arg1: instance being assigned.
« no previous file with comments | « no previous file | runtime/lib/error.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698