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) { |
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() { |
11 function StrongModeError(message) { | 11 function StrongModeError(message) { |
12 Error.call(this); | 12 Error.call(this); |
13 this.message = message; | 13 this.message = message; |
14 } | 14 } |
15 ; | 15 ; |
16 Object.setPrototypeOf(StrongModeError.prototype, Error.prototype); | 16 Object.setPrototypeOf(StrongModeError.prototype, Error.prototype); |
17 return StrongModeError; | 17 return StrongModeError; |
18 })(); | 18 })(); |
19 function throwStrongModeError(message) { | 19 function throwStrongModeError(message) { |
20 throw new StrongModeError(message); | 20 throw new StrongModeError(message); |
21 } | 21 } |
22 function throwInternalError(message) { | 22 function throwInternalError(message) { |
23 throw Error(message); | 23 throw Error(message); |
24 } | 24 } |
25 function assert_(condition) { | 25 function assert(condition) { |
26 if (!condition) throwInternalError("The compiler is broken: failed assert"); | 26 if (!condition) throwInternalError("The compiler is broken: failed assert"); |
27 } | 27 } |
28 function getOwnNamesAndSymbols(obj) { | 28 function getOwnNamesAndSymbols(obj) { |
29 return getOwnPropertyNames(obj).concat(getOwnPropertySymbols(obj)); | 29 return getOwnPropertyNames(obj).concat(getOwnPropertySymbols(obj)); |
30 } | 30 } |
31 function safeGetOwnProperty(obj, name) { | 31 function safeGetOwnProperty(obj, name) { |
32 let desc = getOwnPropertyDescriptor(obj, name); | 32 let desc = getOwnPropertyDescriptor(obj, name); |
33 if (desc) return desc.value; | 33 if (desc) return desc.value; |
34 } | 34 } |
35 function defineLazyProperty(to, name, desc) { | 35 function defineLazyProperty(to, name, desc) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 defineProperty(to, name, desc); | 69 defineProperty(to, name, desc); |
70 } else { | 70 } else { |
71 defineLazyProperty(to, name, () => from[name]); | 71 defineLazyProperty(to, name, () => from[name]); |
72 } | 72 } |
73 } | 73 } |
74 return to; | 74 return to; |
75 } | 75 } |
76 function copyProperties(to, from) { | 76 function copyProperties(to, from) { |
77 return copyTheseProperties(to, from, getOwnNamesAndSymbols(from)); | 77 return copyTheseProperties(to, from, getOwnNamesAndSymbols(from)); |
78 } | 78 } |
79 function export_(to, from, show, hide) { | 79 function export$(to, from, show, hide) { |
80 if (show == void 0 || show.length == 0) { | 80 if (show == void 0 || show.length == 0) { |
81 show = getOwnNamesAndSymbols(from); | 81 show = getOwnNamesAndSymbols(from); |
82 } | 82 } |
83 if (hide != void 0) { | 83 if (hide != void 0) { |
84 var hideMap = new Set(hide); | 84 var hideMap = new Set(hide); |
85 show = show.filter(k => !hideMap.has(k)); | 85 show = show.filter(k => !hideMap.has(k)); |
86 } | 86 } |
87 return copyTheseProperties(to, from, show); | 87 return copyTheseProperties(to, from, show); |
88 } | 88 } |
89 // Exports: | 89 // Exports: |
90 exports.defineProperty = defineProperty; | 90 exports.defineProperty = defineProperty; |
91 exports.getOwnPropertyDescriptor = getOwnPropertyDescriptor; | 91 exports.getOwnPropertyDescriptor = getOwnPropertyDescriptor; |
92 exports.getOwnPropertyNames = getOwnPropertyNames; | 92 exports.getOwnPropertyNames = getOwnPropertyNames; |
93 exports.getOwnPropertySymbols = getOwnPropertySymbols; | 93 exports.getOwnPropertySymbols = getOwnPropertySymbols; |
94 exports.hasOwnProperty = hasOwnProperty; | 94 exports.hasOwnProperty = hasOwnProperty; |
95 exports.StrongModeError = StrongModeError; | 95 exports.StrongModeError = StrongModeError; |
96 exports.throwStrongModeError = throwStrongModeError; | 96 exports.throwStrongModeError = throwStrongModeError; |
97 exports.throwInternalError = throwInternalError; | 97 exports.throwInternalError = throwInternalError; |
98 exports.assert_ = assert_; | 98 exports.assert = assert; |
99 exports.getOwnNamesAndSymbols = getOwnNamesAndSymbols; | 99 exports.getOwnNamesAndSymbols = getOwnNamesAndSymbols; |
100 exports.safeGetOwnProperty = safeGetOwnProperty; | 100 exports.safeGetOwnProperty = safeGetOwnProperty; |
101 exports.defineLazyProperty = defineLazyProperty; | 101 exports.defineLazyProperty = defineLazyProperty; |
102 exports.defineLazy = defineLazy; | 102 exports.defineLazy = defineLazy; |
103 exports.defineMemoizedGetter = defineMemoizedGetter; | 103 exports.defineMemoizedGetter = defineMemoizedGetter; |
104 exports.copyTheseProperties = copyTheseProperties; | 104 exports.copyTheseProperties = copyTheseProperties; |
105 exports.copyProperties = copyProperties; | 105 exports.copyProperties = copyProperties; |
106 exports.export_ = export_; | 106 exports.export = export$; |
107 }); | 107 }); |
OLD | NEW |