Chromium Code Reviews| Index: runtime/lib/object.cc |
| diff --git a/runtime/lib/object.cc b/runtime/lib/object.cc |
| index 09e4808ba15c1ff9fe06776d455ef08186363190..85f1d27f6dd3d3d735e7553d4c90ebe8432a8a6b 100644 |
| --- a/runtime/lib/object.cc |
| +++ b/runtime/lib/object.cc |
| @@ -155,7 +155,7 @@ DEFINE_NATIVE_ENTRY(Object_instanceOf, 4) { |
| String& bound_error_message = String::Handle( |
| zone, String::New(bound_error.ToErrorCString())); |
| Exceptions::CreateAndThrowTypeError( |
| - location, Symbols::Empty(), Symbols::Empty(), |
| + location, AbstractType::Handle(), AbstractType::Handle(), |
|
srdjan
2016/03/09 22:38:22
AbstractType::Handle(zone) x 2
regis
2016/03/09 23:15:40
Done here and above.
|
| Symbols::Empty(), bound_error_message); |
| UNREACHABLE(); |
| } |
| @@ -227,8 +227,7 @@ DEFINE_NATIVE_ENTRY(Object_as, 3) { |
| const Instance& instance = Instance::CheckedHandle(arguments->NativeArgAt(0)); |
| const TypeArguments& instantiator_type_arguments = |
| TypeArguments::CheckedHandle(arguments->NativeArgAt(1)); |
| - const AbstractType& type = |
| - AbstractType::CheckedHandle(arguments->NativeArgAt(2)); |
| + AbstractType& type = AbstractType::CheckedHandle(arguments->NativeArgAt(2)); |
| ASSERT(type.IsFinalized()); |
| ASSERT(!type.IsMalformed()); |
| ASSERT(!type.IsMalbounded()); |
| @@ -258,32 +257,22 @@ DEFINE_NATIVE_ENTRY(Object_as, 3) { |
| const TokenPosition location = caller_frame->GetTokenPos(); |
| const AbstractType& instance_type = |
| AbstractType::Handle(instance.GetType()); |
| - const String& instance_type_name = |
| - String::Handle(instance_type.UserVisibleName()); |
| - String& type_name = String::Handle(); |
| if (!type.IsInstantiated()) { |
| // Instantiate type before reporting the error. |
| - const AbstractType& instantiated_type = AbstractType::Handle( |
| - type.InstantiateFrom(instantiator_type_arguments, NULL, |
| - NULL, NULL, Heap::kNew)); |
| - // Note that instantiated_type may be malformed. |
| - type_name = instantiated_type.UserVisibleName(); |
| - } else { |
| - type_name = type.UserVisibleName(); |
| + type = type.InstantiateFrom(instantiator_type_arguments, NULL, |
| + NULL, NULL, Heap::kNew); |
| + // Note that the instantiated type may be malformed. |
| } |
| - String& bound_error_message = String::Handle(); |
| if (bound_error.IsNull()) { |
| - const String& dst_name = String::ZoneHandle( |
| - Symbols::New(Exceptions::kCastErrorDstName)); |
| - |
| Exceptions::CreateAndThrowTypeError( |
| - location, instance_type_name, type_name, |
| - dst_name, Object::null_string()); |
| + location, instance_type, type, |
| + Symbols::InTypeCast(), Object::null_string()); |
| } else { |
| ASSERT(isolate->type_checks()); |
| - bound_error_message = String::New(bound_error.ToErrorCString()); |
| + const String& bound_error_message = |
| + String::Handle(String::New(bound_error.ToErrorCString())); |
|
srdjan
2016/03/09 22:38:22
zone,
regis
2016/03/09 23:15:40
Done.
|
| Exceptions::CreateAndThrowTypeError( |
| - location, instance_type_name, Symbols::Empty(), |
| + location, instance_type, AbstractType::Handle(), |
|
srdjan
2016/03/09 22:38:22
zone
regis
2016/03/09 23:15:40
Done.
|
| Symbols::Empty(), bound_error_message); |
| } |
| UNREACHABLE(); |