Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(140)

Side by Side Diff: pkg/analysis_services/lib/src/correction/source_range.dart

Issue 427473003: Uncomment and test fixes for importing libraries. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library services.src.correction.source_range_factory; 8 library services.src.correction.source_range_factory;
9 9
10 import 'package:analyzer/src/generated/ast.dart'; 10 import 'package:analyzer/src/generated/ast.dart';
(...skipping 29 matching lines...) Expand all
40 40
41 SourceRange rangeNodes(List<AstNode> nodes) { 41 SourceRange rangeNodes(List<AstNode> nodes) {
42 if (nodes.isEmpty) { 42 if (nodes.isEmpty) {
43 return new SourceRange(0, 0); 43 return new SourceRange(0, 0);
44 } 44 }
45 AstNode first = nodes.first; 45 AstNode first = nodes.first;
46 AstNode last = nodes.last; 46 AstNode last = nodes.last;
47 return rangeStartEnd(first, last); 47 return rangeStartEnd(first, last);
48 } 48 }
49 49
50 SourceRange rangeOffsetEnd(o) {
51 int offset = o.offset;
52 int length = o.end - offset;
53 return new SourceRange(offset, length);
54 }
55
50 SourceRange rangeStartEnd(a, b) { 56 SourceRange rangeStartEnd(a, b) {
51 int offset = a is int ? a : a.offset; 57 int offset = a is int ? a : a.offset;
52 int end = b is int ? b : b.end; 58 int end = b is int ? b : b.end;
53 var length = end - offset; 59 var length = end - offset;
54 return new SourceRange(offset, length); 60 return new SourceRange(offset, length);
55 } 61 }
56 62
57 SourceRange rangeStartLength(a, int length) { 63 SourceRange rangeStartLength(a, int length) {
58 int offset = a is int ? a : a.offset; 64 int offset = a is int ? a : a.offset;
59 return new SourceRange(offset, length); 65 return new SourceRange(offset, length);
60 } 66 }
61 67
62 SourceRange rangeStartStart(a, b) { 68 SourceRange rangeStartStart(a, b) {
63 int offset = a is int ? a : a.offset; 69 int offset = a is int ? a : a.offset;
64 var length = (b is int ? b : b.offset) - offset; 70 var length = (b is int ? b : b.offset) - offset;
65 return new SourceRange(offset, length); 71 return new SourceRange(offset, length);
66 } 72 }
67 73
68 SourceRange rangeToken(Token token) { 74 SourceRange rangeToken(Token token) {
69 return new SourceRange(token.offset, token.length); 75 return new SourceRange(token.offset, token.length);
70 } 76 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698