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

Unified Diff: pkg/dev_compiler/lib/js/legacy/dart_sdk.js

Side-by-side diff isn't available for this file because of its large size.
Issue 2542833002: Some fixes for lazy JS types (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
Download patch
« no previous file with comments | « pkg/dev_compiler/lib/js/es6/dart_sdk.js ('k') | pkg/dev_compiler/lib/sdk/ddc_sdk.sum » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/dev_compiler/lib/js/legacy/dart_sdk.js
diff --git a/pkg/dev_compiler/lib/js/legacy/dart_sdk.js b/pkg/dev_compiler/lib/js/legacy/dart_sdk.js
index dd8f7bb8c5f6c2ce68d67dbebe614f55785f12b8..34888fddba675928ed3f21dce9844e03a42a5b85 100644
--- a/pkg/dev_compiler/lib/js/legacy/dart_sdk.js
+++ b/pkg/dev_compiler/lib/js/legacy/dart_sdk.js
@@ -1210,10 +1210,20 @@ dart_library.library('dart_sdk', null, /* Imports */[
dart.tagLazy = function(value, compute) {
dart.defineLazyProperty(value, dart._runtimeType, {get: compute});
};
+ dart._warn = function(arg) {
+ console.warn(arg);
+ };
const _jsTypeCallback = Symbol('_jsTypeCallback');
const _rawJSType = Symbol('_rawJSType');
+ const _dartName = Symbol('_dartName');
dart._isInstanceOfLazyJSType = function(o, t) {
if (t[_jsTypeCallback] != null) {
+ if (t[_rawJSType] == null) {
+ let expected = t[_dartName];
+ let actual = dart.typeName(dart.getReifiedType(o));
+ dart._warn(dart.str`Cannot find native JavaScript type (${expected}) ` + dart.str`to type check ${actual}`);
+ return true;
+ }
return dart.is(o, t[_rawJSType]);
}
if (o == null) return false;
@@ -1221,6 +1231,12 @@ dart_library.library('dart_sdk', null, /* Imports */[
};
dart._asInstanceOfLazyJSType = function(o, t) {
if (t[_jsTypeCallback] != null) {
+ if (t[_rawJSType] == null) {
+ let expected = t[_dartName];
+ let actual = dart.typeName(dart.getReifiedType(o));
+ dart._warn(dart.str`Cannot find native JavaScript type (${expected}) ` + dart.str`to type check ${actual}`);
+ return o;
+ }
return dart.as(o, t[_rawJSType]);
}
if (o == null) return null;
@@ -1255,6 +1271,9 @@ dart_library.library('dart_sdk', null, /* Imports */[
dart.LazyJSType.prototype.as = function as_T(object) {
return dart._asInstanceOfLazyJSType(object, this);
};
+ dart.LazyJSType.prototype._check = function check_T(object) {
+ return dart._asInstanceOfLazyJSType(object, this);
+ };
};
dart._functionType = function(definite, returnType, args, extra) {
if (args === void 0 && extra === void 0) {
@@ -2217,7 +2236,6 @@ dart_library.library('dart_sdk', null, /* Imports */[
return 'dynamic';
}
};
- const _dartName = Symbol('_dartName');
dart.LazyJSType = class LazyJSType extends core.Object {
new(jsTypeCallback, dartName) {
this[_jsTypeCallback] = jsTypeCallback;
« no previous file with comments | « pkg/dev_compiler/lib/js/es6/dart_sdk.js ('k') | pkg/dev_compiler/lib/sdk/ddc_sdk.sum » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698