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

Side by Side Diff: lib/runtime/dart/_runtime.js

Issue 1803033002: Fixes #479 (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | tool/input_sdk/private/ddc_runtime/classes.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 dart_library.library('dart/_runtime', null, /* Imports */[ 1 dart_library.library('dart/_runtime', null, /* Imports */[
2 ], /* Lazy imports */[ 2 ], /* Lazy imports */[
3 'dart/core', 3 'dart/core',
4 'dart/_interceptors', 4 'dart/_interceptors',
5 'dart/_js_helper', 5 'dart/_js_helper',
6 'dart/async', 6 'dart/async',
7 'dart/collection' 7 'dart/collection'
8 ], function(exports, core, _interceptors, _js_helper, async, collection) { 8 ], function(exports, core, _interceptors, _js_helper, async, collection) {
9 'use strict'; 9 'use strict';
10 function mixin(base, ...mixins) { 10 function mixin(base, ...mixins) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 84 }
85 function getGenericArgs(type) { 85 function getGenericArgs(type) {
86 return safeGetOwnProperty(type, _typeArguments); 86 return safeGetOwnProperty(type, _typeArguments);
87 } 87 }
88 const _constructorSig = Symbol("sigCtor"); 88 const _constructorSig = Symbol("sigCtor");
89 const _methodSig = Symbol("sig"); 89 const _methodSig = Symbol("sig");
90 const _staticSig = Symbol("sigStatic"); 90 const _staticSig = Symbol("sigStatic");
91 function getMethodType(obj, name) { 91 function getMethodType(obj, name) {
92 if (obj === void 0) return void 0; 92 if (obj === void 0) return void 0;
93 if (obj == null) return void 0; 93 if (obj == null) return void 0;
94 let sigObj = obj.__proto__.constructor[_methodSig]; 94 return getMethodTypeFromType(obj.__proto__.constructor, name);
95 }
96 function getMethodTypeFromType(type, name) {
97 let sigObj = type[_methodSig];
95 if (sigObj === void 0) return void 0; 98 if (sigObj === void 0) return void 0;
96 let parts = sigObj[name]; 99 let parts = sigObj[name];
97 if (parts === void 0) return void 0; 100 if (parts === void 0) return void 0;
98 return definiteFunctionType.apply(null, parts); 101 return definiteFunctionType.apply(null, parts);
99 } 102 }
100 function classGetConstructorType(cls, name) { 103 function classGetConstructorType(cls, name) {
101 if (!name) name = cls.name; 104 if (!name) name = cls.name;
102 if (cls === void 0) return void 0; 105 if (cls === void 0) return void 0;
103 if (cls == null) return void 0; 106 if (cls == null) return void 0;
104 let sigCtor = cls[_constructorSig]; 107 let sigCtor = cls[_constructorSig];
(...skipping 838 matching lines...) Expand 10 before | Expand all | Expand 10 after
943 if (i > 0) name += ', '; 946 if (i > 0) name += ', ';
944 name += typeName(args[i]); 947 name += typeName(args[i]);
945 } 948 }
946 name += '>'; 949 name += '>';
947 } 950 }
948 return name; 951 return name;
949 } 952 }
950 if (tag) return "Not a type: " + tag.name; 953 if (tag) return "Not a type: " + tag.name;
951 return "JSObject<" + type.name + ">"; 954 return "JSObject<" + type.name + ">";
952 } 955 }
956 function getImplicitFunctionType(type) {
957 if (isFunctionType(type)) return type;
958 return getMethodTypeFromType(type, 'call');
959 }
953 function isFunctionType(type) { 960 function isFunctionType(type) {
954 return type instanceof AbstractFunctionType || type == core.Function; 961 return type instanceof AbstractFunctionType || type == core.Function;
955 } 962 }
956 function isFunctionSubType(ft1, ft2) { 963 function isFunctionSubType(ft1, ft2) {
957 if (ft2 == core.Function) { 964 if (ft2 == core.Function) {
958 return true; 965 return true;
959 } 966 }
960 let ret1 = ft1.returnType; 967 let ret1 = ft1.returnType;
961 let ret2 = ft2.returnType; 968 let ret2 = ft2.returnType;
962 if (!isSubtype_(ret1, ret2)) { 969 if (!isSubtype_(ret1, ret2)) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 if (t1 == t2) return true; 1048 if (t1 == t2) return true;
1042 if (_isTop(t2) || _isBottom(t1)) { 1049 if (_isTop(t2) || _isBottom(t1)) {
1043 return true; 1050 return true;
1044 } 1051 }
1045 if (_isTop(t1) || _isBottom(t2)) { 1052 if (_isTop(t1) || _isBottom(t2)) {
1046 return false; 1053 return false;
1047 } 1054 }
1048 if (isClassSubType(t1, t2)) { 1055 if (isClassSubType(t1, t2)) {
1049 return true; 1056 return true;
1050 } 1057 }
1058 t1 = getImplicitFunctionType(t1);
1059 if (!t1) return false;
1051 if (isFunctionType(t1) && isFunctionType(t2)) { 1060 if (isFunctionType(t1) && isFunctionType(t2)) {
1052 return isFunctionSubType(t1, t2); 1061 return isFunctionSubType(t1, t2);
1053 } 1062 }
1054 return false; 1063 return false;
1055 } 1064 }
1056 function isClassSubType(t1, t2) { 1065 function isClassSubType(t1, t2) {
1057 t1 = canonicalType(t1); 1066 t1 = canonicalType(t1);
1058 assert_(t2 == canonicalType(t2)); 1067 assert_(t2 == canonicalType(t2));
1059 if (t1 == t2) return true; 1068 if (t1 == t2) return true;
1060 if (t1 == core.Object) return false; 1069 if (t1 == core.Object) return false;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1204 const global_ = typeof window == "undefined" ? global : window; 1213 const global_ = typeof window == "undefined" ? global : window;
1205 const JsSymbol = Symbol; 1214 const JsSymbol = Symbol;
1206 // Exports: 1215 // Exports:
1207 exports.mixin = mixin; 1216 exports.mixin = mixin;
1208 exports.getMixins = getMixins; 1217 exports.getMixins = getMixins;
1209 exports.getImplements = getImplements; 1218 exports.getImplements = getImplements;
1210 exports.generic = generic; 1219 exports.generic = generic;
1211 exports.getGenericClass = getGenericClass; 1220 exports.getGenericClass = getGenericClass;
1212 exports.getGenericArgs = getGenericArgs; 1221 exports.getGenericArgs = getGenericArgs;
1213 exports.getMethodType = getMethodType; 1222 exports.getMethodType = getMethodType;
1223 exports.getMethodTypeFromType = getMethodTypeFromType;
1214 exports.classGetConstructorType = classGetConstructorType; 1224 exports.classGetConstructorType = classGetConstructorType;
1215 exports.bind = bind; 1225 exports.bind = bind;
1216 exports.setSignature = setSignature; 1226 exports.setSignature = setSignature;
1217 exports.hasMethod = hasMethod; 1227 exports.hasMethod = hasMethod;
1218 exports.virtualField = virtualField; 1228 exports.virtualField = virtualField;
1219 exports.defineNamedConstructor = defineNamedConstructor; 1229 exports.defineNamedConstructor = defineNamedConstructor;
1220 exports.getExtensionType = getExtensionType; 1230 exports.getExtensionType = getExtensionType;
1221 exports.dartx = dartx; 1231 exports.dartx = dartx;
1222 exports.getExtensionSymbol = getExtensionSymbol; 1232 exports.getExtensionSymbol = getExtensionSymbol;
1223 exports.defineExtensionNames = defineExtensionNames; 1233 exports.defineExtensionNames = defineExtensionNames;
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1288 exports.JSObject = JSObject; 1298 exports.JSObject = JSObject;
1289 exports.jsobject = jsobject; 1299 exports.jsobject = jsobject;
1290 exports.AbstractFunctionType = AbstractFunctionType; 1300 exports.AbstractFunctionType = AbstractFunctionType;
1291 exports.FunctionType = FunctionType; 1301 exports.FunctionType = FunctionType;
1292 exports.Typedef = Typedef; 1302 exports.Typedef = Typedef;
1293 exports.functionType = functionType; 1303 exports.functionType = functionType;
1294 exports.definiteFunctionType = definiteFunctionType; 1304 exports.definiteFunctionType = definiteFunctionType;
1295 exports.typedef = typedef; 1305 exports.typedef = typedef;
1296 exports.isDartType = isDartType; 1306 exports.isDartType = isDartType;
1297 exports.typeName = typeName; 1307 exports.typeName = typeName;
1308 exports.getImplicitFunctionType = getImplicitFunctionType;
1298 exports.isFunctionType = isFunctionType; 1309 exports.isFunctionType = isFunctionType;
1299 exports.isFunctionSubType = isFunctionSubType; 1310 exports.isFunctionSubType = isFunctionSubType;
1300 exports.canonicalType = canonicalType; 1311 exports.canonicalType = canonicalType;
1301 exports.subtypeMap = subtypeMap; 1312 exports.subtypeMap = subtypeMap;
1302 exports.isSubtype = isSubtype; 1313 exports.isSubtype = isSubtype;
1303 exports.isSubtype_ = isSubtype_; 1314 exports.isSubtype_ = isSubtype_;
1304 exports.isClassSubType = isClassSubType; 1315 exports.isClassSubType = isClassSubType;
1305 exports.isGroundType = isGroundType; 1316 exports.isGroundType = isGroundType;
1306 exports.defineProperty = defineProperty; 1317 exports.defineProperty = defineProperty;
1307 exports.getOwnPropertyDescriptor = getOwnPropertyDescriptor; 1318 exports.getOwnPropertyDescriptor = getOwnPropertyDescriptor;
(...skipping 12 matching lines...) Expand all
1320 exports.copyProperties = copyProperties; 1331 exports.copyProperties = copyProperties;
1321 exports.export = export_; 1332 exports.export = export_;
1322 exports.defineLazyClass = defineLazyClass; 1333 exports.defineLazyClass = defineLazyClass;
1323 exports.defineLazyProperties = defineLazyProperties; 1334 exports.defineLazyProperties = defineLazyProperties;
1324 exports.defineLazyClassGeneric = defineLazyClassGeneric; 1335 exports.defineLazyClassGeneric = defineLazyClassGeneric;
1325 exports.as = as_; 1336 exports.as = as_;
1326 exports.is = is_; 1337 exports.is = is_;
1327 exports.global = global_; 1338 exports.global = global_;
1328 exports.JsSymbol = JsSymbol; 1339 exports.JsSymbol = JsSymbol;
1329 }); 1340 });
OLDNEW
« no previous file with comments | « no previous file | tool/input_sdk/private/ddc_runtime/classes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698