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

Side by Side 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 unified diff | 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 »
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 'package:dev_compiler/src/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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 /// In particular, "caller" "callee" and "arguments" cannot be used. 288 /// In particular, "caller" "callee" and "arguments" cannot be used.
288 bool invalidStaticFieldName(String name) { 289 bool invalidStaticFieldName(String name) {
289 switch (name) { 290 switch (name) {
290 case "arguments": 291 case "arguments":
291 case "caller": 292 case "caller":
292 case "callee": 293 case "callee":
293 return true; 294 return true;
294 } 295 }
295 return false; 296 return false;
296 } 297 }
298
299 /// We cannot destructure named params that clash with JS reserved names:
300 /// see discussion in https://github.com/dart-lang/dev_compiler/issues/392.
301 bool canDestructureNamedParams(Iterable<String> names, CodegenOptions options) {
302 return options.destructureNamedParams && !names.any(invalidVariableName);
303 }
OLDNEW
« 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