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

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 2668543002: Fix dynamic calls on JS interop classes. (Closed)
Patch Set: Created 3 years, 10 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:
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 14ac107b6157077328ff10ea4ce70c9763c9f5ca..222f6226cca83c0f9b9f53950c6f67bc47bd923c 100644
--- a/pkg/dev_compiler/lib/js/legacy/dart_sdk.js
+++ b/pkg/dev_compiler/lib/js/legacy/dart_sdk.js
@@ -1124,6 +1124,14 @@ dart_library.library('dart_sdk', null, /* Imports */[
dart.getType = function(obj) {
return obj == null ? core.Object : obj.__proto__.constructor;
};
+ dart.isJsInterop = function(obj) {
+ if (typeof obj === "function") {
+ return dart._getRuntimeType(obj) == null;
+ }
+ if (typeof obj !== "object") return false;
+ if (dart.getExtensionType(obj) != null) return false;
+ return !(obj instanceof core.Object);
+ };
dart.getMethodType = function(type, name) {
let sigObj = type[dart._methodSig];
if (sigObj === void 0) return void 0;
@@ -1923,6 +1931,17 @@ dart_library.library('dart_sdk', null, /* Imports */[
let type = dart.getType(obj);
if (dart.test(dart.hasField(type, f)) || dart.test(dart.hasGetter(type, f))) return obj[f];
if (dart.test(dart.hasMethod(type, f))) return dart.bind(obj, f, void 0);
+ if (dart.test(dart.isJsInterop(obj))) return obj[f];
+ }
+ return dart.noSuchMethod(obj, new dart.InvocationImpl(field, [], {isGetter: true}));
+ };
+ dart.dloadMirror = function(obj, field) {
+ let f = dart._canonicalMember(obj, field);
+ dart._trackCall(obj);
+ if (f != null) {
+ let type = dart.getType(obj);
+ if (dart.test(dart.hasField(type, f)) || dart.test(dart.hasGetter(type, f))) return obj[f];
+ if (dart.test(dart.hasMethod(type, f))) return dart.bind(obj, f, void 0);
}
return dart.noSuchMethod(obj, new dart.InvocationImpl(field, [], {isGetter: true}));
};
@@ -1931,7 +1950,7 @@ dart_library.library('dart_sdk', null, /* Imports */[
if (genericClass != null) return genericClass();
return type;
};
- dart.dputLegacy = function(obj, field, value) {
+ dart.dputMirror = function(obj, field, value) {
let f = dart._canonicalMember(obj, field);
dart._trackCall(obj);
if (f != null) {
@@ -1961,6 +1980,9 @@ dart_library.library('dart_sdk', null, /* Imports */[
if (fieldType != void 0) {
return obj[f] = dart.check(value, fieldType);
}
+ if (dart.test(dart.isJsInterop(obj))) {
+ return obj[f] = value;
+ }
}
}
return dart.noSuchMethod(obj, new dart.InvocationImpl(field, [value], {isSetter: true}));
@@ -13656,11 +13678,11 @@ dart_library.library('dart_sdk', null, /* Imports */[
}
});
_js_mirrors._dload = function(obj, name) {
- return _js_mirrors._dart.dload(obj, name);
+ return _js_mirrors._dart.dloadMirror(obj, name);
};
dart.lazyFn(_js_mirrors._dload, () => dynamicAndStringTodynamic());
_js_mirrors._dput = function(obj, name, val) {
- _js_mirrors._dart.dputLegacy(obj, name, val);
+ _js_mirrors._dart.dputMirror(obj, name, val);
};
dart.lazyFn(_js_mirrors._dput, () => dynamicAndStringAnddynamicTovoid());
_js_mirrors._dcall = function(obj, args) {
« 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