Skip to content

Commit

Permalink
Fixes for exports
Browse files Browse the repository at this point in the history
BUG=
R=jmesserly@google.com

Review URL: https://codereview.chromium.org/1488273002 .
  • Loading branch information
vsmenon committed Dec 1, 2015
1 parent 6410051 commit 8fb3eb3
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
9 changes: 7 additions & 2 deletions pkg/dev_compiler/lib/runtime/dart/_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,15 +68,20 @@ dart_library.library('dart/_utils', null, /* Imports */[
}
function copyTheseProperties(to, from, names) {
for (let name of names) {
defineProperty(to, name, getOwnPropertyDescriptor(from, name));
var desc = getOwnPropertyDescriptor(from, name);
if (desc != void 0) {
defineProperty(to, name, desc);
} else {
defineLazyProperty(to, name, () => from[name]);
}
}
return to;
}
function copyProperties(to, from) {
return copyTheseProperties(to, from, getOwnNamesAndSymbols(from));
}
function export_(to, from, show, hide) {
if (show == void 0) {
if (show == void 0 || show.length == 0) {
show = getOwnNamesAndSymbols(from);
}
if (hide != void 0) {
Expand Down
9 changes: 7 additions & 2 deletions pkg/dev_compiler/tool/input_sdk/private/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,12 @@ defineMemoizedGetter(obj, String name, getter) =>

copyTheseProperties(to, from, names) => JS('', '''((to, from, names) => {
for (let name of names) {
defineProperty(to, name, getOwnPropertyDescriptor(from, name));
var desc = getOwnPropertyDescriptor(from, name);
if (desc != void 0) {
defineProperty(to, name, desc);
} else {
defineLazyProperty(to, name, () => from[name]);
}
}
return to;
})(#, #, #)''', to, from, names);
Expand All @@ -112,7 +117,7 @@ copyProperties(to, from) => JS('', '''((to, from) => {
// TODO(ochafik): Re-introduce a @JS annotation in the SDK (same as package:js)
// so that this is named 'export' in JavaScript.
export_(to, from, show, hide) => JS('', '''((to, from, show, hide) => {
if (show == void 0) {
if (show == void 0 || show.length == 0) {
show = getOwnNamesAndSymbols(from);
}
if (hide != void 0) {
Expand Down

0 comments on commit 8fb3eb3

Please sign in to comment.