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

Side by Side Diff: frog/leg/namer.dart

Issue 9146036: Address review comments. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 8 years, 11 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 | frog/leg/resolver.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) 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 /** 5 /**
6 * Assigns JavaScript identifiers to Dart variables, class-names and members. 6 * Assigns JavaScript identifiers to Dart variables, class-names and members.
7 */ 7 */
8 class Namer { 8 class Namer {
9 final Compiler compiler; 9 final Compiler compiler;
10 10
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 } 54 }
55 55
56 /** 56 /**
57 * Returns a preferred JS-id for the given top-level or static element. 57 * Returns a preferred JS-id for the given top-level or static element.
58 * The returned id is guaranteed to be a valid JS-id. 58 * The returned id is guaranteed to be a valid JS-id.
59 */ 59 */
60 String _computeGuess(Element element) { 60 String _computeGuess(Element element) {
61 assert(!element.isInstanceMember()); 61 assert(!element.isInstanceMember());
62 if (element.kind == ElementKind.GENERATIVE_CONSTRUCTOR) { 62 if (element.kind == ElementKind.GENERATIVE_CONSTRUCTOR) {
63 SourceString name = getConstructorName(element); 63 SourceString name = getConstructorName(element);
64 return instanceMethodName(name, element.parameterCount(compiler)); 64 FunctionElement functionElement = element;
65 return instanceMethodName(name, functionElement.parameterCount(compiler));
65 } else { 66 } else {
66 // TODO(floitsch): deal with named constructors. 67 // TODO(floitsch): deal with named constructors.
67 String name = '${element.name}'; 68 String name = '${element.name}';
68 if (element.kind == ElementKind.FUNCTION) { 69 if (element.kind == ElementKind.FUNCTION) {
69 FunctionElement functionElement = element; 70 FunctionElement functionElement = element;
70 name = '$name\$${functionElement.parameterCount(compiler)}'; 71 name = '$name\$${functionElement.parameterCount(compiler)}';
71 } 72 }
72 // Prefix the name with '$' if it is reserved. 73 // Prefix the name with '$' if it is reserved.
73 if (jsReserved.contains(name)) { 74 if (jsReserved.contains(name)) {
74 name = "\$$name"; 75 name = "\$$name";
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 166 }
166 167
167 String isolateBailoutAccess(Element element) { 168 String isolateBailoutAccess(Element element) {
168 return '${isolateAccess(element)}\$bailout'; 169 return '${isolateAccess(element)}\$bailout';
169 } 170 }
170 171
171 String operatorIs(ClassElement element) { 172 String operatorIs(ClassElement element) {
172 return 'is\$${getName(element)}'; 173 return 'is\$${getName(element)}';
173 } 174 }
174 } 175 }
OLDNEW
« no previous file with comments | « no previous file | frog/leg/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698