| 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'; |
| 11 import 'package:analyzer/src/dart/analysis/driver.dart' as driver; | 11 import 'package:analyzer/src/dart/analysis/driver.dart' as driver; |
| 12 import 'package:analyzer/src/dart/analysis/file_state.dart'; | 12 import 'package:analyzer/src/dart/analysis/file_state.dart'; |
| 13 import 'package:analyzer/src/generated/engine.dart'; | 13 import 'package:analyzer/src/generated/engine.dart'; |
| 14 import 'package:analyzer/src/generated/sdk.dart'; | 14 import 'package:analyzer/src/generated/sdk.dart'; |
| 15 import 'package:analyzer/src/generated/source.dart'; | 15 import 'package:analyzer/src/generated/source.dart'; |
| 16 import 'package:analyzer/src/generated/utilities_dart.dart'; | |
| 17 import 'package:analyzer/src/summary/idl.dart'; | 16 import 'package:analyzer/src/summary/idl.dart'; |
| 17 import 'package:analyzer/src/summary/summary_sdk.dart'; |
| 18 import 'package:analyzer/src/util/absolute_path.dart'; | 18 import 'package:analyzer/src/util/absolute_path.dart'; |
| 19 import 'package:front_end/incremental_resolved_ast_generator.dart'; | 19 import 'package:front_end/incremental_resolved_ast_generator.dart'; |
| 20 import 'package:front_end/src/base/file_repository.dart'; | 20 import 'package:front_end/src/base/file_repository.dart'; |
| 21 import 'package:front_end/src/base/processed_options.dart'; | 21 import 'package:front_end/src/base/processed_options.dart'; |
| 22 import 'package:front_end/src/base/source.dart'; | 22 import 'package:front_end/src/base/source.dart'; |
| 23 import 'package:front_end/src/dependency_grapher_impl.dart'; | 23 import 'package:front_end/src/dependency_grapher_impl.dart'; |
| 24 import 'package:path/src/context.dart'; | 24 import 'package:path/src/context.dart'; |
| 25 | 25 |
| 26 dynamic unimplemented() { | 26 dynamic unimplemented() { |
| 27 // TODO(paulberry): get rid of this. | 27 // TODO(paulberry): get rid of this. |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 // TODO(paulberry): MemoryByteStore leaks memory (it never discards data). | 116 // TODO(paulberry): MemoryByteStore leaks memory (it never discards data). |
| 117 // Do something better here. | 117 // Do something better here. |
| 118 var byteStore = new MemoryByteStore(); | 118 var byteStore = new MemoryByteStore(); |
| 119 // TODO(paulberry): can we just use null? | 119 // TODO(paulberry): can we just use null? |
| 120 var fileContentOverlay = new FileContentOverlay(); | 120 var fileContentOverlay = new FileContentOverlay(); |
| 121 var sdkContext = new AnalysisContextImpl(); | 121 var sdkContext = new AnalysisContextImpl(); |
| 122 var dartSdk = new _DartSdkProxy( | 122 var dartSdk = new _DartSdkProxy( |
| 123 await _options.getSdkSummary(), sdkContext, _fileRepository); | 123 await _options.getSdkSummary(), sdkContext, _fileRepository); |
| 124 sdkContext.sourceFactory = | 124 sdkContext.sourceFactory = |
| 125 new SourceFactory([new DartUriResolver(dartSdk)]); | 125 new SourceFactory([new DartUriResolver(dartSdk)]); |
| 126 bool strongMode = true; // TODO(paulberry): support strong mode flag. |
| 127 sdkContext.resultProvider = new SdkSummaryResultProvider( |
| 128 sdkContext, await _options.getSdkSummary(), strongMode); |
| 126 | 129 |
| 127 var sourceFactory = new _SourceFactoryProxy(dartSdk, _fileRepository); | 130 var sourceFactory = new _SourceFactoryProxy(dartSdk, _fileRepository); |
| 128 var analysisOptions = new AnalysisOptionsImpl(); | 131 var analysisOptions = new AnalysisOptionsImpl(); |
| 129 _driver = new driver.AnalysisDriver( | 132 _driver = new driver.AnalysisDriver( |
| 130 _scheduler, | 133 _scheduler, |
| 131 performanceLog, | 134 performanceLog, |
| 132 _resourceProvider, | 135 _resourceProvider, |
| 133 byteStore, | 136 byteStore, |
| 134 fileContentOverlay, | 137 fileContentOverlay, |
| 135 'front_end', | 138 'front_end', |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 AnalysisContext context; | 263 AnalysisContext context; |
| 261 | 264 |
| 262 _SourceFactoryProxy(this.dartSdk, this._fileRepository); | 265 _SourceFactoryProxy(this.dartSdk, this._fileRepository); |
| 263 | 266 |
| 264 @override | 267 @override |
| 265 SourceFactory clone() => new _SourceFactoryProxy(dartSdk, _fileRepository); | 268 SourceFactory clone() => new _SourceFactoryProxy(dartSdk, _fileRepository); |
| 266 | 269 |
| 267 @override | 270 @override |
| 268 Source forUri(String absoluteUri) { | 271 Source forUri(String absoluteUri) { |
| 269 Uri uri = Uri.parse(absoluteUri); | 272 Uri uri = Uri.parse(absoluteUri); |
| 270 if (uri.scheme == 'dart') { | |
| 271 return new _SourceProxy( | |
| 272 uri, _fileRepository.pathForUri(uri, allocate: true)); | |
| 273 } | |
| 274 return new _SourceProxy(uri, _fileRepository.pathForUri(uri)); | 273 return new _SourceProxy(uri, _fileRepository.pathForUri(uri)); |
| 275 } | 274 } |
| 276 | 275 |
| 277 noSuchMethod(Invocation invocation) => unimplemented(); | 276 noSuchMethod(Invocation invocation) => unimplemented(); |
| 278 | 277 |
| 279 Source resolveUri(Source containingSource, String containedUri) { | 278 Source resolveUri(Source containingSource, String containedUri) { |
| 280 // TODO(paulberry): re-use code from dependency_grapher_impl, and support | 279 // TODO(paulberry): re-use code from dependency_grapher_impl, and support |
| 281 // SDK URI resolution logic. | 280 // SDK URI resolution logic. |
| 282 String absoluteUri = | 281 var absoluteUri = containingSource == null |
| 283 resolveRelativeUri(containingSource?.uri, Uri.parse(containedUri)) | 282 ? containedUri |
| 284 .toString(); | 283 : containingSource.uri.resolve(containedUri).toString(); |
| 285 return forUri(absoluteUri); | 284 return forUri(absoluteUri); |
| 286 } | 285 } |
| 287 | 286 |
| 288 @override | 287 @override |
| 289 Uri restoreUri(Source source) => source.uri; | 288 Uri restoreUri(Source source) => source.uri; |
| 290 } | 289 } |
| 291 | 290 |
| 292 class _SourceProxy extends BasicSource { | 291 class _SourceProxy extends BasicSource { |
| 293 @override | 292 @override |
| 294 final String fullName; | 293 final String fullName; |
| 295 | 294 |
| 296 _SourceProxy(Uri uri, this.fullName) : super(uri); | 295 _SourceProxy(Uri uri, this.fullName) : super(uri); |
| 297 | 296 |
| 298 int get modificationStamp => 0; | 297 int get modificationStamp => 0; |
| 299 | 298 |
| 300 noSuchMethod(Invocation invocation) => unimplemented(); | 299 noSuchMethod(Invocation invocation) => unimplemented(); |
| 301 } | 300 } |
| OLD | NEW |