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

Unified Diff: runtime/vm/object.cc

Issue 8390021: Cleanups. (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 | « runtime/vm/code_generator_ia32.cc ('k') | runtime/vm/parser.cc » ('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 722)
+++ runtime/vm/object.cc (working copy)
@@ -1210,9 +1210,6 @@
}
-// TODO(regis): We can probably merge this function with IsSubtypeOf, but since
-// the spec is not definitive, we still follow it somewhat closely, to make it
-// easier to implement spec changes.
bool Class::IsMoreSpecificThan(
const TypeArguments& type_arguments,
const Class& other,
@@ -1341,20 +1338,7 @@
ASSERT(test == kIsSubtypeOf);
// Check for "more specific" relation.
- if (IsMoreSpecificThan(type_arguments, other, other_type_arguments)) {
- return true;
- }
- // TODO(regis): Merge IsMoreSpecificThan here after type checks for
- // function types are finalized and implemented.
- // For now, keep the assert below.
-
- // The optionality and dubious bliss rules described in the guide have
- // already been checked in IsMoreSpecificThan call above.
- if (raw() != other.raw()) {
- return false;
- }
- ASSERT(HasTypeArguments()); // Otherwise, IsMoreSpecificThan would be true.
- return false;
+ return IsMoreSpecificThan(type_arguments, other, other_type_arguments);
}
@@ -4837,14 +4821,21 @@
if (IsNull()) {
return "null";
} else {
- // TODO(regis): Print type arguments if any.
const char* kFormat = "Instance of '%s'";
Class& cls = Class::Handle(clazz());
+ TypeArguments& type_arguments = TypeArguments::Handle();
+ const intptr_t num_type_arguments = cls.NumTypeArguments();
+ if (num_type_arguments > 0) {
+ type_arguments = GetTypeArguments();
+ }
+ const Type& type = Type::Handle(
+ Type::NewParameterizedType(cls, type_arguments));
+ const String& type_name = String::Handle(type.Name());
// Calculate the size of the string.
- intptr_t len = OS::SNPrint(NULL, 0, kFormat, cls.ToCString()) + 1;
+ intptr_t len = OS::SNPrint(NULL, 0, kFormat, type_name.ToCString()) + 1;
char* chars = reinterpret_cast<char*>(
Isolate::Current()->current_zone()->Allocate(len));
- OS::SNPrint(chars, len, kFormat, cls.ToCString());
+ OS::SNPrint(chars, len, kFormat, type_name.ToCString());
return chars;
}
}
« no previous file with comments | « runtime/vm/code_generator_ia32.cc ('k') | runtime/vm/parser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698