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

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

Issue 11238035: Make isEmpty a getter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status file with co19 issue number. Created 8 years, 1 month 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 /** 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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 LibraryElement lib = element.getLibrary(); 113 LibraryElement lib = element.getLibrary();
114 if (element.kind == ElementKind.GENERATIVE_CONSTRUCTOR_BODY) { 114 if (element.kind == ElementKind.GENERATIVE_CONSTRUCTOR_BODY) {
115 ConstructorBodyElement bodyElement = element; 115 ConstructorBodyElement bodyElement = element;
116 name = bodyElement.constructor.name; 116 name = bodyElement.constructor.name;
117 } 117 }
118 FunctionSignature signature = element.computeSignature(compiler); 118 FunctionSignature signature = element.computeSignature(compiler);
119 String methodName = 119 String methodName =
120 '${privateName(lib, name)}\$${signature.parameterCount}'; 120 '${privateName(lib, name)}\$${signature.parameterCount}';
121 if (!signature.optionalParametersAreNamed) { 121 if (!signature.optionalParametersAreNamed) {
122 return methodName; 122 return methodName;
123 } else if (!signature.optionalParameters.isEmpty()) { 123 } else if (!signature.optionalParameters.isEmpty) {
124 StringBuffer buffer = new StringBuffer(); 124 StringBuffer buffer = new StringBuffer();
125 signature.orderedOptionalParameters.forEach((Element element) { 125 signature.orderedOptionalParameters.forEach((Element element) {
126 buffer.add('\$${JsNames.getValid(element.name.slowToString())}'); 126 buffer.add('\$${JsNames.getValid(element.name.slowToString())}');
127 }); 127 });
128 return '$methodName$buffer'; 128 return '$methodName$buffer';
129 } 129 }
130 } 130 }
131 131
132 String publicInstanceMethodNameByArity(SourceString name, int arity) { 132 String publicInstanceMethodNameByArity(SourceString name, int arity) {
133 assert(!name.isPrivate()); 133 assert(!name.isPrivate());
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 } 322 }
323 323
324 String safeName(String name) { 324 String safeName(String name) {
325 if (jsReserved.contains(name) || name.startsWith('\$')) { 325 if (jsReserved.contains(name) || name.startsWith('\$')) {
326 name = "\$$name"; 326 name = "\$$name";
327 assert(!jsReserved.contains(name)); 327 assert(!jsReserved.contains(name));
328 } 328 }
329 return name; 329 return name;
330 } 330 }
331 } 331 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/js_backend/emitter.dart ('k') | lib/compiler/implementation/js_backend/native_emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698