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

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

Issue 12210142: Implement is-checks against type variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 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) 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 663 matching lines...) Expand 10 before | Expand all | Expand 10 after
674 674
675 String operatorIsPrefix() => r'$is'; 675 String operatorIsPrefix() => r'$is';
676 676
677 String operatorAsPrefix() => r'$as'; 677 String operatorAsPrefix() => r'$as';
678 678
679 String operatorIs(Element element) { 679 String operatorIs(Element element) {
680 // TODO(erikcorry): Reduce from $isx to ix when we are minifying. 680 // TODO(erikcorry): Reduce from $isx to ix when we are minifying.
681 return '${operatorIsPrefix()}${getName(element)}'; 681 return '${operatorIsPrefix()}${getName(element)}';
682 } 682 }
683 683
684 String getNativeCheckName() => r'$nativeCheck';
685
684 /* 686 /*
685 * Returns a name that does not clash with reserved JS keywords, 687 * Returns a name that does not clash with reserved JS keywords,
686 * and also ensures it won't clash with other identifiers. 688 * and also ensures it won't clash with other identifiers.
687 */ 689 */
688 String _safeName(String name, Set<String> reserved) { 690 String _safeName(String name, Set<String> reserved) {
689 if (reserved.contains(name) || name.startsWith(r'$')) { 691 if (reserved.contains(name) || name.startsWith(r'$')) {
690 name = '\$$name'; 692 name = '\$$name';
691 } 693 }
692 assert(!reserved.contains(name)); 694 assert(!reserved.contains(name));
693 return name; 695 return name;
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 return const SourceString(r'$or'); 758 return const SourceString(r'$or');
757 } else if (value == '-') { 759 } else if (value == '-') {
758 return const SourceString(r'$sub'); 760 return const SourceString(r'$sub');
759 } else if (value == 'unary-') { 761 } else if (value == 'unary-') {
760 return const SourceString(r'$negate'); 762 return const SourceString(r'$negate');
761 } else { 763 } else {
762 return name; 764 return name;
763 } 765 }
764 } 766 }
765 } 767 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698