Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 dart_library.library('dart/_utils', null, /* Imports */[ | 1 dart_library.library('dart/_utils', null, /* Imports */[ |
| 2 ], /* Lazy imports */[ | 2 ], /* Lazy imports */[ |
| 3 ], function(exports, dart) { | 3 ], function(exports, dart) { |
| 4 'use strict'; | 4 'use strict'; |
| 5 const defineProperty = Object.defineProperty; | 5 const defineProperty = Object.defineProperty; |
| 6 const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; | 6 const getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; |
| 7 const getOwnPropertyNames = Object.getOwnPropertyNames; | 7 const getOwnPropertyNames = Object.getOwnPropertyNames; |
| 8 const getOwnPropertySymbols = Object.getOwnPropertySymbols; | 8 const getOwnPropertySymbols = Object.getOwnPropertySymbols; |
| 9 const hasOwnProperty = Object.prototype.hasOwnProperty; | 9 const hasOwnProperty = Object.prototype.hasOwnProperty; |
| 10 const StrongModeError = (function() { | 10 const StrongModeError = (function() { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 61 function defineLazy(to, from) { | 61 function defineLazy(to, from) { |
| 62 for (let name of getOwnNamesAndSymbols(from)) { | 62 for (let name of getOwnNamesAndSymbols(from)) { |
| 63 defineLazyProperty(to, name, getOwnPropertyDescriptor(from, name)); | 63 defineLazyProperty(to, name, getOwnPropertyDescriptor(from, name)); |
| 64 } | 64 } |
| 65 } | 65 } |
| 66 function defineMemoizedGetter(obj, name, getter) { | 66 function defineMemoizedGetter(obj, name, getter) { |
| 67 return defineLazyProperty(obj, name, {get: getter}); | 67 return defineLazyProperty(obj, name, {get: getter}); |
| 68 } | 68 } |
| 69 function copyTheseProperties(to, from, names) { | 69 function copyTheseProperties(to, from, names) { |
| 70 for (let name of names) { | 70 for (let name of names) { |
| 71 defineProperty(to, name, getOwnPropertyDescriptor(from, name)); | 71 var desc = getOwnPropertyDescriptor(from, name); |
| 72 if (desc != void 0) { | |
| 73 defineProperty(to, name, desc); | |
| 74 } else { | |
| 75 defineLazyProperty(to, name, () => from[name]); | |
| 76 } | |
| 72 } | 77 } |
| 73 return to; | 78 return to; |
| 74 } | 79 } |
| 75 function copyProperties(to, from) { | 80 function copyProperties(to, from) { |
| 76 return copyTheseProperties(to, from, getOwnNamesAndSymbols(from)); | 81 return copyTheseProperties(to, from, getOwnNamesAndSymbols(from)); |
| 77 } | 82 } |
| 78 function export_(to, from, show, hide) { | 83 function export_(to, from, show, hide) { |
| 79 if (show == void 0) { | 84 if (show == void 0 || show.length == 0) { |
|
vsm
2015/12/01 22:29:51
Note: show is undefined on a regular export and []
| |
| 80 show = getOwnNamesAndSymbols(from); | 85 show = getOwnNamesAndSymbols(from); |
| 81 } | 86 } |
| 82 if (hide != void 0) { | 87 if (hide != void 0) { |
| 83 var hideMap = new Set(hide); | 88 var hideMap = new Set(hide); |
| 84 show = show.filter(k => !hideMap.has(k)); | 89 show = show.filter(k => !hideMap.has(k)); |
| 85 } | 90 } |
| 86 return copyTheseProperties(to, from, show); | 91 return copyTheseProperties(to, from, show); |
| 87 } | 92 } |
| 88 // Exports: | 93 // Exports: |
| 89 exports.defineProperty = defineProperty; | 94 exports.defineProperty = defineProperty; |
| 90 exports.getOwnPropertyDescriptor = getOwnPropertyDescriptor; | 95 exports.getOwnPropertyDescriptor = getOwnPropertyDescriptor; |
| 91 exports.getOwnPropertyNames = getOwnPropertyNames; | 96 exports.getOwnPropertyNames = getOwnPropertyNames; |
| 92 exports.getOwnPropertySymbols = getOwnPropertySymbols; | 97 exports.getOwnPropertySymbols = getOwnPropertySymbols; |
| 93 exports.hasOwnProperty = hasOwnProperty; | 98 exports.hasOwnProperty = hasOwnProperty; |
| 94 exports.StrongModeError = StrongModeError; | 99 exports.StrongModeError = StrongModeError; |
| 95 exports.throwStrongModeError = throwStrongModeError; | 100 exports.throwStrongModeError = throwStrongModeError; |
| 96 exports.throwInternalError = throwInternalError; | 101 exports.throwInternalError = throwInternalError; |
| 97 exports.assert_ = assert_; | 102 exports.assert_ = assert_; |
| 98 exports.getOwnNamesAndSymbols = getOwnNamesAndSymbols; | 103 exports.getOwnNamesAndSymbols = getOwnNamesAndSymbols; |
| 99 exports.safeGetOwnProperty = safeGetOwnProperty; | 104 exports.safeGetOwnProperty = safeGetOwnProperty; |
| 100 exports.defineLazyProperty = defineLazyProperty; | 105 exports.defineLazyProperty = defineLazyProperty; |
| 101 exports.defineLazy = defineLazy; | 106 exports.defineLazy = defineLazy; |
| 102 exports.defineMemoizedGetter = defineMemoizedGetter; | 107 exports.defineMemoizedGetter = defineMemoizedGetter; |
| 103 exports.copyTheseProperties = copyTheseProperties; | 108 exports.copyTheseProperties = copyTheseProperties; |
| 104 exports.copyProperties = copyProperties; | 109 exports.copyProperties = copyProperties; |
| 105 exports.export_ = export_; | 110 exports.export_ = export_; |
| 106 }); | 111 }); |
| OLD | NEW |