| 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 part of js_backend; | 5 part of js_backend; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Assigns JavaScript identifiers to Dart variables, class-names and members. | 8 * Assigns JavaScript identifiers to Dart variables, class-names and members. |
| 9 */ | 9 */ |
| 10 class Namer implements ClosureNamer { | 10 class Namer implements ClosureNamer { |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 233 String get STATIC_CLOSURE_NAME_NAME => r'$name'; | 233 String get STATIC_CLOSURE_NAME_NAME => r'$name'; |
| 234 SourceString get closureInvocationSelectorName => Compiler.CALL_OPERATOR_NAME; | 234 SourceString get closureInvocationSelectorName => Compiler.CALL_OPERATOR_NAME; |
| 235 bool get shouldMinify => false; | 235 bool get shouldMinify => false; |
| 236 | 236 |
| 237 String getNameForJsGetName(Node node, String name) { | 237 String getNameForJsGetName(Node node, String name) { |
| 238 switch (name) { | 238 switch (name) { |
| 239 case 'GETTER_PREFIX': return getterPrefix; | 239 case 'GETTER_PREFIX': return getterPrefix; |
| 240 case 'SETTER_PREFIX': return setterPrefix; | 240 case 'SETTER_PREFIX': return setterPrefix; |
| 241 case 'CALL_CATCH_ALL': return callCatchAllName; | 241 case 'CALL_CATCH_ALL': return callCatchAllName; |
| 242 default: | 242 default: |
| 243 compiler.reportErrorCode( | 243 compiler.reportError( |
| 244 node, MessageKind.GENERIC, | 244 node, MessageKind.GENERIC, |
| 245 {'text': 'Error: Namer has no name for "$name".'}); | 245 {'text': 'Error: Namer has no name for "$name".'}); |
| 246 return 'BROKEN'; | 246 return 'BROKEN'; |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 | 249 |
| 250 bool isReserved(String name) => name == isolateName; | 250 bool isReserved(String name) => name == isolateName; |
| 251 | 251 |
| 252 String constantName(Constant constant) { | 252 String constantName(Constant constant) { |
| 253 // In the current implementation it doesn't make sense to give names to | 253 // In the current implementation it doesn't make sense to give names to |
| (...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1263 if (!first) { | 1263 if (!first) { |
| 1264 sb.write('_'); | 1264 sb.write('_'); |
| 1265 } | 1265 } |
| 1266 sb.write('_'); | 1266 sb.write('_'); |
| 1267 visit(link.head); | 1267 visit(link.head); |
| 1268 first = true; | 1268 first = true; |
| 1269 } | 1269 } |
| 1270 } | 1270 } |
| 1271 } | 1271 } |
| 1272 } | 1272 } |
| OLD | NEW |