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

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

Issue 1052653002: Fix length computation on init.mangledNames. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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
« no previous file with comments | « no previous file | tests/lib/mirrors/reflect_two_classes_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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, 8 JsGetName,
9 MANGLED_GLOBAL_NAMES, 9 MANGLED_GLOBAL_NAMES,
10 MANGLED_NAMES; 10 MANGLED_NAMES;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 if (_isInstance && key.startsWith(getterPrefix)) { 123 if (_isInstance && key.startsWith(getterPrefix)) {
124 int getterPrefixLength = getterPrefix.length; 124 int getterPrefixLength = getterPrefix.length;
125 String setterPrefix = JS_GET_NAME(JsGetName.SETTER_PREFIX); 125 String setterPrefix = JS_GET_NAME(JsGetName.SETTER_PREFIX);
126 result['$reflectiveName='] = 126 result['$reflectiveName='] =
127 '$setterPrefix${key.substring(getterPrefixLength)}'; 127 '$setterPrefix${key.substring(getterPrefixLength)}';
128 } 128 }
129 } 129 }
130 return result; 130 return result;
131 } 131 }
132 132
133 int get _jsMangledNamesLength => JS('int', '#.length', _jsMangledNames); 133 int get _jsMangledNamesLength => JS('int', 'Object.keys(#).length',
134 _jsMangledNames);
134 135
135 String operator[](String key) { 136 String operator[](String key) {
136 if (_cache == null || _jsMangledNamesLength != _cacheLength) { 137 if (_cache == null || _jsMangledNamesLength != _cacheLength) {
137 _cache = _updateReflectiveNames(); 138 _cache = _updateReflectiveNames();
138 _cacheLength = _jsMangledNamesLength; 139 _cacheLength = _jsMangledNamesLength;
139 } 140 }
140 return _cache[key]; 141 return _cache[key];
141 } 142 }
142 } 143 }
143 144
(...skipping 19 matching lines...) Expand all
163 return JsCache.fetch(names, name); 164 return JsCache.fetch(names, name);
164 } 165 }
165 166
166 String unmangleAllIdentifiersIfPreservedAnyways(String str) { 167 String unmangleAllIdentifiersIfPreservedAnyways(String str) {
167 return JS("String", 168 return JS("String",
168 r"(#).replace(/[^<,> ]+/g," 169 r"(#).replace(/[^<,> ]+/g,"
169 r"function(m) { return #[m] || m; })", 170 r"function(m) { return #[m] || m; })",
170 str, 171 str,
171 JS_EMBEDDED_GLOBAL('', MANGLED_GLOBAL_NAMES)); 172 JS_EMBEDDED_GLOBAL('', MANGLED_GLOBAL_NAMES));
172 } 173 }
OLDNEW
« no previous file with comments | « no previous file | tests/lib/mirrors/reflect_two_classes_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698