Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 14 matching lines...) Expand all Loading... | |
| 25 Map<String, int> usedGlobals; | 25 Map<String, int> usedGlobals; |
| 26 | 26 |
| 27 Namer(this.compiler) | 27 Namer(this.compiler) |
| 28 : globals = new Map<Element, String>(), | 28 : globals = new Map<Element, String>(), |
| 29 usedGlobals = new Map<String, int>(); | 29 usedGlobals = new Map<String, int>(); |
| 30 | 30 |
| 31 final String CURRENT_ISOLATE = "\$"; | 31 final String CURRENT_ISOLATE = "\$"; |
| 32 final String ISOLATE = "Isolate"; | 32 final String ISOLATE = "Isolate"; |
| 33 | 33 |
| 34 | 34 |
| 35 String closureInvocationName(int arity) { | 35 String closureInvocationName(Selector selector) { |
| 36 // TODO(floitsch): mangle, while not conflicting with instance names. | 36 // TODO(floitsch): mangle, while not conflicting with instance names. |
| 37 return instanceMethodName(CLOSURE_INVOCATION_NAME, arity); | 37 return instanceMethodInvocationName(CLOSURE_INVOCATION_NAME, selector); |
| 38 } | 38 } |
| 39 | 39 |
| 40 String instanceMethodName(SourceString name, int arity) { | 40 String instanceMethodName(SourceString name, int arity) { |
|
floitsch
2012/02/01 12:19:17
Do we still need this one?
ngeoffray
2012/02/01 13:02:40
For the definition of the method (that does not ha
| |
| 41 // TODO(floitsch): mangle, while preserving uniqueness. | 41 // TODO(floitsch): mangle, while preserving uniqueness. |
| 42 return '$name\$$arity'; | 42 return '$name\$$arity'; |
| 43 } | 43 } |
| 44 | 44 |
| 45 String instanceMethodInvocationName(SourceString name, Selector selector) { | |
| 46 // TODO(floitsch): mangle, while preserving uniqueness. | |
| 47 return '$name\$$selector'; | |
| 48 } | |
| 49 | |
| 45 String instanceFieldName(SourceString name) { | 50 String instanceFieldName(SourceString name) { |
| 46 return '$name'; | 51 return '$name'; |
| 47 } | 52 } |
| 48 | 53 |
| 49 String setterName(SourceString name) { | 54 String setterName(SourceString name) { |
| 50 return 'set\$$name'; | 55 return 'set\$$name'; |
| 51 } | 56 } |
| 52 | 57 |
| 53 String getterName(SourceString name) { | 58 String getterName(SourceString name) { |
| 54 return 'get\$$name'; | 59 return 'get\$$name'; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 166 } | 171 } |
| 167 | 172 |
| 168 String isolateBailoutAccess(Element element) { | 173 String isolateBailoutAccess(Element element) { |
| 169 return '${isolateAccess(element)}\$bailout'; | 174 return '${isolateAccess(element)}\$bailout'; |
| 170 } | 175 } |
| 171 | 176 |
| 172 String operatorIs(ClassElement element) { | 177 String operatorIs(ClassElement element) { |
| 173 return 'is\$${getName(element)}'; | 178 return 'is\$${getName(element)}'; |
| 174 } | 179 } |
| 175 } | 180 } |
| OLD | NEW |