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 testing.mock_sdk; | 5 library testing.mock_sdk; |
6 | 6 |
7 import 'package:analyzer/file_system/file_system.dart' as resource; | 7 import 'package:analyzer/file_system/file_system.dart' as resource; |
8 import 'package:analyzer/file_system/memory_file_system.dart' as resource; | 8 import 'package:analyzer/file_system/memory_file_system.dart' as resource; |
9 import 'package:analyzer/src/context/context.dart'; | 9 import 'package:analyzer/src/context/context.dart'; |
10 import 'package:analyzer/src/generated/engine.dart'; | 10 import 'package:analyzer/src/generated/engine.dart'; |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 try { | 262 try { |
263 resource.File file = provider.getResource(uri.path); | 263 resource.File file = provider.getResource(uri.path); |
264 Uri dartUri = Uri.parse(library.shortName); | 264 Uri dartUri = Uri.parse(library.shortName); |
265 return file.createSource(dartUri); | 265 return file.createSource(dartUri); |
266 } catch (exception) { | 266 } catch (exception) { |
267 return null; | 267 return null; |
268 } | 268 } |
269 } | 269 } |
270 if (filePath.startsWith("$libraryPath/")) { | 270 if (filePath.startsWith("$libraryPath/")) { |
271 String pathInLibrary = filePath.substring(libraryPath.length + 1); | 271 String pathInLibrary = filePath.substring(libraryPath.length + 1); |
272 String path = '${library.shortName}/${pathInLibrary}'; | 272 String path = '${library.shortName}/$pathInLibrary'; |
273 try { | 273 try { |
274 resource.File file = provider.getResource(uri.path); | 274 resource.File file = provider.getResource(uri.path); |
275 Uri dartUri = new Uri(scheme: 'dart', path: path); | 275 Uri dartUri = new Uri(scheme: 'dart', path: path); |
276 return file.createSource(dartUri); | 276 return file.createSource(dartUri); |
277 } catch (exception) { | 277 } catch (exception) { |
278 return null; | 278 return null; |
279 } | 279 } |
280 } | 280 } |
281 } | 281 } |
282 return null; | 282 return null; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 bool get isInternal => shortName.startsWith('dart:_'); | 338 bool get isInternal => shortName.startsWith('dart:_'); |
339 | 339 |
340 @override | 340 @override |
341 bool get isShared => throw unimplemented; | 341 bool get isShared => throw unimplemented; |
342 | 342 |
343 @override | 343 @override |
344 bool get isVmLibrary => throw unimplemented; | 344 bool get isVmLibrary => throw unimplemented; |
345 | 345 |
346 UnimplementedError get unimplemented => new UnimplementedError(); | 346 UnimplementedError get unimplemented => new UnimplementedError(); |
347 } | 347 } |
OLD | NEW |