| OLD | NEW |
| 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_codegen; | 5 library dev_compiler.src.codegen.js_codegen; |
| 6 | 6 |
| 7 import 'dart:collection' show HashSet, HashMap, SplayTreeSet; | 7 import 'dart:collection' show HashSet, HashMap, SplayTreeSet; |
| 8 | 8 |
| 9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; | 9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; |
| 10 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator; | 10 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator; |
| (...skipping 1972 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1983 return new JS.Property( | 1983 return new JS.Property( |
| 1984 _propertyName(node.name.label.name), _visit(node.expression)); | 1984 _propertyName(node.name.label.name), _visit(node.expression)); |
| 1985 } | 1985 } |
| 1986 | 1986 |
| 1987 bool _isNamedParam(FormalParameter param) => | 1987 bool _isNamedParam(FormalParameter param) => |
| 1988 param.kind == ParameterKind.NAMED; | 1988 param.kind == ParameterKind.NAMED; |
| 1989 | 1989 |
| 1990 /// We cannot destructure named params that clash with JS reserved names: | 1990 /// We cannot destructure named params that clash with JS reserved names: |
| 1991 /// see discussion in https://github.com/dart-lang/dev_compiler/issues/392. | 1991 /// see discussion in https://github.com/dart-lang/dev_compiler/issues/392. |
| 1992 bool _isDestructurableNamedParam(FormalParameter param) => | 1992 bool _isDestructurableNamedParam(FormalParameter param) => |
| 1993 _isNamedParam(param) && !invalidVariableName(param.identifier.name) && | 1993 _isNamedParam(param) && |
| 1994 options.destructureNamedParams; | 1994 !invalidVariableName(param.identifier.name) && |
| 1995 options.destructureNamedParams; |
| 1995 | 1996 |
| 1996 @override | 1997 @override |
| 1997 List<JS.Parameter> visitFormalParameterList(FormalParameterList node) => | 1998 List<JS.Parameter> visitFormalParameterList(FormalParameterList node) => |
| 1998 _emitFormalParameterList(node); | 1999 _emitFormalParameterList(node); |
| 1999 | 2000 |
| 2000 List<JS.Parameter> _emitFormalParameterList(FormalParameterList node, | 2001 List<JS.Parameter> _emitFormalParameterList(FormalParameterList node, |
| 2001 {bool allowDestructuring: true}) { | 2002 {bool allowDestructuring: true}) { |
| 2002 var result = <JS.Parameter>[]; | 2003 var result = <JS.Parameter>[]; |
| 2003 | 2004 |
| 2004 var namedVars = <JS.DestructuredVariable>[]; | 2005 var namedVars = <JS.DestructuredVariable>[]; |
| (...skipping 1495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3500 | 3501 |
| 3501 /// A special kind of element created by the compiler, signifying a temporary | 3502 /// A special kind of element created by the compiler, signifying a temporary |
| 3502 /// variable. These objects use instance equality, and should be shared | 3503 /// variable. These objects use instance equality, and should be shared |
| 3503 /// everywhere in the tree where they are treated as the same variable. | 3504 /// everywhere in the tree where they are treated as the same variable. |
| 3504 class TemporaryVariableElement extends LocalVariableElementImpl { | 3505 class TemporaryVariableElement extends LocalVariableElementImpl { |
| 3505 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name); | 3506 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name); |
| 3506 | 3507 |
| 3507 int get hashCode => identityHashCode(this); | 3508 int get hashCode => identityHashCode(this); |
| 3508 bool operator ==(Object other) => identical(this, other); | 3509 bool operator ==(Object other) => identical(this, other); |
| 3509 } | 3510 } |
| OLD | NEW |