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

Unified Diff: runtime/vm/object.h

Issue 9664029: Fix type check to perform a subtype test at top level instead of an (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 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
« no previous file with comments | « runtime/vm/exceptions.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/object.h
===================================================================
--- runtime/vm/object.h (revision 5412)
+++ runtime/vm/object.h (working copy)
@@ -324,11 +324,6 @@
static const ObjectKind kInstanceKind = kObject;
- enum TypeTestKind {
- kIsSubtypeOf,
- kIsAssignableTo
- };
-
protected:
// Used for extracting the C++ vtable during bringup.
Object() : raw_(null_) {}
@@ -571,37 +566,12 @@
// alias as defined in a typedef.
bool IsCanonicalSignatureClass() const;
- // Check the "more specific than" relationship.
- bool IsMoreSpecificThan(
- const AbstractTypeArguments& type_arguments,
- const Class& other,
- const AbstractTypeArguments& other_type_arguments,
- Error* malformed_error) const;
-
// Check the subtype relationship.
bool IsSubtypeOf(const AbstractTypeArguments& type_arguments,
const Class& other,
const AbstractTypeArguments& other_type_arguments,
- Error* malformed_error) const {
- return TestType(kIsSubtypeOf,
- type_arguments,
- other,
- other_type_arguments,
- malformed_error);
- }
+ Error* malformed_error) const;
- // Check the assignability relationship.
- bool IsAssignableTo(const AbstractTypeArguments& type_arguments,
- const Class& dst,
- const AbstractTypeArguments& dst_type_arguments,
- Error* malformed_error) const {
- return TestType(kIsAssignableTo,
- type_arguments,
- dst,
- dst_type_arguments,
- malformed_error);
- }
-
// Check if this is the top level class.
bool IsTopLevel() const;
@@ -718,13 +688,6 @@
void CalculateFieldOffsets() const;
- // Check the subtype or assignability relationship.
- bool TestType(TypeTestKind test,
- const AbstractTypeArguments& type_arguments,
- const Class& other,
- const AbstractTypeArguments& other_type_arguments,
- Error* malformed_error) const;
-
// Assigns empty array to all raw class array fields.
void InitEmptyFields();
@@ -862,21 +825,9 @@
return !cls.IsNull() && cls.is_interface();
}
- // Check the "more specific than" relationship.
- bool IsMoreSpecificThan(const AbstractType& other,
- Error* malformed_error) const;
-
// Check the subtype relationship.
- bool IsSubtypeOf(const AbstractType& other, Error* malformed_error) const {
- return Test(kIsSubtypeOf, other, malformed_error);
- }
+ bool IsSubtypeOf(const AbstractType& other, Error* malformed_error) const;
- // Check the assignability relationship.
- bool IsAssignableTo(const AbstractType& dst,
- Error* malformed_error) const {
- return Test(kIsAssignableTo, dst, malformed_error);
- }
-
static RawAbstractType* NewTypeParameter(intptr_t index,
const String& name,
intptr_t token_index);
@@ -886,11 +837,6 @@
const AbstractTypeArguments& instantiator_type_arguments);
protected:
- // Check the subtype or assignability relationship.
- bool Test(TypeTestKind test,
- const AbstractType& other,
- Error* malformed_error) const;
-
HEAP_OBJECT_IMPLEMENTATION(AbstractType, Object);
friend class Class;
};
@@ -1101,11 +1047,10 @@
const AbstractTypeArguments& bounds_instantiator,
Error* malformed_error) const;
- // Check the "more specific than" relationship, considering only a prefix of
- // length 'len'.
- bool IsMoreSpecificThan(const AbstractTypeArguments& other,
- intptr_t len,
- Error* malformed_error) const;
+ // Check the subtype relationship, considering only a prefix of length 'len'.
+ bool IsSubtypeOf(const AbstractTypeArguments& other,
+ intptr_t len,
+ Error* malformed_error) const;
bool Equals(const AbstractTypeArguments& other) const;
@@ -1411,27 +1356,8 @@
bool IsSubtypeOf(const AbstractTypeArguments& type_arguments,
const Function& other,
const AbstractTypeArguments& other_type_arguments,
- Error* malformed_error) const {
- return TestType(kIsSubtypeOf,
- type_arguments,
- other,
- other_type_arguments,
- malformed_error);
- }
+ Error* malformed_error) const;
- // Returns true if the type of this function can be assigned to the type of
- // the destination function.
- bool IsAssignableTo(const AbstractTypeArguments& type_arguments,
- const Function& dst,
- const AbstractTypeArguments& dst_type_arguments,
- Error* malformed_error) const {
- return TestType(kIsAssignableTo,
- type_arguments,
- dst,
- dst_type_arguments,
- malformed_error);
- }
-
// Returns true if this function represents a (possibly implicit) closure
// function.
bool IsClosureFunction() const {
@@ -1504,14 +1430,6 @@
RawString* BuildSignature(bool instantiate,
const AbstractTypeArguments& instantiator) const;
- // Checks the subtype or assignability relationship between the type of this
- // function and the type of the other function.
- bool TestType(TypeTestKind test,
- const AbstractTypeArguments& type_arguments,
- const Function& other,
- const AbstractTypeArguments& other_type_arguments,
- Error* malformed_error) const;
-
// Checks the type of the formal parameter at the given position for
// assignability relationship between the type of this function and the type
// of the other function.
@@ -2557,20 +2475,11 @@
virtual RawAbstractTypeArguments* GetTypeArguments() const;
virtual void SetTypeArguments(const AbstractTypeArguments& value) const;
- // Check if this instance is an instance of the given type.
+ // Check if the type of this instance is a subtype of the given type.
bool IsInstanceOf(const AbstractType& type,
const AbstractTypeArguments& type_instantiator,
- Error* malformed_error) const {
- return TestType(kIsSubtypeOf, type, type_instantiator, malformed_error);
- }
+ Error* malformed_error) const;
- // Check if this instance is assignable to the given type.
- bool IsAssignableTo(const AbstractType& type,
- const AbstractTypeArguments& type_instantiator,
- Error* malformed_error) const {
- return TestType(kIsAssignableTo, type, type_instantiator, malformed_error);
- }
-
bool IsValidNativeIndex(int index) const;
intptr_t GetNativeField(int index) const {
@@ -2606,13 +2515,6 @@
}
bool IsValidFieldOffset(int offset) const;
- // Check the subtype or assignability relationship between the type of this
- // instance and the given type.
- bool TestType(TypeTestKind test,
- const AbstractType& type,
- const AbstractTypeArguments& type_instantiator,
- Error* malformed_error) const;
-
// TODO(iposva): Determine if this gets in the way of Smi.
HEAP_OBJECT_IMPLEMENTATION(Instance, Object);
friend class Class;
« no previous file with comments | « runtime/vm/exceptions.cc ('k') | runtime/vm/object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698