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

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

Issue 1111803005: fix #159, static renames for caller/arguments (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 7 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/names.js » ('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 'dart:collection'; 7 import 'dart:collection';
8 import 'package:dev_compiler/src/js/js_ast.dart'; 8 import 'package:dev_compiler/src/js/js_ast.dart';
9 9
10 /// Unique instance for temporary variables. Will be renamed consistently 10 /// Unique instance for temporary variables. Will be renamed consistently
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 case "with": 224 case "with":
225 case "yield": 225 case "yield":
226 return true; 226 return true;
227 case "arguments": 227 case "arguments":
228 case "eval": 228 case "eval":
229 return strictMode; 229 return strictMode;
230 } 230 }
231 return false; 231 return false;
232 } 232 }
233 233
234 /// Returns true for invalid static method names in strict mode. 234 /// Returns true for invalid static field names in strict mode.
235 /// In particular, "caller" "callee" and "arguments" cannot be used. 235 /// In particular, "caller" "callee" and "arguments" cannot be used.
236 bool invalidStaticMethodName(String name) { 236 bool invalidStaticFieldName(String name) {
237 switch (name) { 237 switch (name) {
238 case "arguments": 238 case "arguments":
239 case "caller": 239 case "caller":
240 case "callee": 240 case "callee":
241 return true; 241 return true;
242 } 242 }
243 return false; 243 return false;
244 } 244 }
OLDNEW
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | test/codegen/expect/names.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698