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 'package:analyzer/dart/ast/token.dart'; |
5 import 'package:analyzer/src/generated/ast.dart'; | 6 import 'package:analyzer/src/generated/ast.dart'; |
6 import 'package:analyzer/src/generated/element.dart'; | 7 import 'package:analyzer/src/generated/element.dart'; |
7 import 'package:analyzer/src/generated/scanner.dart'; | |
8 | 8 |
9 import 'ast_builder.dart'; | 9 import 'ast_builder.dart'; |
10 | 10 |
11 /// Creates an index of variable assignments and declarations occurring in all | 11 /// Creates an index of variable assignments and declarations occurring in all |
12 /// the provided [nodes]. | 12 /// the provided [nodes]. |
13 /// | 13 /// |
14 /// Expands any compound assignment expression (e.g. `i += 2` yields an assigned | 14 /// Expands any compound assignment expression (e.g. `i += 2` yields an assigned |
15 /// expression of `i + 2`), and treats declarations with no assignment as having | 15 /// expression of `i + 2`), and treats declarations with no assignment as having |
16 /// a `null` assigned expression. | 16 /// a `null` assigned expression. |
17 Map<LocalVariableElement, List<Expression>> indexLocalAssignments( | 17 Map<LocalVariableElement, List<Expression>> indexLocalAssignments( |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 | 136 |
137 Token _opToken(TokenType t) => new Token(t, 0); | 137 Token _opToken(TokenType t) => new Token(t, 0); |
138 | 138 |
139 /// Transforms `+=` to `+`, `??=` to `??`, etc. | 139 /// Transforms `+=` to `+`, `??=` to `??`, etc. |
140 TokenType _expandAssignmentOp(TokenType assignmentOp) { | 140 TokenType _expandAssignmentOp(TokenType assignmentOp) { |
141 assert(assignmentOp.isAssignmentOperator); | 141 assert(assignmentOp.isAssignmentOperator); |
142 var op = _opByAssignmentOp[assignmentOp]; | 142 var op = _opByAssignmentOp[assignmentOp]; |
143 if (op == null) throw new ArgumentError("Can't expand op $assignmentOp"); | 143 if (op == null) throw new ArgumentError("Can't expand op $assignmentOp"); |
144 return op; | 144 return op; |
145 } | 145 } |
OLD | NEW |