remove canonicalType

it is unused now since the extension type system replaced it.

there's a potentially interesting use case supported, e.g. ES6 subclasses of JS Array, but we can ignore that for now (IMO)

R=sra@google.com

Review URL: https://codereview.chromium.org/1967743005 .
This commit is contained in:
John Messerly 2016-05-11 10:56:58 -07:00
parent c38e417c0b
commit 85d3071fba
2 changed files with 0 additions and 35 deletions

View file

@ -786,15 +786,6 @@ dart_library.library('dart_sdk', null, /* Imports */[
if (!dart._isSubtype(ret1, ret2, covariant)) return null;
return true;
};
dart.canonicalType = function(t) {
if (t === Object) return Object;
if (t === Function) return Function;
if (t === Array) return List;
if (t === String) return String;
if (t === Number) return double;
if (t === Boolean) return bool;
return t;
};
dart._subtypeMemo = function(f) {
let memo = new Map();
return (t1, t2) => {
@ -818,8 +809,6 @@ dart_library.library('dart_sdk', null, /* Imports */[
return type == core.Object || type == dart.dynamic;
};
dart._isSubtype = function(t1, t2, covariant) {
t1 = dart.canonicalType(t1);
t2 = dart.canonicalType(t2);
if (t1 === t2) return true;
if (dart._isTop(t2) || dart._isBottom(t1)) {
return true;
@ -841,8 +830,6 @@ dart_library.library('dart_sdk', null, /* Imports */[
return false;
};
dart.isClassSubType = function(t1, t2, covariant) {
t1 = dart.canonicalType(t1);
dart.assert(t2 == dart.canonicalType(t2));
if (t1 == t2) return true;
if (t1 == core.Object) return false;
if (t1 == null) return t2 == core.Object || t2 == dart.dynamic;

View file

@ -516,24 +516,6 @@ isFunctionSubtype(ft1, ft2, covariant) => JS('', '''(() => {
return true;
})()''');
///
/// Computes the canonical type.
/// This maps JS types onto their corresponding Dart Type.
///
// TODO(jmesserly): lots more needs to be done here.
canonicalType(t) => JS('', '''(() => {
if (t === Object) return Object;
if (t === Function) return Function;
if (t === Array) return List;
// We shouldn't normally get here with these types, unless something strange
// happens like subclassing Number in JS and passing it to Dart.
if (t === String) return String;
if (t === Number) return double;
if (t === Boolean) return bool;
return t;
})()''');
/// TODO(leafp): This duplicates code in operations.dart.
/// I haven't found a way to factor it out that makes the
/// code generator happy though.
@ -566,8 +548,6 @@ _isBottom(type) => JS('bool', '# == #', type, bottom);
_isTop(type) => JS('bool', '# == # || # == #', type, Object, type, dynamic);
_isSubtype(t1, t2, covariant) => JS('', '''(() => {
$t1 = $canonicalType($t1);
$t2 = $canonicalType($t2);
if ($t1 === $t2) return true;
// Trivially true.
@ -610,8 +590,6 @@ isClassSubType(t1, t2, covariant) => JS('', '''(() => {
// I.e., given T1, ..., Tn where at least one Ti != dynamic we disallow:
// - S !<: S<T1, ..., Tn>
// - S<dynamic, ..., dynamic> !<: S<T1, ..., Tn>
$t1 = $canonicalType($t1);
$assert_($t2 == $canonicalType($t2));
if ($t1 == $t2) return true;
if ($t1 == $Object) return false;