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

Unified Diff: lib/runtime/dart_sdk.js

Side-by-side diff isn't available for this file because of its large size.
Issue 1949733002: fix #543, export of properties should now work (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 4 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:
Download patch
« no previous file with comments | « no previous file | lib/src/compiler/code_generator.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/runtime/dart_sdk.js
diff --git a/lib/runtime/dart_sdk.js b/lib/runtime/dart_sdk.js
index 6dc9efc15a537b2a32feafde66ce1dc07aef4a1d..726b6364d22eef03d1bedbe80e7291513547e54a 100644
--- a/lib/runtime/dart_sdk.js
+++ b/lib/runtime/dart_sdk.js
@@ -1162,10 +1162,18 @@ dart_library.library('dart_sdk', null, /* Imports */[
}
return true;
};
- dart.defineProperty = Object.defineProperty;
- dart.getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
- dart.getOwnPropertyNames = Object.getOwnPropertyNames;
- dart.getOwnPropertySymbols = Object.getOwnPropertySymbols;
+ dart.defineProperty = function(obj, name, desc) {
+ return Object.defineProperty(obj, name, desc);
+ };
+ dart.getOwnPropertyDescriptor = function(obj, name) {
+ return Object.getOwnPropertyDescriptor(obj, name);
+ };
+ dart.getOwnPropertyNames = function(obj) {
+ return Object.getOwnPropertyNames(obj);
+ };
+ dart.getOwnPropertySymbols = function(obj) {
+ return Object.getOwnPropertySymbols(obj);
+ };
dart.hasOwnProperty = Object.prototype.hasOwnProperty;
dart.StrongModeError = (function() {
function StrongModeError(message) {
@@ -1183,11 +1191,13 @@ dart_library.library('dart_sdk', null, /* Imports */[
throw Error(message);
};
dart.getOwnNamesAndSymbols = function(obj) {
- return dart.getOwnPropertyNames(obj).concat(dart.getOwnPropertySymbols(obj));
+ let names = dart.getOwnPropertyNames(obj);
+ let symbols = dart.getOwnPropertySymbols(obj);
+ return names.concat(symbols);
};
dart.safeGetOwnProperty = function(obj, name) {
let desc = dart.getOwnPropertyDescriptor(obj, name);
- if (desc) return desc.value;
+ if (desc != null) return desc.value;
};
dart.defineLazyProperty = function(to, name, desc) {
let init = desc.get;
@@ -1221,21 +1231,25 @@ dart_library.library('dart_sdk', null, /* Imports */[
};
dart.copyTheseProperties = function(to, from, names) {
for (let name of names) {
- let desc = dart.getOwnPropertyDescriptor(from, name);
- if (desc != void 0) {
- if (name == Symbol.iterator) {
- let existing = dart.getOwnPropertyDescriptor(to, name);
- if (existing != null) {
- if (existing.writable) to[Symbol.iterator] = desc.value;
- continue;
- }
+ dart.copyProperty(to, from, name);
+ }
+ return to;
+ };
+ dart.copyProperty = function(to, from, name) {
+ let desc = dart.getOwnPropertyDescriptor(from, name);
+ if (name == Symbol.iterator) {
+ let existing = dart.getOwnPropertyDescriptor(to, name);
+ if (existing != null) {
+ if (existing.writable) {
+ to[name] = desc.value;
}
- dart.defineProperty(to, name, desc);
- } else {
- dart.defineLazyProperty(to, name, () => from[name]);
+ return;
}
}
- return to;
+ dart.defineProperty(to, name, desc);
+ };
+ dart.export = function(to, from, name) {
+ return dart.copyProperty(to, from, name);
};
dart.copyProperties = function(to, from) {
return dart.copyTheseProperties(to, from, dart.getOwnNamesAndSymbols(from));
« no previous file with comments | « no previous file | lib/src/compiler/code_generator.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698