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

Side by Side Diff: lib/src/codegen/js_names.dart

Issue 1048873002: fix arguments keyword used in our helper method (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 8 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
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | test/codegen/expect/server_mode/html_input.html » ('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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 library dev_compiler.src.codegen.js_names; 5 library dev_compiler.src.codegen.js_names;
6 6
7 import 'package:dev_compiler/src/js/js_ast.dart'; 7 import 'package:dev_compiler/src/js/js_ast.dart';
8 8
9 /// Marker subclass for temporary variables. 9 /// Marker subclass for temporary variables.
10 /// We treat these as being in a different scope from other identifiers, and 10 /// We treat these as being in a different scope from other identifiers, and
(...skipping 22 matching lines...) Expand all
33 final renames = new Map<String, String>(); 33 final renames = new Map<String, String>();
34 34
35 JSNamer(Node node) { 35 JSNamer(Node node) {
36 node.accept(new _NameCollector(usedNames)); 36 node.accept(new _NameCollector(usedNames));
37 } 37 }
38 38
39 String getName(Identifier node) { 39 String getName(Identifier node) {
40 var name = node.name; 40 var name = node.name;
41 if (node is JSTemporary) { 41 if (node is JSTemporary) {
42 return _rename(name, valid: true); 42 return _rename(name, valid: true);
43 } else if (invalidJSVariableName(name)) { 43 } else if (node.allowRename && invalidJSVariableName(name)) {
44 return _rename(name, valid: false); 44 return _rename(name, valid: false);
45 } 45 }
46 return name; 46 return name;
47 } 47 }
48 48
49 String _rename(String name, {bool valid}) { 49 String _rename(String name, {bool valid}) {
50 var candidate = renames[name]; 50 var candidate = renames[name];
51 if (candidate != null) return candidate; 51 if (candidate != null) return candidate;
52 52
53 // Try to use the temp's name, otherwise rename. 53 // Try to use the temp's name, otherwise rename.
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 /// In particular, "caller" "callee" and "arguments" cannot be used. 130 /// In particular, "caller" "callee" and "arguments" cannot be used.
131 bool invalidJSStaticMethodName(String name) { 131 bool invalidJSStaticMethodName(String name) {
132 switch (name) { 132 switch (name) {
133 case "arguments": 133 case "arguments":
134 case "caller": 134 case "caller":
135 case "callee": 135 case "callee":
136 return true; 136 return true;
137 } 137 }
138 return false; 138 return false;
139 } 139 }
OLDNEW
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | test/codegen/expect/server_mode/html_input.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698