@@ -865,8 +865,7 @@ InstancePtr Exceptions::NewInstance(const char* class_name) {
865
865
return Instance::New (cls);
866
866
}
867
867
868
- // Allocate, initialize, and throw a TypeError or CastError.
869
- // If error_msg is not null, throw a TypeError, even for a type cast.
868
+ // Allocate, initialize, and throw a TypeError.
870
869
void Exceptions::CreateAndThrowTypeError (TokenPosition location,
871
870
const AbstractType& src_type,
872
871
const AbstractType& dst_type,
@@ -876,8 +875,7 @@ void Exceptions::CreateAndThrowTypeError(TokenPosition location,
876
875
Zone* zone = thread->zone ();
877
876
const Array& args = Array::Handle (zone, Array::New (4 ));
878
877
879
- ExceptionType exception_type =
880
- (dst_name.ptr () == Symbols::InTypeCast ().ptr ()) ? kCast : kType ;
878
+ ExceptionType exception_type = kType ;
881
879
882
880
DartFrameIterator iterator (thread,
883
881
StackFrameIterator::kNoCrossThreadIteration );
@@ -908,9 +906,7 @@ void Exceptions::CreateAndThrowTypeError(TokenPosition location,
908
906
pieces.Add (Symbols::TypeQuote ());
909
907
pieces.Add (String::Handle (zone, dst_type.UserVisibleName ()));
910
908
pieces.Add (Symbols::SingleQuote ());
911
- if (exception_type == kCast ) {
912
- pieces.Add (dst_name);
913
- } else if (dst_name.Length () > 0 ) {
909
+ if (dst_name.Length () > 0 ) {
914
910
pieces.Add (Symbols::SpaceOfSpace ());
915
911
pieces.Add (Symbols::SingleQuote ());
916
912
pieces.Add (dst_name);
@@ -944,7 +940,7 @@ void Exceptions::CreateAndThrowTypeError(TokenPosition location,
944
940
THR_Print (" %s\n " , error_msg.ToCString ());
945
941
}
946
942
947
- // Throw TypeError or CastError instance.
943
+ // Throw TypeError instance.
948
944
Exceptions::ThrowByType (exception_type, args);
949
945
UNREACHABLE ();
950
946
}
@@ -1151,11 +1147,6 @@ ObjectPtr Exceptions::Create(ExceptionType type, const Array& arguments) {
1151
1147
class_name = &Symbols::AssertionError ();
1152
1148
constructor_name = &Symbols::DotCreate ();
1153
1149
break ;
1154
- case kCast :
1155
- library = Library::CoreLibrary ();
1156
- class_name = &Symbols::CastError ();
1157
- constructor_name = &Symbols::DotCreate ();
1158
- break ;
1159
1150
case kType :
1160
1151
library = Library::CoreLibrary ();
1161
1152
class_name = &Symbols::TypeError ();
0 commit comments