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

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: wip 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
Index: runtime/vm/exceptions.cc
diff --git a/runtime/vm/exceptions.cc b/runtime/vm/exceptions.cc
index 37a99f25dcae5330f9ae9ccad548e67247c7825b..f645cb9d346699530c4a8b105e46019689455ca8 100644
--- a/runtime/vm/exceptions.cc
+++ b/runtime/vm/exceptions.cc
@@ -640,6 +640,13 @@ void Exceptions::ThrowRangeError(const char* argument_name,
}
+void Exceptions::ThrowSyntaxError(const LanguageError& error) {
+ const Array& args = Array::Handle(Array::New(1));
+ args.SetAt(0, String::Handle(error.FormatMessage()));
+ Exceptions::ThrowByType(Exceptions::kSyntaxError, args);
+}
+
+
RawObject* Exceptions::Create(ExceptionType type, const Array& arguments) {
Library& library = Library::Handle();
const String* class_name = NULL;
@@ -713,6 +720,10 @@ RawObject* Exceptions::Create(ExceptionType type, const Array& arguments) {
case kCyclicInitializationError:
library = Library::CoreLibrary();
class_name = &Symbols::CyclicInitializationError();
+ break;
+ case kSyntaxError:
+ library = Library::CoreLibrary();
+ class_name = &Symbols::SyntaxError();
siva 2016/09/15 18:11:45 Does this need to be break; default: UNREACHA
hausner 2016/09/15 21:28:28 Done. There does not seem to be a default case, t
}
return DartLibraryCalls::InstanceCreate(library,

Powered by Google App Engine
This is Rietveld 408576698