| OLD | NEW |
| (Empty) | |
| 1 var _js_names; |
| 2 (function(_js_names) { |
| 3 'use strict'; |
| 4 // Function preserveNames: () → dynamic |
| 5 function preserveNames() { |
| 6 } |
| 7 dart.defineLazyProperties(_js_names, { |
| 8 get mangledNames() { |
| 9 return computeMangledNames(_foreign_helper.JS_EMBEDDED_GLOBAL('=Object', d
art.as(_js_embedded_names.MANGLED_NAMES, core.String)), false); |
| 10 }, |
| 11 get reflectiveNames() { |
| 12 return computeReflectiveNames(_js_names.mangledNames); |
| 13 }, |
| 14 get mangledGlobalNames() { |
| 15 return computeMangledNames(_foreign_helper.JS_EMBEDDED_GLOBAL('=Object', d
art.as(_js_embedded_names.MANGLED_GLOBAL_NAMES, core.String)), true); |
| 16 }, |
| 17 get reflectiveGlobalNames() { |
| 18 return computeReflectiveNames(_js_names.mangledGlobalNames); |
| 19 } |
| 20 }); |
| 21 // Function computeMangledNames: (dynamic, bool) → Map<String, String> |
| 22 function computeMangledNames(jsMangledNames, isGlobal) { |
| 23 preserveNames(); |
| 24 let keys = extractKeys(jsMangledNames); |
| 25 let result = dart.map(); |
| 26 let getterPrefix = _foreign_helper.JS_GET_NAME('GETTER_PREFIX'); |
| 27 let getterPrefixLength = getterPrefix.length; |
| 28 let setterPrefix = _foreign_helper.JS_GET_NAME('SETTER_PREFIX'); |
| 29 for (let key of keys) { |
| 30 let value = dart.as(_foreign_helper.JS('String', '#[#]', jsMangledNames, k
ey), core.String); |
| 31 result.set(key, value); |
| 32 if (!dart.notNull(isGlobal)) { |
| 33 if (key.startsWith(getterPrefix)) { |
| 34 result.set(`${setterPrefix}${key.substring(getterPrefixLength)}`, `${v
alue}=`); |
| 35 } |
| 36 } |
| 37 } |
| 38 return result; |
| 39 } |
| 40 // Function computeReflectiveNames: (Map<String, String>) → Map |
| 41 function computeReflectiveNames(map) { |
| 42 preserveNames(); |
| 43 let result = dart.map(); |
| 44 map.forEach((mangledName, reflectiveName) => { |
| 45 result.set(reflectiveName, mangledName); |
| 46 }); |
| 47 return result; |
| 48 } |
| 49 // Function extractKeys: (dynamic) → List<dynamic> |
| 50 function extractKeys(victim) { |
| 51 let result = _foreign_helper.JS('', '\n(function(victim, hasOwnProperty) {\n
var result = [];\n for (var key in victim) {\n if (hasOwnProperty.call(vic
tim, key)) result.push(key);\n }\n return result;\n})(#, Object.prototype.hasO
wnProperty)', victim); |
| 52 return new _interceptors.JSArray.markFixed(result); |
| 53 } |
| 54 // Function unmangleGlobalNameIfPreservedAnyways: (String) → String |
| 55 function unmangleGlobalNameIfPreservedAnyways(name) { |
| 56 let names = _foreign_helper.JS_EMBEDDED_GLOBAL('=Object', dart.as(_js_embedd
ed_names.MANGLED_GLOBAL_NAMES, core.String)); |
| 57 return dart.as(_js_helper.JsCache.fetch(names, name), core.String); |
| 58 } |
| 59 // Function unmangleAllIdentifiersIfPreservedAnyways: (String) → String |
| 60 function unmangleAllIdentifiersIfPreservedAnyways(str) { |
| 61 return dart.as(_foreign_helper.JS("String", "(#).replace(/[^<,> ]+/g," + "fu
nction(m) { return #[m] || m; })", str, _foreign_helper.JS_EMBEDDED_GLOBAL('', d
art.as(_js_embedded_names.MANGLED_GLOBAL_NAMES, core.String))), core.String); |
| 62 } |
| 63 // Exports: |
| 64 _js_names.preserveNames = preserveNames; |
| 65 _js_names.computeMangledNames = computeMangledNames; |
| 66 _js_names.computeReflectiveNames = computeReflectiveNames; |
| 67 _js_names.extractKeys = extractKeys; |
| 68 _js_names.unmangleGlobalNameIfPreservedAnyways = unmangleGlobalNameIfPreserved
Anyways; |
| 69 _js_names.unmangleAllIdentifiersIfPreservedAnyways = unmangleAllIdentifiersIfP
reservedAnyways; |
| 70 })(_js_names || (_js_names = {})); |
| OLD | NEW |