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

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

Issue 1630963003: Use a symbol for static length/name (conflicts with Function properties in ES5: cannot redefine Fun… (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: left todo Created 4 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
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | test/codegen/closure.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) 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 import 'dart:collection'; 5 import 'dart:collection';
6 6
7 import '../js/js_ast.dart'; 7 import '../js/js_ast.dart';
8 import '../options.dart';
8 9
9 /// Unique instance for temporary variables. Will be renamed consistently 10 /// Unique instance for temporary variables. Will be renamed consistently
10 /// across the entire file. Different instances will be named differently 11 /// across the entire file. Different instances will be named differently
11 /// even if they have the same name, this makes it safe to use in code 12 /// even if they have the same name, this makes it safe to use in code
12 /// generation without needing global knowledge. See [JSNamer]. 13 /// generation without needing global knowledge. See [JSNamer].
13 /// 14 ///
14 // TODO(jmesserly): move into js_ast? add a boolean to Identifier? 15 // TODO(jmesserly): move into js_ast? add a boolean to Identifier?
15 class TemporaryId extends Identifier { 16 class TemporaryId extends Identifier {
16 TemporaryId(String name) : super(name); 17 TemporaryId(String name) : super(name);
17 } 18 }
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 case "private": 277 case "private":
277 case "protected": 278 case "protected":
278 case "public": 279 case "public":
279 case "static": 280 case "static":
280 case "yield": 281 case "yield":
281 return strictMode; 282 return strictMode;
282 } 283 }
283 return false; 284 return false;
284 } 285 }
285 286
286 /// Returns true for invalid static field names in strict mode. 287 /// Returns true for invalid static field names in strict mode or for some
288 /// transpilers (e.g. when doing ES6->ES5 lowering with the Closure Compiler).
287 /// In particular, "caller" "callee" and "arguments" cannot be used. 289 /// In particular, "caller" "callee" and "arguments" cannot be used.
288 bool invalidStaticFieldName(String name) { 290 bool invalidStaticFieldName(String name, CodegenOptions options) {
289 switch (name) { 291 switch (name) {
290 case "arguments": 292 case "arguments":
291 case "caller": 293 case "caller":
292 case "callee": 294 case "callee":
293 return true; 295 return true;
296 // Workarounds for Closure:
297 // (see https://github.com/google/closure-compiler/issues/1460)
298 case "name":
299 case "length":
300 return options.closure;
294 } 301 }
295 return false; 302 return false;
296 } 303 }
OLDNEW
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | test/codegen/closure.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698