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

Side by Side Diff: pkg/compiler/lib/src/js_backend/minify_namer.dart

Issue 1220793006: dart2js: Fix regression in minified names for one shot interceptors. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « no previous file | no next file » | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 part of js_backend; 5 part of js_backend;
6 6
7 /** 7 /**
8 * Assigns JavaScript identifiers to Dart variables, class-names and members. 8 * Assigns JavaScript identifiers to Dart variables, class-names and members.
9 */ 9 */
10 class MinifyNamer extends Namer with _MinifiedFieldNamer { 10 class MinifyNamer extends Namer with _MinifiedFieldNamer,
11 _MinifiedOneShotInterceptorNamer {
11 MinifyNamer(Compiler compiler) : super(compiler) { 12 MinifyNamer(Compiler compiler) : super(compiler) {
12 reserveBackendNames(); 13 reserveBackendNames();
13 fieldRegistry = new _FieldNamingRegistry(this); 14 fieldRegistry = new _FieldNamingRegistry(this);
14 } 15 }
15 16
16 _FieldNamingRegistry fieldRegistry; 17 _FieldNamingRegistry fieldRegistry;
17 18
18 String get isolateName => 'I'; 19 String get isolateName => 'I';
19 String get isolatePropertiesName => 'p'; 20 String get isolatePropertiesName => 'p';
20 bool get shouldMinify => true; 21 bool get shouldMinify => true;
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 @override 249 @override
249 jsAst.Name instanceFieldPropertyName(Element element) { 250 jsAst.Name instanceFieldPropertyName(Element element) {
250 jsAst.Name proposed = _minifiedInstanceFieldPropertyName(element); 251 jsAst.Name proposed = _minifiedInstanceFieldPropertyName(element);
251 if (proposed != null) { 252 if (proposed != null) {
252 return proposed; 253 return proposed;
253 } 254 }
254 return super.instanceFieldPropertyName(element); 255 return super.instanceFieldPropertyName(element);
255 } 256 }
256 } 257 }
257 258
259
260 abstract class _MinifiedOneShotInterceptorNamer implements Namer {
261 /// Property name used for the one-shot interceptor method for the given
262 /// [selector] and return-type specialization.
263 @override
264 jsAst.Name nameForGetOneShotInterceptor(Selector selector,
265 Iterable<ClassElement> classes) {
266 String root = selector.isOperator ? operatorNameToIdentifier(selector.name)
267 : privateName(selector.memberName);
sra1 2015/07/01 01:21:38 Format like this: String root = selector.isOpe
herhut 2015/07/01 08:57:47 Done.
268 String prefix = selector.isGetter ? r"$get"
269 : selector.isSetter ? r"$set" : "";
270 String arity = selector.isCall ? "${selector.argumentCount}" : "";
271 String suffix = suffixForGetInterceptor(classes);
272 String fullName = "\$intercepted$prefix\$$root$arity\$$suffix";
sra1 2015/07/01 01:21:38 Do we need '$intercepted'?
herhut 2015/07/01 08:57:46 So the generated name is only used as a unqiue key
273 return _disambiguateInternalGlobal(fullName);
274 }
275 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698