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 library services.src.correction.source_range_factory; | 5 library services.src.correction.source_range_factory; |
6 | 6 |
| 7 import 'package:analyzer/dart/element/element.dart'; |
7 import 'package:analyzer/src/generated/ast.dart'; | 8 import 'package:analyzer/src/generated/ast.dart'; |
8 import 'package:analyzer/src/generated/element.dart'; | |
9 import 'package:analyzer/src/generated/error.dart'; | 9 import 'package:analyzer/src/generated/error.dart'; |
10 import 'package:analyzer/src/generated/scanner.dart'; | 10 import 'package:analyzer/src/generated/scanner.dart'; |
11 import 'package:analyzer/src/generated/source.dart'; | 11 import 'package:analyzer/src/generated/source.dart'; |
12 | 12 |
13 SourceRange rangeElementName(Element element) { | 13 SourceRange rangeElementName(Element element) { |
14 return new SourceRange(element.nameOffset, element.nameLength); | 14 return new SourceRange(element.nameOffset, element.nameLength); |
15 } | 15 } |
16 | 16 |
17 SourceRange rangeEndEnd(a, b) { | 17 SourceRange rangeEndEnd(a, b) { |
18 int offset = a.end; | 18 int offset = a.end; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 SourceRange rangeStartStart(a, b) { | 78 SourceRange rangeStartStart(a, b) { |
79 int offset = a is int ? a : a.offset; | 79 int offset = a is int ? a : a.offset; |
80 var length = (b is int ? b : b.offset) - offset; | 80 var length = (b is int ? b : b.offset) - offset; |
81 return new SourceRange(offset, length); | 81 return new SourceRange(offset, length); |
82 } | 82 } |
83 | 83 |
84 SourceRange rangeToken(Token token) { | 84 SourceRange rangeToken(Token token) { |
85 return new SourceRange(token.offset, token.length); | 85 return new SourceRange(token.offset, token.length); |
86 } | 86 } |
OLD | NEW |