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

Unified Diff: runtime/vm/code_generator.cc

Issue 1778133002: Enumerate URIs of all types in type errors in order to help the user diagnose (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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/code_generator.cc
diff --git a/runtime/vm/code_generator.cc b/runtime/vm/code_generator.cc
index 652cdc25a7e6126c09cc072d077260351e0000fa..a4cbf2d11ac6d0b4ec326ae94667f52ce97befd4 100644
--- a/runtime/vm/code_generator.cc
+++ b/runtime/vm/code_generator.cc
@@ -204,7 +204,7 @@ DEFINE_RUNTIME_ENTRY(InstantiateType, 2) {
String& bound_error_message = String::Handle(
String::New(bound_error.ToErrorCString()));
Exceptions::CreateAndThrowTypeError(
- location, Symbols::Empty(), Symbols::Empty(),
+ location, AbstractType::Handle(), AbstractType::Handle(),
srdjan 2016/03/09 22:38:22 Add zone parameters
regis 2016/03/09 23:15:40 Done.
Symbols::Empty(), bound_error_message);
UNREACHABLE();
}
@@ -243,7 +243,7 @@ DEFINE_RUNTIME_ENTRY(InstantiateTypeArguments, 2) {
String& bound_error_message = String::Handle(
String::New(bound_error.ToErrorCString()));
Exceptions::CreateAndThrowTypeError(
- location, Symbols::Empty(), Symbols::Empty(),
+ location, AbstractType::Handle(), AbstractType::Handle(),
srdjan 2016/03/09 22:38:23 ditto
regis 2016/03/09 23:15:40 Done.
Symbols::Empty(), bound_error_message);
UNREACHABLE();
}
@@ -474,7 +474,7 @@ DEFINE_RUNTIME_ENTRY(Instanceof, 4) {
String& bound_error_message = String::Handle(
String::New(bound_error.ToErrorCString()));
Exceptions::CreateAndThrowTypeError(
- location, Symbols::Empty(), Symbols::Empty(),
+ location, AbstractType::Handle(), AbstractType::Handle(),
Symbols::Empty(), bound_error_message);
UNREACHABLE();
}
@@ -518,24 +518,18 @@ DEFINE_RUNTIME_ENTRY(TypeCheck, 5) {
// Throw a dynamic type error.
const TokenPosition location = GetCallerLocation();
const AbstractType& src_type = AbstractType::Handle(src_instance.GetType());
- String& src_type_name = String::Handle(src_type.UserVisibleName());
if (!dst_type.IsInstantiated()) {
// Instantiate dst_type before reporting the error.
dst_type = dst_type.InstantiateFrom(instantiator_type_arguments, NULL,
NULL, NULL, Heap::kNew);
// Note that instantiated dst_type may be malbounded.
}
- String& dst_type_name = String::Handle(dst_type.UserVisibleName());
String& bound_error_message = String::Handle();
if (!bound_error.IsNull()) {
ASSERT(isolate->type_checks());
bound_error_message = String::New(bound_error.ToErrorCString());
}
- if (src_type_name.Equals(dst_type_name)) {
- src_type_name = src_type.UserVisibleNameWithURI();
- dst_type_name = dst_type.UserVisibleNameWithURI();
- }
- Exceptions::CreateAndThrowTypeError(location, src_type_name, dst_type_name,
+ Exceptions::CreateAndThrowTypeError(location, src_type, dst_type,
dst_name, bound_error_message);
UNREACHABLE();
}
@@ -571,11 +565,8 @@ DEFINE_RUNTIME_ENTRY(NonBoolTypeError, 1) {
ASSERT(!src_instance.IsBool());
const Type& bool_interface = Type::Handle(Type::BoolType());
const AbstractType& src_type = AbstractType::Handle(src_instance.GetType());
- const String& src_type_name = String::Handle(src_type.UserVisibleName());
- const String& bool_type_name =
- String::Handle(bool_interface.UserVisibleName());
const String& no_bound_error = String::Handle();
- Exceptions::CreateAndThrowTypeError(location, src_type_name, bool_type_name,
+ Exceptions::CreateAndThrowTypeError(location, src_type, bool_interface,
Symbols::BooleanExpression(),
no_bound_error);
UNREACHABLE();
@@ -594,21 +585,8 @@ DEFINE_RUNTIME_ENTRY(BadTypeError, 3) {
const AbstractType& dst_type =
AbstractType::CheckedHandle(arguments.ArgAt(2));
const AbstractType& src_type = AbstractType::Handle(src_value.GetType());
- const String& src_type_name = String::Handle(src_type.UserVisibleName());
-
- String& dst_type_name = String::Handle();
- LanguageError& error = LanguageError::Handle(dst_type.error());
- ASSERT(!error.IsNull());
- if (error.kind() == Report::kMalformedType) {
- dst_type_name = Symbols::Malformed().raw();
- } else {
- ASSERT(error.kind() == Report::kMalboundedType);
- dst_type_name = Symbols::Malbounded().raw();
- }
- const String& error_message = String::ZoneHandle(
- Symbols::New(error.ToErrorCString()));
Exceptions::CreateAndThrowTypeError(
- location, src_type_name, dst_type_name, dst_name, error_message);
+ location, src_type, dst_type, dst_name, String::Handle());
srdjan 2016/03/09 22:38:23 ditto
regis 2016/03/09 23:15:40 Done.
UNREACHABLE();
}

Powered by Google App Engine
This is Rietveld 408576698