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

Unified Diff: runtime/vm/exceptions.cc

Issue 2044753002: Make compile-time errors catchable (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address review comments Created 4 years, 3 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/exceptions.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/exceptions.cc
diff --git a/runtime/vm/exceptions.cc b/runtime/vm/exceptions.cc
index d8cd5d6cefeb96501befd813ecc6cd6225bc08f6..edfad992738d998c5147186c3a5be71d1d14b771 100644
--- a/runtime/vm/exceptions.cc
+++ b/runtime/vm/exceptions.cc
@@ -651,6 +651,13 @@ void Exceptions::ThrowRangeError(const char* argument_name,
}
+void Exceptions::ThrowCompileTimeError(const LanguageError& error) {
+ const Array& args = Array::Handle(Array::New(1));
+ args.SetAt(0, String::Handle(error.FormatMessage()));
+ Exceptions::ThrowByType(Exceptions::kCompileTimeError, args);
+}
+
+
RawObject* Exceptions::Create(ExceptionType type, const Array& arguments) {
Library& library = Library::Handle();
const String* class_name = NULL;
@@ -724,6 +731,11 @@ RawObject* Exceptions::Create(ExceptionType type, const Array& arguments) {
case kCyclicInitializationError:
library = Library::CoreLibrary();
class_name = &Symbols::CyclicInitializationError();
+ break;
+ case kCompileTimeError:
+ library = Library::CoreLibrary();
+ class_name = &Symbols::_CompileTimeError();
+ break;
}
return DartLibraryCalls::InstanceCreate(library,
« no previous file with comments | « runtime/vm/exceptions.h ('k') | runtime/vm/object.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698