OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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:io'; | 5 import 'dart:io'; |
6 import 'dart:convert'; | 6 import 'dart:convert'; |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:path/path.dart' as path; | 9 import 'package:path/path.dart' as path; |
10 import 'package:expect/expect.dart'; | 10 import 'package:expect/expect.dart'; |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 if (interval != null && | 167 if (interval != null && |
168 interval.contains(sourcePosition) && | 168 interval.contains(sourcePosition) && |
169 isInsideElement(localFunction)) { | 169 isInsideElement(localFunction)) { |
170 element = localFunction; | 170 element = localFunction; |
171 } | 171 } |
172 }); | 172 }); |
173 } | 173 } |
174 return element; | 174 return element; |
175 } | 175 } |
176 | 176 |
177 void match(AstElement element) { | 177 void match(Element _element) { |
| 178 AstElement element = _element; |
178 Interval interval = intervalFromElement(element); | 179 Interval interval = intervalFromElement(element); |
179 if (interval != null && interval.contains(sourcePosition)) { | 180 if (interval != null && interval.contains(sourcePosition)) { |
180 AstElement innerElement = findInnermost(element); | 181 AstElement innerElement = findInnermost(element); |
181 String expectedName = computeElementNameForSourceMaps(innerElement); | 182 String expectedName = computeElementNameForSourceMaps(innerElement); |
182 if (name != expectedName) { | 183 if (name != expectedName) { |
183 // For the code | 184 // For the code |
184 // (){}(); | 185 // (){}(); |
185 // ^ | 186 // ^ |
186 // the indicated position is within the scope of the local | 187 // the indicated position is within the scope of the local |
187 // function but it is also the position for the invocation of it. | 188 // function but it is also the position for the invocation of it. |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 final Position end; | 318 final Position end; |
318 | 319 |
319 Interval(this.begin, this.end); | 320 Interval(this.begin, this.end); |
320 | 321 |
321 bool contains(Position other) { | 322 bool contains(Position other) { |
322 return begin <= other && other <= end; | 323 return begin <= other && other <= end; |
323 } | 324 } |
324 | 325 |
325 String toString() => '$begin-$end'; | 326 String toString() => '$begin-$end'; |
326 } | 327 } |
OLD | NEW |