| 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'; |
| 16 import 'package:analyzer/src/summary/idl.dart'; | 17 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); | |
| 129 | 126 |
| 130 var sourceFactory = new _SourceFactoryProxy(dartSdk, _fileRepository); | 127 var sourceFactory = new _SourceFactoryProxy(dartSdk, _fileRepository); |
| 131 var analysisOptions = new AnalysisOptionsImpl(); | 128 var analysisOptions = new AnalysisOptionsImpl(); |
| 132 _driver = new driver.AnalysisDriver( | 129 _driver = new driver.AnalysisDriver( |
| 133 _scheduler, | 130 _scheduler, |
| 134 performanceLog, | 131 performanceLog, |
| 135 _resourceProvider, | 132 _resourceProvider, |
| 136 byteStore, | 133 byteStore, |
| 137 fileContentOverlay, | 134 fileContentOverlay, |
| 138 'front_end', | 135 'front_end', |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 AnalysisContext context; | 260 AnalysisContext context; |
| 264 | 261 |
| 265 _SourceFactoryProxy(this.dartSdk, this._fileRepository); | 262 _SourceFactoryProxy(this.dartSdk, this._fileRepository); |
| 266 | 263 |
| 267 @override | 264 @override |
| 268 SourceFactory clone() => new _SourceFactoryProxy(dartSdk, _fileRepository); | 265 SourceFactory clone() => new _SourceFactoryProxy(dartSdk, _fileRepository); |
| 269 | 266 |
| 270 @override | 267 @override |
| 271 Source forUri(String absoluteUri) { | 268 Source forUri(String absoluteUri) { |
| 272 Uri uri = Uri.parse(absoluteUri); | 269 Uri uri = Uri.parse(absoluteUri); |
| 270 if (uri.scheme == 'dart') { |
| 271 return new _SourceProxy( |
| 272 uri, _fileRepository.pathForUri(uri, allocate: true)); |
| 273 } |
| 273 return new _SourceProxy(uri, _fileRepository.pathForUri(uri)); | 274 return new _SourceProxy(uri, _fileRepository.pathForUri(uri)); |
| 274 } | 275 } |
| 275 | 276 |
| 276 noSuchMethod(Invocation invocation) => unimplemented(); | 277 noSuchMethod(Invocation invocation) => unimplemented(); |
| 277 | 278 |
| 278 Source resolveUri(Source containingSource, String containedUri) { | 279 Source resolveUri(Source containingSource, String containedUri) { |
| 279 // TODO(paulberry): re-use code from dependency_grapher_impl, and support | 280 // TODO(paulberry): re-use code from dependency_grapher_impl, and support |
| 280 // SDK URI resolution logic. | 281 // SDK URI resolution logic. |
| 281 var absoluteUri = containingSource == null | 282 String absoluteUri = |
| 282 ? containedUri | 283 resolveRelativeUri(containingSource?.uri, Uri.parse(containedUri)) |
| 283 : containingSource.uri.resolve(containedUri).toString(); | 284 .toString(); |
| 284 return forUri(absoluteUri); | 285 return forUri(absoluteUri); |
| 285 } | 286 } |
| 286 | 287 |
| 287 @override | 288 @override |
| 288 Uri restoreUri(Source source) => source.uri; | 289 Uri restoreUri(Source source) => source.uri; |
| 289 } | 290 } |
| 290 | 291 |
| 291 class _SourceProxy extends BasicSource { | 292 class _SourceProxy extends BasicSource { |
| 292 @override | 293 @override |
| 293 final String fullName; | 294 final String fullName; |
| 294 | 295 |
| 295 _SourceProxy(Uri uri, this.fullName) : super(uri); | 296 _SourceProxy(Uri uri, this.fullName) : super(uri); |
| 296 | 297 |
| 297 int get modificationStamp => 0; | 298 int get modificationStamp => 0; |
| 298 | 299 |
| 299 noSuchMethod(Invocation invocation) => unimplemented(); | 300 noSuchMethod(Invocation invocation) => unimplemented(); |
| 300 } | 301 } |
| OLD | NEW |