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 // 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 engine.source; | 8 library engine.source; |
9 | 9 |
10 import "dart:math" as math; | 10 import "dart:math" as math; |
11 import 'dart:collection'; | 11 import 'dart:collection'; |
12 | 12 |
13 import 'package:analyzer/file_system/file_system.dart'; | 13 import 'package:analyzer/file_system/file_system.dart'; |
14 import 'package:analyzer/source/package_map_resolver.dart'; | 14 import 'package:analyzer/source/package_map_resolver.dart'; |
15 import 'package:analyzer/task/model.dart'; | 15 import 'package:analyzer/task/model.dart'; |
16 | 16 |
17 import 'engine.dart'; | 17 import 'engine.dart'; |
18 import 'java_core.dart'; | 18 import 'java_core.dart'; |
19 import 'java_engine.dart'; | 19 import 'java_engine.dart'; |
| 20 import 'java_io.dart' show JavaFile; |
20 import 'sdk.dart' show DartSdk; | 21 import 'sdk.dart' show DartSdk; |
| 22 import 'source_io.dart' show FileBasedSource; |
21 | 23 |
22 /** | 24 /** |
23 * A function that is used to handle [ContentCache] entries. | 25 * A function that is used to handle [ContentCache] entries. |
24 */ | 26 */ |
25 typedef void ContentCacheVisitor(Source source, int stamp, String contents); | 27 typedef void ContentCacheVisitor(Source source, int stamp, String contents); |
26 | 28 |
27 /** | 29 /** |
28 * Instances of class `ContentCache` hold content used to override the default c
ontent of a | 30 * Instances of class `ContentCache` hold content used to override the default c
ontent of a |
29 * [Source]. | 31 * [Source]. |
30 */ | 32 */ |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 | 160 |
159 /** | 161 /** |
160 * Return `true` if the given URI is a `dart:` URI. | 162 * Return `true` if the given URI is a `dart:` URI. |
161 * | 163 * |
162 * @param uri the URI being tested | 164 * @param uri the URI being tested |
163 * @return `true` if the given URI is a `dart:` URI | 165 * @return `true` if the given URI is a `dart:` URI |
164 */ | 166 */ |
165 static bool isDartUri(Uri uri) => DART_SCHEME == uri.scheme; | 167 static bool isDartUri(Uri uri) => DART_SCHEME == uri.scheme; |
166 } | 168 } |
167 | 169 |
| 170 class CustomUriResolver extends UriResolver { |
| 171 final Map<String, String> _urlMappings; |
| 172 |
| 173 CustomUriResolver(this._urlMappings); |
| 174 |
| 175 @override |
| 176 Source resolveAbsolute(Uri uri) { |
| 177 String mapping = _urlMappings[uri.toString()]; |
| 178 if (mapping == null) return null; |
| 179 |
| 180 Uri fileUri = new Uri.file(mapping); |
| 181 if (!fileUri.isAbsolute) return null; |
| 182 |
| 183 JavaFile javaFile = new JavaFile.fromUri(fileUri); |
| 184 return new FileBasedSource.con1(javaFile); |
| 185 } |
| 186 } |
| 187 |
168 /** | 188 /** |
169 * Instances of the class `LineInfo` encapsulate information about line and colu
mn information | 189 * Instances of the class `LineInfo` encapsulate information about line and colu
mn information |
170 * within a source file. | 190 * within a source file. |
171 */ | 191 */ |
172 class LineInfo { | 192 class LineInfo { |
173 /** | 193 /** |
174 * An array containing the offsets of the first character of each line in the
source code. | 194 * An array containing the offsets of the first character of each line in the
source code. |
175 */ | 195 */ |
176 final List<int> _lineStarts; | 196 final List<int> _lineStarts; |
177 | 197 |
(...skipping 805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
983 | 1003 |
984 /** | 1004 /** |
985 * Return an absolute URI that represents the given source, or `null` if a val
id URI cannot | 1005 * Return an absolute URI that represents the given source, or `null` if a val
id URI cannot |
986 * be computed. | 1006 * be computed. |
987 * | 1007 * |
988 * @param source the source to get URI for | 1008 * @param source the source to get URI for |
989 * @return the absolute URI representing the given source | 1009 * @return the absolute URI representing the given source |
990 */ | 1010 */ |
991 Uri restoreAbsolute(Source source) => null; | 1011 Uri restoreAbsolute(Source source) => null; |
992 } | 1012 } |
OLD | NEW |