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

Unified Diff: runtime/lib/error.cc

Issue 8491055: Second attempt at finalizing all classes in the VM (fix issue 364). (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 9 years, 1 month 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 | runtime/vm/class_finalizer.h » ('j') | runtime/vm/object.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/error.cc
===================================================================
--- runtime/lib/error.cc (revision 1473)
+++ runtime/lib/error.cc (working copy)
@@ -199,8 +199,24 @@
ASSERT(!dst_type.IsDynamicType()); // No need to check assignment.
ASSERT(!src_instance.IsNull()); // Already checked in inlined code.
- if (!src_instance.IsAssignableTo(dst_type, dst_type_instantiator)) {
+ const bool is_assignable =
+ src_instance.IsAssignableTo(dst_type, dst_type_instantiator);
+
+ if (FLAG_trace_type_checks) {
const Type& src_type = Type::Handle(src_instance.GetType());
+ Type& instantiated_dst_type = Type::Handle(dst_type.raw());
+ if (!dst_type.IsInstantiated()) {
+ // Instantiate dst_type before printing.
+ instantiated_dst_type =
+ dst_type.InstantiateFrom(dst_type_instantiator, 0);
+ }
+ OS::Print("TypeCheck: '%s' %s assignable to '%s'.\n",
+ String::Handle(src_type.Name()).ToCString(),
+ is_assignable ? "is" : "is not",
+ String::Handle(dst_type.Name()).ToCString());
+ }
+ if (!is_assignable) {
+ const Type& src_type = Type::Handle(src_instance.GetType());
const String& src_type_name = String::Handle(src_type.Name());
String& dst_type_name = String::Handle();
if (!dst_type.IsInstantiated()) {
@@ -214,17 +230,6 @@
ThrowTypeError(location, src_type_name, dst_type_name, dst_name);
UNREACHABLE();
}
-
- if (FLAG_trace_type_checks) {
- Class& cls = Class::Handle(src_instance.clazz());
- // TODO(regis): Remove once all classes finalized.
- if (cls.is_finalized()) {
- OS::Print("TypeCheck '%s' vs '%s'\n",
- String::Handle(Type::Handle(src_instance.GetType()).Name()).
- ToCString(),
- String::Handle(dst_type.Name()).ToCString());
- }
- }
arguments.SetReturn(src_instance);
}
« no previous file with comments | « no previous file | runtime/vm/class_finalizer.h » ('j') | runtime/vm/object.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698