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 import 'dart:collection' show HashSet, HashMap, SplayTreeSet; | 5 import 'dart:collection' show HashSet, HashMap, SplayTreeSet; |
6 | 6 |
7 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; | 7 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; |
8 import 'package:analyzer/dart/ast/token.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
9 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator; | 9 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator; |
10 import 'package:analyzer/src/generated/constant.dart'; | 10 import 'package:analyzer/src/generated/constant.dart'; |
(...skipping 2036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2047 } | 2047 } |
2048 | 2048 |
2049 target = _getTarget(lhs); | 2049 target = _getTarget(lhs); |
2050 id = lhs.propertyName; | 2050 id = lhs.propertyName; |
2051 } else if (lhs is PrefixedIdentifier) { | 2051 } else if (lhs is PrefixedIdentifier) { |
2052 target = lhs.prefix; | 2052 target = lhs.prefix; |
2053 id = lhs.identifier; | 2053 id = lhs.identifier; |
2054 } | 2054 } |
2055 | 2055 |
2056 if (target != null && DynamicInvoke.get(target)) { | 2056 if (target != null && DynamicInvoke.get(target)) { |
2057 return js.call('dart.$DPUT(#, #, #)', [ | 2057 return js.call('dart.$DPUT(#, #, #)', |
2058 _visit(target), | 2058 [_visit(target), _emitMemberName(id.name), _visit(rhs)]); |
2059 _emitMemberName(id.name, type: getStaticType(target)), | |
2060 _visit(rhs) | |
2061 ]); | |
2062 } | 2059 } |
2063 | 2060 |
2064 return _visit(rhs).toAssignExpression(_visit(lhs)); | 2061 return _visit(rhs).toAssignExpression(_visit(lhs)); |
2065 } | 2062 } |
2066 | 2063 |
2067 JS.Expression _emitNullSafeSet(PropertyAccess node, Expression right) { | 2064 JS.Expression _emitNullSafeSet(PropertyAccess node, Expression right) { |
2068 // Emit `obj?.prop = expr` as: | 2065 // Emit `obj?.prop = expr` as: |
2069 // | 2066 // |
2070 // (_ => _ == null ? null : _.prop = expr)(obj). | 2067 // (_ => _ == null ? null : _.prop = expr)(obj). |
2071 // | 2068 // |
(...skipping 1742 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3814 | 3811 |
3815 /// A special kind of element created by the compiler, signifying a temporary | 3812 /// A special kind of element created by the compiler, signifying a temporary |
3816 /// variable. These objects use instance equality, and should be shared | 3813 /// variable. These objects use instance equality, and should be shared |
3817 /// everywhere in the tree where they are treated as the same variable. | 3814 /// everywhere in the tree where they are treated as the same variable. |
3818 class TemporaryVariableElement extends LocalVariableElementImpl { | 3815 class TemporaryVariableElement extends LocalVariableElementImpl { |
3819 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name); | 3816 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name); |
3820 | 3817 |
3821 int get hashCode => identityHashCode(this); | 3818 int get hashCode => identityHashCode(this); |
3822 bool operator ==(Object other) => identical(this, other); | 3819 bool operator ==(Object other) => identical(this, other); |
3823 } | 3820 } |
OLD | NEW |