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

Unified Diff: sdk/lib/_internal/compiler/js_lib/js_rti.dart

Issue 1121313007: dart2js: add builtin 'isSubtype'. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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
Index: sdk/lib/_internal/compiler/js_lib/js_rti.dart
diff --git a/sdk/lib/_internal/compiler/js_lib/js_rti.dart b/sdk/lib/_internal/compiler/js_lib/js_rti.dart
index 2d462802a897e6b88d7c5839c08ddff4078520aa..ec6ae53b14aa8f5210d2eb1fd1c34736bd4a0266 100644
--- a/sdk/lib/_internal/compiler/js_lib/js_rti.dart
+++ b/sdk/lib/_internal/compiler/js_lib/js_rti.dart
@@ -451,20 +451,15 @@ bool isSubtype(var s, var t) {
// constructed from the type of [t].
var typeOfS = isJsArray(s) ? getIndex(s, 0) : s;
var typeOfT = isJsArray(t) ? getIndex(t, 0) : t;
+
// Check for a subtyping flag.
- var name = runtimeTypeToString(typeOfT);
// Get the necessary substitution of the type arguments, if there is one.
var substitution;
if (isNotIdentical(typeOfT, typeOfS)) {
- // TODO(floitsch): change this to:
- // if (!JS_BUILTIN('depends:none;effects:none;returns:bool',
- // JsBuiltin.implementsType,
- // typeOfSPrototype, name)) {
- // return false;
- // }
- var test = '${JS_OPERATOR_IS_PREFIX()}${name}';
+ if (!builtinIsSubtype(typeOfS, runtimeTypeToString(typeOfT))) {
+ return false;
+ }
var typeOfSPrototype = JS('', '#.prototype', typeOfS);
- if (hasNoField(typeOfSPrototype, test)) return false;
var field = '${JS_OPERATOR_AS_PREFIX()}${runtimeTypeToString(typeOfT)}';
substitution = getField(typeOfSPrototype, field);
}
« no previous file with comments | « sdk/lib/_internal/compiler/js_lib/js_helper.dart ('k') | sdk/lib/_internal/compiler/js_lib/shared/embedded_names.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698