| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/file_system/file_system.dart'; | 8 import 'package:analyzer/file_system/file_system.dart'; |
| 9 import 'package:analyzer/src/context/context.dart'; | 9 import 'package:analyzer/src/context/context.dart'; |
| 10 import 'package:analyzer/src/dart/analysis/byte_store.dart'; | 10 import 'package:analyzer/src/dart/analysis/byte_store.dart'; |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 AnalysisContext context; | 261 AnalysisContext context; |
| 262 | 262 |
| 263 _SourceFactoryProxy(this.dartSdk, this._fileRepository); | 263 _SourceFactoryProxy(this.dartSdk, this._fileRepository); |
| 264 | 264 |
| 265 @override | 265 @override |
| 266 SourceFactory clone() => new _SourceFactoryProxy(dartSdk, _fileRepository); | 266 SourceFactory clone() => new _SourceFactoryProxy(dartSdk, _fileRepository); |
| 267 | 267 |
| 268 @override | 268 @override |
| 269 Source forUri(String absoluteUri) { | 269 Source forUri(String absoluteUri) { |
| 270 Uri uri = Uri.parse(absoluteUri); | 270 Uri uri = Uri.parse(absoluteUri); |
| 271 if (uri.scheme == 'dart') { | 271 return new _SourceProxy( |
| 272 return new _SourceProxy( | 272 uri, _fileRepository.pathForUri(uri, allocate: true)); |
| 273 uri, _fileRepository.pathForUri(uri, allocate: true)); | |
| 274 } | |
| 275 return new _SourceProxy(uri, _fileRepository.pathForUri(uri)); | |
| 276 } | 273 } |
| 277 | 274 |
| 278 noSuchMethod(Invocation invocation) => unimplemented(); | 275 noSuchMethod(Invocation invocation) => unimplemented(); |
| 279 | 276 |
| 280 Source resolveUri(Source containingSource, String containedUri) { | 277 Source resolveUri(Source containingSource, String containedUri) { |
| 281 // TODO(paulberry): re-use code from dependency_grapher_impl, and support | 278 // TODO(paulberry): re-use code from dependency_grapher_impl, and support |
| 282 // SDK URI resolution logic. | 279 // SDK URI resolution logic. |
| 283 String absoluteUri = | 280 String absoluteUri = |
| 284 resolveRelativeUri(containingSource?.uri, Uri.parse(containedUri)) | 281 resolveRelativeUri(containingSource?.uri, Uri.parse(containedUri)) |
| 285 .toString(); | 282 .toString(); |
| 286 return forUri(absoluteUri); | 283 return forUri(absoluteUri); |
| 287 } | 284 } |
| 288 | 285 |
| 289 @override | 286 @override |
| 290 Uri restoreUri(Source source) => source.uri; | 287 Uri restoreUri(Source source) => source.uri; |
| 291 } | 288 } |
| 292 | 289 |
| 293 class _SourceProxy extends BasicSource { | 290 class _SourceProxy extends BasicSource { |
| 294 @override | 291 @override |
| 295 final String fullName; | 292 final String fullName; |
| 296 | 293 |
| 297 _SourceProxy(Uri uri, this.fullName) : super(uri); | 294 _SourceProxy(Uri uri, this.fullName) : super(uri); |
| 298 | 295 |
| 299 int get modificationStamp => 0; | 296 int get modificationStamp => 0; |
| 300 | 297 |
| 301 noSuchMethod(Invocation invocation) => unimplemented(); | 298 noSuchMethod(Invocation invocation) => unimplemented(); |
| 302 } | 299 } |
| OLD | NEW |