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

Unified Diff: runtime/vm/object.cc

Issue 2865603003: Revert "Void is not required to be `null` anymore." (Closed)
Patch Set: Created 3 years, 7 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/flow_graph_type_propagator.cc ('k') | sdk/lib/_internal/js_runtime/lib/js_helper.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.cc
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index a6ba79ffd30daf4695c7a0ed0c9d35acc87397cd..e00640e3ab021ababcfcce05b187fa01b2f23252 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -3820,6 +3820,7 @@ bool Class::TypeTestNonRecursive(const Class& cls,
Zone* zone = Thread::Current()->zone();
Class& thsi = Class::Handle(zone, cls.raw());
while (true) {
+ ASSERT(!thsi.IsVoidClass());
// Check for DynamicType.
// Each occurrence of DynamicType in type T is interpreted as the dynamic
// type, a supertype of all types.
@@ -3838,15 +3839,10 @@ bool Class::TypeTestNonRecursive(const Class& cls,
return test_kind == Class::kIsSubtypeOf;
}
// Check for ObjectType. Any type that is not NullType or DynamicType
- // (already checked above), is more specific than ObjectType/VoidType.
- if (other.IsObjectClass() || other.IsVoidClass()) {
+ // (already checked above), is more specific than ObjectType.
+ if (other.IsObjectClass()) {
return true;
}
- // If other is neither Object, dynamic or void, then ObjectType/VoidType
- // can't be a subtype of other.
- if (thsi.IsObjectClass() || thsi.IsVoidClass()) {
- return false;
- }
// Check for reflexivity.
if (thsi.raw() == other.raw()) {
const intptr_t num_type_params = thsi.NumTypeParameters();
@@ -15834,7 +15830,7 @@ bool Instance::IsInstanceOf(
ASSERT(!other.IsMalformed());
ASSERT(!other.IsMalbounded());
if (other.IsVoidType()) {
- return true;
+ return false;
}
Zone* zone = Thread::Current()->zone();
const Class& cls = Class::Handle(zone, clazz());
@@ -16652,12 +16648,9 @@ bool AbstractType::TypeTest(TypeTestKind test_kind,
return false;
}
// Any type is a subtype of (and is more specific than) Object and dynamic.
- // As of Dart 1.24, void is dynamically treated like Object (except when
- // comparing function-types).
// As of Dart 1.5, the Null type is a subtype of (and is more specific than)
// any type.
- if (other.IsObjectType() || other.IsDynamicType() || other.IsVoidType() ||
- IsNullType()) {
+ if (other.IsObjectType() || other.IsDynamicType() || IsNullType()) {
return true;
}
Zone* zone = Thread::Current()->zone();
« no previous file with comments | « runtime/vm/flow_graph_type_propagator.cc ('k') | sdk/lib/_internal/js_runtime/lib/js_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698