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

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

Issue 10539104: Give static functions that have a getter a name. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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 | « lib/compiler/implementation/emitter.dart ('k') | lib/isolate/frog/isolateimpl.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
11 static final CLOSURE_INVOCATION_NAME = const SourceString('\$call'); 11 static final CLOSURE_INVOCATION_NAME = const SourceString('\$call');
12 static final STATIC_CLOSURE_NAME_NAME = '\$name';
12 static final OPERATOR_EQUALS = const SourceString('operator\$eq'); 13 static final OPERATOR_EQUALS = const SourceString('operator\$eq');
13 14
14 static Set<String> _jsReserved = null; 15 static Set<String> _jsReserved = null;
15 Set<String> get jsReserved() { 16 Set<String> get jsReserved() {
16 if (_jsReserved === null) { 17 if (_jsReserved === null) {
17 _jsReserved = new Set<String>(); 18 _jsReserved = new Set<String>();
18 _jsReserved.addAll(JsNames.javaScriptKeywords); 19 _jsReserved.addAll(JsNames.javaScriptKeywords);
19 _jsReserved.addAll(JsNames.reservedPropertySymbols); 20 _jsReserved.addAll(JsNames.reservedPropertySymbols);
20 } 21 }
21 return _jsReserved; 22 return _jsReserved;
(...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 } 242 }
242 243
243 String safeName(String name) { 244 String safeName(String name) {
244 if (jsReserved.contains(name) || name.startsWith('\$')) { 245 if (jsReserved.contains(name) || name.startsWith('\$')) {
245 name = "\$$name"; 246 name = "\$$name";
246 assert(!jsReserved.contains(name)); 247 assert(!jsReserved.contains(name));
247 } 248 }
248 return name; 249 return name;
249 } 250 }
250 } 251 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/emitter.dart ('k') | lib/isolate/frog/isolateimpl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698