| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 "Input", "JSObject", "KeyEvent", "Link", "Location", "MimeType", | 138 "Input", "JSObject", "KeyEvent", "Link", "Location", "MimeType", |
| 139 "MouseEvent", "Navigator", "Node", "NodeList", "Option", "Plugin", | 139 "MouseEvent", "Navigator", "Node", "NodeList", "Option", "Plugin", |
| 140 "ProcessingInstruction", "Range", "RangeException", "Screen", "Select", | 140 "ProcessingInstruction", "Range", "RangeException", "Screen", "Select", |
| 141 "Table", "TableCell", "TableRow", "TableSelection", "Text", "TextArea", | 141 "Table", "TableCell", "TableRow", "TableSelection", "Text", "TextArea", |
| 142 "UIEvent", "Window", "XMLHttpRequest", "XMLSerializer", | 142 "UIEvent", "Window", "XMLHttpRequest", "XMLSerializer", |
| 143 "XPathException", "XPathResult", "XSLTProcessor", | 143 "XPathException", "XPathResult", "XSLTProcessor", |
| 144 | 144 |
| 145 // These keywords trigger the loading of the java-plugin. For the | 145 // These keywords trigger the loading of the java-plugin. For the |
| 146 // next-generation plugin, this results in starting a new Java process. | 146 // next-generation plugin, this results in starting a new Java process. |
| 147 "java", "Packages", "netscape", "sun", "JavaObject", "JavaClass", | 147 "java", "Packages", "netscape", "sun", "JavaObject", "JavaClass", |
| 148 "JavaArray", "JavaMember" | 148 "JavaArray", "JavaMember", |
| 149 |
| 150 // Global object for constants. |
| 151 "C", |
| 149 ]; | 152 ]; |
| 150 | 153 |
| 151 Set<String> _jsReserved = null; | 154 Set<String> _jsReserved = null; |
| 152 /// Names that cannot be used by members, top level and static | 155 /// Names that cannot be used by members, top level and static |
| 153 /// methods. | 156 /// methods. |
| 154 Set<String> get jsReserved { | 157 Set<String> get jsReserved { |
| 155 if (_jsReserved == null) { | 158 if (_jsReserved == null) { |
| 156 _jsReserved = new Set<String>(); | 159 _jsReserved = new Set<String>(); |
| 157 _jsReserved.addAll(javaScriptKeywords); | 160 _jsReserved.addAll(javaScriptKeywords); |
| 158 _jsReserved.addAll(reservedPropertySymbols); | 161 _jsReserved.addAll(reservedPropertySymbols); |
| (...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 } | 771 } |
| 769 | 772 |
| 770 String isolateLazyInitializerAccess(Element element) { | 773 String isolateLazyInitializerAccess(Element element) { |
| 771 return "$CURRENT_ISOLATE.${getLazyInitializerName(element)}"; | 774 return "$CURRENT_ISOLATE.${getLazyInitializerName(element)}"; |
| 772 } | 775 } |
| 773 | 776 |
| 774 String isolateStaticClosureAccess(Element element) { | 777 String isolateStaticClosureAccess(Element element) { |
| 775 return "$CURRENT_ISOLATE.${getStaticClosureName(element)}"; | 778 return "$CURRENT_ISOLATE.${getStaticClosureName(element)}"; |
| 776 } | 779 } |
| 777 | 780 |
| 781 String globalObjectForConstant(Constant constant) => 'C'; |
| 782 |
| 778 String operatorIsPrefix() => r'$is'; | 783 String operatorIsPrefix() => r'$is'; |
| 779 | 784 |
| 780 String operatorAsPrefix() => r'$as'; | 785 String operatorAsPrefix() => r'$as'; |
| 781 | 786 |
| 782 String operatorSignature() => r'$signature'; | 787 String operatorSignature() => r'$signature'; |
| 783 | 788 |
| 784 String functionTypeTag() => r'func'; | 789 String functionTypeTag() => r'func'; |
| 785 | 790 |
| 786 String functionTypeVoidReturnTag() => r'void'; | 791 String functionTypeVoidReturnTag() => r'void'; |
| 787 | 792 |
| (...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1262 if (!first) { | 1267 if (!first) { |
| 1263 sb.write('_'); | 1268 sb.write('_'); |
| 1264 } | 1269 } |
| 1265 sb.write('_'); | 1270 sb.write('_'); |
| 1266 visit(link.head); | 1271 visit(link.head); |
| 1267 first = true; | 1272 first = true; |
| 1268 } | 1273 } |
| 1269 } | 1274 } |
| 1270 } | 1275 } |
| 1271 } | 1276 } |
| OLD | NEW |