| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 analyzer.src.generated.sdk2; | 5 library analyzer.src.generated.sdk2; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:convert'; | 8 import 'dart:convert'; |
| 9 import 'dart:io' as io; | 9 import 'dart:io' as io; |
| 10 | 10 |
| 11 import 'package:analyzer/dart/ast/ast.dart'; | 11 import 'package:analyzer/dart/ast/ast.dart'; |
| 12 import 'package:analyzer/error/listener.dart'; | 12 import 'package:analyzer/error/listener.dart'; |
| 13 import 'package:analyzer/exception/exception.dart'; | 13 import 'package:analyzer/exception/exception.dart'; |
| 14 import 'package:analyzer/file_system/file_system.dart'; | 14 import 'package:analyzer/file_system/file_system.dart'; |
| 15 import 'package:analyzer/file_system/memory_file_system.dart'; | 15 import 'package:analyzer/file_system/memory_file_system.dart'; |
| 16 import 'package:analyzer/src/context/context.dart'; | 16 import 'package:analyzer/src/context/context.dart'; |
| 17 import 'package:analyzer/src/dart/scanner/reader.dart'; | 17 import 'package:analyzer/src/dart/scanner/reader.dart'; |
| 18 import 'package:analyzer/src/dart/scanner/scanner.dart'; | 18 import 'package:analyzer/src/dart/scanner/scanner.dart'; |
| 19 import 'package:analyzer/src/generated/engine.dart'; | 19 import 'package:analyzer/src/generated/engine.dart'; |
| 20 import 'package:analyzer/src/generated/java_engine_io.dart'; | 20 import 'package:analyzer/src/generated/java_engine_io.dart'; |
| 21 import 'package:analyzer/src/generated/parser.dart'; | 21 import 'package:analyzer/src/generated/parser.dart'; |
| 22 import 'package:analyzer/src/generated/sdk.dart'; | 22 import 'package:analyzer/src/generated/sdk.dart'; |
| 23 import 'package:analyzer/src/generated/source_io.dart'; | 23 import 'package:analyzer/src/generated/source_io.dart'; |
| 24 import 'package:analyzer/src/summary/idl.dart' show PackageBundle; | 24 import 'package:analyzer/src/summary/idl.dart' show PackageBundle; |
| 25 import 'package:analyzer/src/summary/summary_sdk.dart'; | 25 import 'package:analyzer/src/summary/package_bundle_reader.dart'; |
| 26 import 'package:path/path.dart' as pathos; | 26 import 'package:path/path.dart' as pathos; |
| 27 import 'package:yaml/yaml.dart'; | 27 import 'package:yaml/yaml.dart'; |
| 28 | 28 |
| 29 /** | 29 /** |
| 30 * An abstract implementation of a Dart SDK in which the available libraries are | 30 * An abstract implementation of a Dart SDK in which the available libraries are |
| 31 * stored in a library map. Subclasses are responsible for populating the | 31 * stored in a library map. Subclasses are responsible for populating the |
| 32 * library map. | 32 * library map. |
| 33 */ | 33 */ |
| 34 abstract class AbstractDartSdk implements DartSdk { | 34 abstract class AbstractDartSdk implements DartSdk { |
| 35 /** | 35 /** |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 _analysisOptions = options; | 82 _analysisOptions = options; |
| 83 } | 83 } |
| 84 | 84 |
| 85 @override | 85 @override |
| 86 AnalysisContext get context { | 86 AnalysisContext get context { |
| 87 if (_analysisContext == null) { | 87 if (_analysisContext == null) { |
| 88 _analysisContext = new SdkAnalysisContext(_analysisOptions); | 88 _analysisContext = new SdkAnalysisContext(_analysisOptions); |
| 89 SourceFactory factory = new SourceFactory([new DartUriResolver(this)]); | 89 SourceFactory factory = new SourceFactory([new DartUriResolver(this)]); |
| 90 _analysisContext.sourceFactory = factory; | 90 _analysisContext.sourceFactory = factory; |
| 91 if (_useSummary) { | 91 if (_useSummary) { |
| 92 bool strongMode = _analysisOptions?.strongMode ?? false; | |
| 93 PackageBundle sdkBundle = getLinkedBundle(); | 92 PackageBundle sdkBundle = getLinkedBundle(); |
| 94 if (sdkBundle != null) { | 93 if (sdkBundle != null) { |
| 95 _analysisContext.resultProvider = new SdkSummaryResultProvider( | 94 SummaryDataStore dataStore = new SummaryDataStore([]); |
| 96 _analysisContext, sdkBundle, strongMode); | 95 dataStore.addBundle(null, sdkBundle); |
| 96 _analysisContext.resultProvider = |
| 97 new InputPackagesResultProvider(_analysisContext, dataStore); |
| 97 } | 98 } |
| 98 } | 99 } |
| 99 } | 100 } |
| 100 return _analysisContext; | 101 return _analysisContext; |
| 101 } | 102 } |
| 102 | 103 |
| 103 @override | 104 @override |
| 104 List<SdkLibrary> get sdkLibraries => libraryMap.sdkLibraries; | 105 List<SdkLibrary> get sdkLibraries => libraryMap.sdkLibraries; |
| 105 | 106 |
| 106 /** | 107 /** |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 SdkLibrariesReader_LibraryBuilder libraryBuilder = | 891 SdkLibrariesReader_LibraryBuilder libraryBuilder = |
| 891 new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths); | 892 new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths); |
| 892 // If any syntactic errors were found then don't try to visit the AST | 893 // If any syntactic errors were found then don't try to visit the AST |
| 893 // structure. | 894 // structure. |
| 894 if (!errorListener.errorReported) { | 895 if (!errorListener.errorReported) { |
| 895 unit.accept(libraryBuilder); | 896 unit.accept(libraryBuilder); |
| 896 } | 897 } |
| 897 return libraryBuilder.librariesMap; | 898 return libraryBuilder.librariesMap; |
| 898 } | 899 } |
| 899 } | 900 } |
| OLD | NEW |