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

Side by Side Diff: pkg/analysis_services/lib/src/generated/stubs.dart

Issue 250823006: Translate parts of engine.services project. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Move to pkg/analysis_services/ Created 6 years, 8 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
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.
7
8 library service.correction.stubs;
9
10 import 'package:analyzer/src/generated/ast.dart' show AstNode;
11 import 'package:analyzer/src/generated/element.dart';
12 import 'package:analyzer/src/generated/scanner.dart';
13 import 'package:analyzer/src/generated/source.dart';
14
15 class SearchMatch {
16 final Element element = null;
17 final SourceRange sourceRange = null;
18 }
19
20
21 class SearchEngine {
22 }
23
24
25 class SourceRangeFactory {
26 static SourceRange rangeElementName(Element element) {
27 return new SourceRange(element.nameOffset, element.name.length);
28 }
29
30 static SourceRange rangeEndEnd(a, b) {
31 int offset = a.end;
32 var length = b.end - offset;
33 return new SourceRange(offset, length);
34 }
35
36 static SourceRange rangeEndLength(a, int length) {
37 return new SourceRange(a.nameOffset, length);
38 }
39
40 static SourceRange rangeEndStart(a, b) {
41 int offset = a.end;
42 var length = b.offset - offset;
43 return new SourceRange(offset, length);
44 }
45
46 static SourceRange rangeNode(AstNode node) {
47 return new SourceRange(node.offset, node.length);
48 }
49
50 static SourceRange rangeNodes(List<AstNode> nodes) {
51 if (nodes.isEmpty) {
52 return new SourceRange(0, 0);
53 }
54 AstNode first = nodes.first;
55 AstNode last = nodes.last;
56 return rangeStartEnd(first, last);
57 }
58
59 static SourceRange rangeStartEnd(a, b) {
60 int offset = a.offset;
61 var length = b.end - offset;
62 return new SourceRange(offset, length);
63 }
64
65 static SourceRange rangeStartLength(a, int length) {
66 int offset = a.offset;
67 return new SourceRange(offset, length);
68 }
69
70 static SourceRange rangeStartStart(a, b) {
71 int offset = a.offset;
72 var length = b.offset - offset;
73 return new SourceRange(offset, length);
74 }
75
76 static SourceRange rangeToken(Token node) {
77 return new SourceRange(node.offset, node.length);
78 }
79 }
80
81
82 class StringUtils {
83 static String capitalize(String str) {
84 if (isEmpty(str)) {
85 return str;
86 }
87 return str.substring(0, 1).toUpperCase() + str.substring(1);
88 }
89
90 static bool equals(String cs1, String cs2) {
91 if (cs1 == cs2) {
92 return true;
93 }
94 if (cs1 == null || cs2 == null) {
95 return false;
96 }
97 return cs1 == cs2;
98 }
99
100 static bool isEmpty(String str) {
101 return str == null || str.isEmpty;
102 }
103
104 static String join(Iterable iter, [String separator = ' ', int start = 0, int
105 end = -1]) {
106 if (start != 0) {
107 iter = iter.skip(start);
108 }
109 if (end != -1) {
110 iter = iter.take(end - start);
111 }
112 return iter.join(separator);
113 }
114
115 static String remove(String str, String remove) {
116 if (isEmpty(str) || isEmpty(remove)) {
117 return str;
118 }
119 return str.replaceAll(remove, '');
120 }
121
122 static String removeStart(String str, String remove) {
123 if (isEmpty(str) || isEmpty(remove)) {
124 return str;
125 }
126 if (str.startsWith(remove)) {
127 return str.substring(remove.length);
128 }
129 return str;
130 }
131
132 static String repeat(String s, int n) {
133 StringBuffer sb = new StringBuffer();
134 for (int i = 0; i < n; i++) {
135 sb.write(s);
136 }
137 return sb.toString();
138 }
139
140 static List<String> split(String s, [String pattern = '']) {
141 return s.split(pattern);
142 }
143
144 static List<String> splitByWholeSeparatorPreserveAllTokens(String s, String
145 pattern) {
146 return s.split(pattern);
147 }
148 }
OLDNEW
« no previous file with comments | « pkg/analysis_services/lib/src/generated/status.dart ('k') | pkg/analysis_services/lib/src/generated/util.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698