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

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

Issue 10880068: - Change "static final" to "static const" in the lib/ directory. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 3 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 /** 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 15 matching lines...) Expand all
26 : globals = new Map<Element, String>(), 26 : globals = new Map<Element, String>(),
27 usedGlobals = new Map<String, int>(), 27 usedGlobals = new Map<String, int>(),
28 shortPrivateNameOwners = new Map<String, LibraryElement>(); 28 shortPrivateNameOwners = new Map<String, LibraryElement>();
29 29
30 final String CURRENT_ISOLATE = @'$'; 30 final String CURRENT_ISOLATE = @'$';
31 final String ISOLATE = 'Isolate'; 31 final String ISOLATE = 'Isolate';
32 final String ISOLATE_PROPERTIES = @"$isolateProperties"; 32 final String ISOLATE_PROPERTIES = @"$isolateProperties";
33 /** Some closures must contain their name. The name is stored in 33 /** Some closures must contain their name. The name is stored in
34 * [STATIC_CLOSURE_NAME_NAME]. */ 34 * [STATIC_CLOSURE_NAME_NAME]. */
35 final String STATIC_CLOSURE_NAME_NAME = @'$name'; 35 final String STATIC_CLOSURE_NAME_NAME = @'$name';
36 static final SourceString CLOSURE_INVOCATION_NAME = 36 static const SourceString CLOSURE_INVOCATION_NAME =
37 Compiler.CALL_OPERATOR_NAME; 37 Compiler.CALL_OPERATOR_NAME;
38 38
39 39
40 String closureInvocationName(Selector selector) { 40 String closureInvocationName(Selector selector) {
41 // TODO(floitsch): mangle, while not conflicting with instance names. 41 // TODO(floitsch): mangle, while not conflicting with instance names.
42 return instanceMethodInvocationName(null, CLOSURE_INVOCATION_NAME, 42 return instanceMethodInvocationName(null, CLOSURE_INVOCATION_NAME,
43 selector); 43 selector);
44 } 44 }
45 45
46 String breakLabelName(LabelElement label) { 46 String breakLabelName(LabelElement label) {
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 } while (usedGlobals[name] !== null); 169 } while (usedGlobals[name] !== null);
170 // Record the count in case we see this name later. We 170 // Record the count in case we see this name later. We
171 // frequently see names multiple times, as all our closures use 171 // frequently see names multiple times, as all our closures use
172 // the same name for their class. 172 // the same name for their class.
173 usedGlobals[proposedName] = count; 173 usedGlobals[proposedName] = count;
174 } 174 }
175 usedGlobals[name] = 0; 175 usedGlobals[name] = 0;
176 return name; 176 return name;
177 } 177 }
178 178
179 static final String LIBRARY_PREFIX = "lib"; 179 static const String LIBRARY_PREFIX = "lib";
180 180
181 /** 181 /**
182 * Returns a preferred JS-id for the given top-level or static element. 182 * Returns a preferred JS-id for the given top-level or static element.
183 * The returned id is guaranteed to be a valid JS-id. 183 * The returned id is guaranteed to be a valid JS-id.
184 */ 184 */
185 String _computeGuess(Element element) { 185 String _computeGuess(Element element) {
186 assert(!element.isInstanceMember()); 186 assert(!element.isInstanceMember());
187 LibraryElement lib = element.getLibrary(); 187 LibraryElement lib = element.getLibrary();
188 String name; 188 String name;
189 if (element.isGenerativeConstructor()) { 189 if (element.isGenerativeConstructor()) {
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 } 294 }
295 295
296 String safeName(String name) { 296 String safeName(String name) {
297 if (jsReserved.contains(name) || name.startsWith('\$')) { 297 if (jsReserved.contains(name) || name.startsWith('\$')) {
298 name = "\$$name"; 298 name = "\$$name";
299 assert(!jsReserved.contains(name)); 299 assert(!jsReserved.contains(name));
300 } 300 }
301 return name; 301 return name;
302 } 302 }
303 } 303 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/library_map.dart ('k') | lib/compiler/implementation/scanner/keyword.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698