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

Unified 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: Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: lib/src/codegen/js_names.dart
diff --git a/lib/src/codegen/js_names.dart b/lib/src/codegen/js_names.dart
index c84991f6be1f40d124e284be69edac8ded985dc3..b8be9d5c3607e88ba121c96faf95d5463b10184a 100644
--- a/lib/src/codegen/js_names.dart
+++ b/lib/src/codegen/js_names.dart
@@ -287,12 +287,20 @@ bool invalidVariableName(String keyword, {bool strictMode: true}) {
/// Returns true for invalid static field names in strict mode.
/// In particular, "caller" "callee" and "arguments" cannot be used.
-bool invalidStaticFieldName(String name) {
+///
+/// [closureCompiler] marks some names as invalid for the purpose of ES6->ES5
+/// lowering with the Closure Compiler.
+bool invalidStaticFieldName(String name, {bool closureCompiler: false}) {
switch (name) {
case "arguments":
case "caller":
case "callee":
return true;
+ // Workarounds for Closure:
+ // (see https://github.com/google/closure-compiler/issues/1460)
+ case "name":
+ case "length":
+ return closureCompiler;
}
return false;
}

Powered by Google App Engine
This is Rietveld 408576698