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 code_transformers.src.dart_sdk; | 5 library code_transformers.src.dart_sdk; |
6 | 6 |
7 import 'dart:convert' as convert; | 7 import 'dart:convert' as convert; |
8 import 'dart:io' show File, Platform, Process; | 8 import 'dart:io' show File, Platform, Process; |
9 import 'package:path/path.dart' as path; | 9 import 'package:path/path.dart' as path; |
10 import 'package:analyzer/src/generated/engine.dart'; | 10 import 'package:analyzer/src/generated/engine.dart'; |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 if (source == null || source is DartSourceProxy) return source; | 107 if (source == null || source is DartSourceProxy) return source; |
108 return new DartSourceProxy(source, uri); | 108 return new DartSourceProxy(source, uri); |
109 } | 109 } |
110 | 110 |
111 Source resolveRelative(Uri relativeUri) { | 111 Source resolveRelative(Uri relativeUri) { |
112 // Assume that the type can be accessed via this URI, since these | 112 // Assume that the type can be accessed via this URI, since these |
113 // should only be parts for dart core files. | 113 // should only be parts for dart core files. |
114 return wrap(_proxy.resolveRelative(relativeUri), uri); | 114 return wrap(_proxy.resolveRelative(relativeUri), uri); |
115 } | 115 } |
116 | 116 |
| 117 Uri resolveRelativeUri(Uri relativeUri) { |
| 118 return _proxy.resolveRelativeUri(relativeUri); |
| 119 } |
| 120 |
117 bool exists() => _proxy.exists(); | 121 bool exists() => _proxy.exists(); |
118 | 122 |
119 bool operator ==(Object other) => | 123 bool operator ==(Object other) => |
120 (other is DartSourceProxy && _proxy == other._proxy); | 124 (other is DartSourceProxy && _proxy == other._proxy); |
121 | 125 |
122 int get hashCode => _proxy.hashCode; | 126 int get hashCode => _proxy.hashCode; |
123 | 127 |
124 TimestampedData<String> get contents => _proxy.contents; | 128 TimestampedData<String> get contents => _proxy.contents; |
125 | 129 |
126 String get encoding => _proxy.encoding; | 130 String get encoding => _proxy.encoding; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 178 |
175 Source _getSource(Uri uri) { | 179 Source _getSource(Uri uri) { |
176 var src = _sources[uri]; | 180 var src = _sources[uri]; |
177 if (src == null) { | 181 if (src == null) { |
178 if (reportMissing) print('warning: missing mock for $uri.'); | 182 if (reportMissing) print('warning: missing mock for $uri.'); |
179 _sources[uri] = src = | 183 _sources[uri] = src = |
180 new _MockSdkSource(uri, 'library dart.${uri.path};'); | 184 new _MockSdkSource(uri, 'library dart.${uri.path};'); |
181 } | 185 } |
182 return src; | 186 return src; |
183 } | 187 } |
| 188 |
| 189 @override |
| 190 Source fromFileUri(Uri uri) { |
| 191 throw new UnsupportedError('MockDartSdk.fromFileUri'); |
| 192 } |
184 } | 193 } |
185 | 194 |
186 class _MockSdkSource implements UriAnnotatedSource { | 195 class _MockSdkSource implements UriAnnotatedSource { |
187 /// Absolute URI which this source can be imported from. | 196 /// Absolute URI which this source can be imported from. |
188 final Uri uri; | 197 final Uri uri; |
189 final String _contents; | 198 final String _contents; |
190 | 199 |
191 _MockSdkSource(this.uri, this._contents); | 200 _MockSdkSource(this.uri, this._contents); |
192 | 201 |
193 bool exists() => true; | 202 bool exists() => true; |
(...skipping 10 matching lines...) Expand all Loading... |
204 String get fullName => shortName; | 213 String get fullName => shortName; |
205 | 214 |
206 String get shortName => uri.path; | 215 String get shortName => uri.path; |
207 | 216 |
208 UriKind get uriKind => UriKind.DART_URI; | 217 UriKind get uriKind => UriKind.DART_URI; |
209 | 218 |
210 bool get isInSystemLibrary => true; | 219 bool get isInSystemLibrary => true; |
211 | 220 |
212 Source resolveRelative(Uri relativeUri) => | 221 Source resolveRelative(Uri relativeUri) => |
213 throw new UnsupportedError('not expecting relative urls in dart: mocks'); | 222 throw new UnsupportedError('not expecting relative urls in dart: mocks'); |
| 223 |
| 224 Uri resolveRelativeUri(Uri relativeUri) => |
| 225 throw new UnsupportedError('not expecting relative urls in dart: mocks'); |
214 } | 226 } |
OLD | NEW |