diff --git a/runtime/lib/errors.cc b/runtime/lib/errors.cc index 7a3415aa0a6..3ef30797059 100644 --- a/runtime/lib/errors.cc +++ b/runtime/lib/errors.cc @@ -168,57 +168,6 @@ DEFINE_NATIVE_ENTRY(TypeError_throwNew, 0, 4) { return Object::null(); } -// Allocate and throw a new FallThroughError. -// Arg0: index of the case clause token into which we fall through. -// Return value: none, throws an exception. -DEFINE_NATIVE_ENTRY(FallThroughError_throwNew, 0, 1) { - GET_NON_NULL_NATIVE_ARGUMENT(Smi, smi_pos, arguments->NativeArgAt(0)); - TokenPosition fallthrough_pos = TokenPosition::Deserialize(smi_pos.Value()); - - const Array& args = Array::Handle(Array::New(2)); - - // Initialize 'url' and 'line' arguments. - DartFrameIterator iterator(thread, - StackFrameIterator::kNoCrossThreadIteration); - iterator.NextFrame(); // Skip native call. - const Script& script = Script::Handle(Exceptions::GetCallerScript(&iterator)); - args.SetAt(0, String::Handle(script.url())); - intptr_t line = -1; - script.GetTokenLocation(fallthrough_pos, &line); - args.SetAt(1, Smi::Handle(Smi::New(line))); - - Exceptions::ThrowByType(Exceptions::kFallThrough, args); - UNREACHABLE(); - return Object::null(); -} - -// Allocate and throw a new AbstractClassInstantiationError. -// Arg0: Token position of allocation statement. -// Arg1: class name of the abstract class that cannot be instantiated. -// Return value: none, throws an exception. -DEFINE_NATIVE_ENTRY(AbstractClassInstantiationError_throwNew, 0, 2) { - GET_NON_NULL_NATIVE_ARGUMENT(Smi, smi_pos, arguments->NativeArgAt(0)); - GET_NON_NULL_NATIVE_ARGUMENT(String, class_name, arguments->NativeArgAt(1)); - TokenPosition error_pos = TokenPosition::Deserialize(smi_pos.Value()); - - const Array& args = Array::Handle(Array::New(3)); - - // Initialize 'className', 'url' and 'line' arguments. - DartFrameIterator iterator(thread, - StackFrameIterator::kNoCrossThreadIteration); - iterator.NextFrame(); // Skip native call. - const Script& script = Script::Handle(Exceptions::GetCallerScript(&iterator)); - args.SetAt(0, class_name); - args.SetAt(1, String::Handle(script.url())); - intptr_t line = -1; - script.GetTokenLocation(error_pos, &line); - args.SetAt(2, Smi::Handle(Smi::New(line))); - - Exceptions::ThrowByType(Exceptions::kAbstractClassInstantiation, args); - UNREACHABLE(); - return Object::null(); -} - // Rethrow an error with a stacktrace. DEFINE_NATIVE_ENTRY(Error_throwWithStackTrace, 0, 2) { GET_NON_NULL_NATIVE_ARGUMENT(Instance, error, arguments->NativeArgAt(0)); diff --git a/runtime/vm/bootstrap_natives.h b/runtime/vm/bootstrap_natives.h index 20a2d74e075..271ff4c9139 100644 --- a/runtime/vm/bootstrap_natives.h +++ b/runtime/vm/bootstrap_natives.h @@ -152,8 +152,6 @@ namespace dart { V(Error_throwWithStackTrace, 2) \ V(StackTrace_current, 0) \ V(TypeError_throwNew, 4) \ - V(FallThroughError_throwNew, 1) \ - V(AbstractClassInstantiationError_throwNew, 2) \ V(Stopwatch_now, 0) \ V(Stopwatch_frequency, 0) \ V(Timeline_getNextAsyncId, 0) \ diff --git a/sdk/lib/_internal/vm/lib/errors_patch.dart b/sdk/lib/_internal/vm/lib/errors_patch.dart index aaaf11fbba7..05b0afaa32b 100644 --- a/sdk/lib/_internal/vm/lib/errors_patch.dart +++ b/sdk/lib/_internal/vm/lib/errors_patch.dart @@ -134,9 +134,6 @@ class FallThroughError { @pragma("vm:entry-point") FallThroughError._create(this._url, this._line); - @pragma("vm:external-name", "FallThroughError_throwNew") - external static _throwNew(int caseClausePos); - @patch String toString() { return "'$_url': Switch case fall-through at line $_line."; @@ -176,9 +173,6 @@ class AbstractClassInstantiationError { AbstractClassInstantiationError._create( this._className, this._url, this._line); - @pragma("vm:external-name", "AbstractClassInstantiationError_throwNew") - external static _throwNew(int caseClausePos, String className); - @patch String toString() { return "Cannot instantiate abstract class $_className: "