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

Unified Diff: lib/src/codegen/js_names.dart

Issue 1676463002: Type annotations instead of closure comments. (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: merged master 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | lib/src/codegen/js_printer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/codegen/js_names.dart
diff --git a/lib/src/codegen/js_names.dart b/lib/src/codegen/js_names.dart
index 307e52e0b29df5e052720c615ab12cfd994244d5..867d85b0e89bd769a0e6b8348ba11a175f6258fa 100644
--- a/lib/src/codegen/js_names.dart
+++ b/lib/src/codegen/js_names.dart
@@ -5,6 +5,7 @@
import 'dart:collection';
import '../js/js_ast.dart';
+import 'package:dev_compiler/src/options.dart';
/// Unique instance for temporary variables. Will be renamed consistently
/// across the entire file. Different instances will be named differently
@@ -294,3 +295,9 @@ bool invalidStaticFieldName(String name) {
}
return false;
}
+
+/// We cannot destructure named params that clash with JS reserved names:
+/// see discussion in https://github.com/dart-lang/dev_compiler/issues/392.
+bool canDestructureNamedParams(Iterable<String> names, CodegenOptions options) {
+ return options.destructureNamedParams && !names.any(invalidVariableName);
+}
« no previous file with comments | « lib/src/codegen/js_codegen.dart ('k') | lib/src/codegen/js_printer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698