Index: pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/types.dart |
diff --git a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/types.dart b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/types.dart |
index 91a4ea82f883c5754c3557c915f098774700802a..4d402db12c117e7ed6b633ca64e7a420543b7322 100644 |
--- a/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/types.dart |
+++ b/pkg/dev_compiler/tool/input_sdk/private/ddc_runtime/types.dart |
@@ -77,8 +77,19 @@ class LazyJSType implements Type { |
toString() => _jsTypeCallback != null ? typeName(_rawJSType) : _dartName; |
} |
+void _warn(arg) { |
+ JS('void', 'console.warn(#)', arg); |
+} |
+ |
_isInstanceOfLazyJSType(o, LazyJSType t) { |
if (t._jsTypeCallback != null) { |
+ if (t._rawJSType == null) { |
+ var expected = t._dartName; |
+ var actual = typeName(getReifiedType(o)); |
+ _warn('Cannot find native JavaScript type ($expected) ' |
+ 'to type check $actual'); |
+ return true; |
+ } |
return JS('bool', 'dart.is(#, #)', o, t._rawJSType); |
} |
if (o == null) return false; |
@@ -88,6 +99,13 @@ _isInstanceOfLazyJSType(o, LazyJSType t) { |
_asInstanceOfLazyJSType(o, LazyJSType t) { |
if (t._jsTypeCallback != null) { |
+ if (t._rawJSType == null) { |
+ var expected = t._dartName; |
+ var actual = typeName(getReifiedType(o)); |
+ _warn('Cannot find native JavaScript type ($expected) ' |
+ 'to type check $actual'); |
+ return o; |
+ } |
return JS('bool', 'dart.as(#, #)', o, t._rawJSType); |
} |
// Anonymous case: allow any JS type. |
@@ -134,6 +152,9 @@ _initialize2() => JS( |
$LazyJSType.prototype.as = function as_T(object) { |
return $_asInstanceOfLazyJSType(object, this); |
}; |
+ $LazyJSType.prototype._check = function check_T(object) { |
+ return $_asInstanceOfLazyJSType(object, this); |
+ }; |
})()'''); |
class Void extends TypeRep { |