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

Side by Side Diff: sdk/lib/_internal/compiler/js_lib/js_names.dart

Issue 944423002: Revert "Use an enum in embedded_names as input to JS_GET_NAME." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart._js_names; 5 library dart._js_names;
6 6
7 import 'dart:_js_embedded_names' show 7 import 'dart:_js_embedded_names' show
8 JsGetName,
9 MANGLED_GLOBAL_NAMES, 8 MANGLED_GLOBAL_NAMES,
10 MANGLED_NAMES; 9 MANGLED_NAMES;
11 10
12 import 'dart:_foreign_helper' show 11 import 'dart:_foreign_helper' show
13 JS, 12 JS,
14 JS_EMBEDDED_GLOBAL, 13 JS_EMBEDDED_GLOBAL,
15 JS_GET_NAME; 14 JS_GET_NAME;
16 15
17 import 'dart:_js_helper' show 16 import 'dart:_js_helper' show
18 JsCache, 17 JsCache,
(...skipping 28 matching lines...) Expand all
47 /// [mangledGlobalNames]). 46 /// [mangledGlobalNames]).
48 final Map<String, String> reflectiveGlobalNames = 47 final Map<String, String> reflectiveGlobalNames =
49 computeReflectiveNames(mangledGlobalNames); 48 computeReflectiveNames(mangledGlobalNames);
50 49
51 /// [jsMangledNames] is a JavaScript object literal. The keys are the mangled 50 /// [jsMangledNames] is a JavaScript object literal. The keys are the mangled
52 /// names, and the values are the "reflective" names. 51 /// names, and the values are the "reflective" names.
53 Map<String, String> computeMangledNames(jsMangledNames, bool isGlobal) { 52 Map<String, String> computeMangledNames(jsMangledNames, bool isGlobal) {
54 preserveNames(); 53 preserveNames();
55 var keys = extractKeys(jsMangledNames); 54 var keys = extractKeys(jsMangledNames);
56 var result = <String, String>{}; 55 var result = <String, String>{};
57 String getterPrefix = JS_GET_NAME(JsGetName.GETTER_PREFIX); 56 String getterPrefix = JS_GET_NAME('GETTER_PREFIX');
58 int getterPrefixLength = getterPrefix.length; 57 int getterPrefixLength = getterPrefix.length;
59 String setterPrefix = JS_GET_NAME(JsGetName.SETTER_PREFIX); 58 String setterPrefix = JS_GET_NAME('SETTER_PREFIX');
60 for (String key in keys) { 59 for (String key in keys) {
61 String value = JS('String', '#[#]', jsMangledNames, key); 60 String value = JS('String', '#[#]', jsMangledNames, key);
62 result[key] = value; 61 result[key] = value;
63 if (!isGlobal) { 62 if (!isGlobal) {
64 if (key.startsWith(getterPrefix)) { 63 if (key.startsWith(getterPrefix)) {
65 result['$setterPrefix${key.substring(getterPrefixLength)}'] = '$value='; 64 result['$setterPrefix${key.substring(getterPrefixLength)}'] = '$value=';
66 } 65 }
67 } 66 }
68 } 67 }
69 return result; 68 return result;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 return JsCache.fetch(names, name); 106 return JsCache.fetch(names, name);
108 } 107 }
109 108
110 String unmangleAllIdentifiersIfPreservedAnyways(String str) { 109 String unmangleAllIdentifiersIfPreservedAnyways(String str) {
111 return JS("String", 110 return JS("String",
112 r"(#).replace(/[^<,> ]+/g," 111 r"(#).replace(/[^<,> ]+/g,"
113 r"function(m) { return #[m] || m; })", 112 r"function(m) { return #[m] || m; })",
114 str, 113 str,
115 JS_EMBEDDED_GLOBAL('', MANGLED_GLOBAL_NAMES)); 114 JS_EMBEDDED_GLOBAL('', MANGLED_GLOBAL_NAMES));
116 } 115 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/compiler/js_lib/js_mirrors.dart ('k') | sdk/lib/_internal/compiler/js_lib/shared/embedded_names.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698