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

Side by Side Diff: pkg/compiler/lib/src/js_backend/namer.dart

Issue 929503004: dart2js: Don't emit fields that are named "eval" or "arguments". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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 | « no previous file | tests/compiler/dart2js/use_strict_test.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 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
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 }
OLDNEW
« no previous file with comments | « no previous file | tests/compiler/dart2js/use_strict_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698