| 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 { |
| 11 | 11 |
| 12 static const javaScriptKeywords = const <String>[ | 12 static const javaScriptKeywords = const <String>[ |
| 13 // These are current keywords. | 13 // These are current keywords. |
| 14 "break", "delete", "function", "return", "typeof", "case", "do", "if", | 14 "break", "delete", "function", "return", "typeof", "case", "do", "if", |
| 15 "switch", "var", "catch", "else", "in", "this", "void", "continue", | 15 "switch", "var", "catch", "else", "in", "this", "void", "continue", |
| 16 "false", "instanceof", "throw", "while", "debugger", "finally", "new", | 16 "false", "instanceof", "throw", "while", "debugger", "finally", "new", |
| 17 "true", "with", "default", "for", "null", "try", | 17 "true", "with", "default", "for", "null", "try", |
| 18 | 18 |
| 19 // These are future keywords. | 19 // These are future keywords. |
| 20 "abstract", "double", "goto", "native", "static", "boolean", "enum", | 20 "abstract", "double", "goto", "native", "static", "boolean", "enum", |
| 21 "implements", "package", "super", "byte", "export", "import", "private", | 21 "implements", "package", "super", "byte", "export", "import", "private", |
| 22 "synchronized", "char", "extends", "int", "protected", "throws", | 22 "synchronized", "char", "extends", "int", "protected", "throws", |
| 23 "class", "final", "interface", "public", "transient", "const", "float", | 23 "class", "final", "interface", "public", "transient", "const", "float", |
| 24 "long", "short", "volatile" | 24 "long", "short", "volatile" |
| 25 ]; | 25 ]; |
| 26 | 26 |
| 27 static const reservedPropertySymbols = | 27 static const reservedPropertySymbols = |
| 28 const <String>["__proto__", "prototype", "constructor", "call"]; | 28 const <String>[ |
| 29 "__proto__", "prototype", "constructor", "call", |
| 30 // "use strict" disallows the use of "arguments" and "eval" as |
| 31 // variable names or property names. See ECMA-262, Edition 5.1, |
| 32 // section 11.1.5 (for the property names). |
| 33 "eval", "arguments"]; |
| 29 | 34 |
| 30 // Symbols that we might be using in our JS snippets. | 35 // Symbols that we might be using in our JS snippets. |
| 31 static const reservedGlobalSymbols = const <String>[ | 36 static const reservedGlobalSymbols = const <String>[ |
| 32 // Section references are from Ecma-262 | 37 // Section references are from Ecma-262 |
| 33 // (http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pd
f) | 38 // (http://www.ecma-international.org/publications/files/ECMA-ST/Ecma-262.pd
f) |
| 34 | 39 |
| 35 // 15.1.1 Value Properties of the Global Object | 40 // 15.1.1 Value Properties of the Global Object |
| 36 "NaN", "Infinity", "undefined", | 41 "NaN", "Infinity", "undefined", |
| 37 | 42 |
| 38 // 15.1.2 Function Properties of the Global Object | 43 // 15.1.2 Function Properties of the Global Object |
| (...skipping 1388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1427 if (!first) { | 1432 if (!first) { |
| 1428 sb.write('_'); | 1433 sb.write('_'); |
| 1429 } | 1434 } |
| 1430 sb.write('_'); | 1435 sb.write('_'); |
| 1431 visit(parameter); | 1436 visit(parameter); |
| 1432 first = true; | 1437 first = true; |
| 1433 } | 1438 } |
| 1434 } | 1439 } |
| 1435 } | 1440 } |
| 1436 } | 1441 } |
| OLD | NEW |