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

Unified Diff: runtime/vm/object.cc

Issue 8394057: Fix issue 235. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years, 2 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
« no previous file with comments | « no previous file | tests/language/language.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
===================================================================
--- runtime/vm/object.cc (revision 765)
+++ runtime/vm/object.cc (working copy)
@@ -1645,6 +1645,8 @@
RawString* Type::Name() const {
+ // If the type is still being finalized, we may be reporting an error about
+ // an illformed type, so proceed with caution.
const TypeArguments& args = TypeArguments::Handle(arguments());
const intptr_t num_args = args.IsNull() ? 0 : args.Length();
String& class_name = String::Handle();
@@ -1655,26 +1657,31 @@
class_name = cls.Name();
num_type_params = cls.NumTypeParameters(); // Do not print the full vector.
if (num_type_params > num_args) {
- ASSERT(num_args == 0); // Type is raw.
- // We fill up with "var".
first_type_param_index = 0;
+ if (IsBeingFinalized()) {
+ // Most probably an illformed type. Do not fill up with "var".
+ num_type_params = num_args;
+ } else {
+ ASSERT(num_args == 0); // Type is raw.
+ // We fill up with "var".
+ }
} else {
first_type_param_index = num_args - num_type_params;
}
if (cls.IsSignatureClass()) {
- const Function& signature_function = Function::Handle(
- cls.signature_function());
// We may be reporting an error about an illformed function type. In that
// case, avoid instantiating the signature, since it may lead to cycles.
if (IsBeingFinalized()) {
return class_name.raw();
}
+ const Function& signature_function = Function::Handle(
+ cls.signature_function());
return signature_function.InstantiatedSignatureFrom(
args, first_type_param_index);
}
} else {
- const UnresolvedClass& type = UnresolvedClass::Handle(unresolved_class());
- class_name = type.Name();
+ const UnresolvedClass& cls = UnresolvedClass::Handle(unresolved_class());
+ class_name = cls.Name();
num_type_params = num_args;
first_type_param_index = 0;
}
« no previous file with comments | « no previous file | tests/language/language.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698