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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_backend/namer.dart

Issue 14267021: Fix bug with namer: use the same encoding for an instance method, whether it is an invocation or a … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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/language/language_dart2js.status » ('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) 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 Namer implements ClosureNamer { 10 class Namer implements ClosureNamer {
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 SourceString name = selector.name; 357 SourceString name = selector.name;
358 if (selector.kind == SelectorKind.OPERATOR 358 if (selector.kind == SelectorKind.OPERATOR
359 || selector.kind == SelectorKind.INDEX) { 359 || selector.kind == SelectorKind.INDEX) {
360 name = operatorNameToIdentifier(name); 360 name = operatorNameToIdentifier(name);
361 assert(name != selector.name); 361 assert(name != selector.name);
362 return getMappedOperatorName(name.slowToString()); 362 return getMappedOperatorName(name.slowToString());
363 } 363 }
364 assert(name == operatorNameToIdentifier(name)); 364 assert(name == operatorNameToIdentifier(name));
365 StringBuffer buffer = new StringBuffer(); 365 StringBuffer buffer = new StringBuffer();
366 for (SourceString argumentName in selector.getOrderedNamedArguments()) { 366 for (SourceString argumentName in selector.getOrderedNamedArguments()) {
367 buffer.write(r'$'); 367 buffer.write('\$${safeName(argumentName.slowToString())}');
368 argumentName.printOn(buffer);
369 } 368 }
370 String suffix = '\$${selector.argumentCount}$buffer'; 369 String suffix = '\$${selector.argumentCount}$buffer';
371 // We don't mangle the closure invoking function name because it 370 // We don't mangle the closure invoking function name because it
372 // is generated by string concatenation in applyFunction from 371 // is generated by string concatenation in applyFunction from
373 // js_helper.dart. 372 // js_helper.dart.
374 if (selector.isClosureCall()) { 373 if (selector.isClosureCall()) {
375 return "${name.slowToString()}$suffix"; 374 return "${name.slowToString()}$suffix";
376 } else { 375 } else {
377 String proposedName = privateName(selector.library, name); 376 String proposedName = privateName(selector.library, name);
378 return getMappedInstanceName('$proposedName$suffix'); 377 return getMappedInstanceName('$proposedName$suffix');
(...skipping 746 matching lines...) Expand 10 before | Expand all | Expand 10 after
1125 hash = hash ^ (hash >> 6); 1124 hash = hash ^ (hash >> 6);
1126 return hash; 1125 return hash;
1127 } 1126 }
1128 1127
1129 static int _finish(int hash) { 1128 static int _finish(int hash) {
1130 hash = _MASK & (hash + (((_MASK >> 3) & hash) << 3)); 1129 hash = _MASK & (hash + (((_MASK >> 3) & hash) << 3));
1131 hash = hash & (hash >> 11); 1130 hash = hash & (hash >> 11);
1132 return _MASK & (hash + (((_MASK >> 15) & hash) << 15)); 1131 return _MASK & (hash + (((_MASK >> 15) & hash) << 15));
1133 } 1132 }
1134 } 1133 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/language_dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698