| 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.summary.summary_file_builder; | 5 library analyzer.src.summary.summary_file_builder; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:io' as io; | 8 import 'dart:io' as io; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 * Create an SDK summary builder for the dart SDK at the given [sdkPath], | 109 * Create an SDK summary builder for the dart SDK at the given [sdkPath], |
| 110 * using this [config]. | 110 * using this [config]. |
| 111 */ | 111 */ |
| 112 factory SummaryBuilder.forSdk(String sdkPath, SummaryBuildConfig config) { | 112 factory SummaryBuilder.forSdk(String sdkPath, SummaryBuildConfig config) { |
| 113 bool strongMode = config.strongMode; | 113 bool strongMode = config.strongMode; |
| 114 | 114 |
| 115 // | 115 // |
| 116 // Prepare SDK. | 116 // Prepare SDK. |
| 117 // | 117 // |
| 118 ResourceProvider resourceProvider = PhysicalResourceProvider.INSTANCE; | 118 ResourceProvider resourceProvider = PhysicalResourceProvider.INSTANCE; |
| 119 FolderBasedDartSdk sdk = new FolderBasedDartSdk(resourceProvider, | 119 FolderBasedDartSdk sdk = new FolderBasedDartSdk( |
| 120 FolderBasedDartSdk.defaultSdkDirectory(resourceProvider), strongMode); | 120 resourceProvider, resourceProvider.getFolder(sdkPath), strongMode); |
| 121 sdk.useSummary = false; | 121 sdk.useSummary = false; |
| 122 sdk.analysisOptions = new AnalysisOptionsImpl()..strongMode = strongMode; | 122 sdk.analysisOptions = new AnalysisOptionsImpl()..strongMode = strongMode; |
| 123 | 123 |
| 124 // | 124 // |
| 125 // Prepare 'dart:' URIs to serialize. | 125 // Prepare 'dart:' URIs to serialize. |
| 126 // | 126 // |
| 127 Set<String> uriSet = | 127 Set<String> uriSet = |
| 128 sdk.sdkLibraries.map((SdkLibrary library) => library.shortName).toSet(); | 128 sdk.sdkLibraries.map((SdkLibrary library) => library.shortName).toSet(); |
| 129 if (!strongMode) { | 129 if (!strongMode) { |
| 130 uriSet.add('dart:html/nativewrappers.dart'); | 130 uriSet.add('dart:html/nativewrappers.dart'); |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 element.exportedLibraries.forEach((e) => _serializeLibrary(e.source)); | 214 element.exportedLibraries.forEach((e) => _serializeLibrary(e.source)); |
| 215 // Index every unit of the library. | 215 // Index every unit of the library. |
| 216 for (CompilationUnitElement unitElement in element.units) { | 216 for (CompilationUnitElement unitElement in element.units) { |
| 217 Source unitSource = unitElement.source; | 217 Source unitSource = unitElement.source; |
| 218 CompilationUnit unit = | 218 CompilationUnit unit = |
| 219 context.resolveCompilationUnit2(unitSource, source); | 219 context.resolveCompilationUnit2(unitSource, source); |
| 220 indexAssembler.indexUnit(unit); | 220 indexAssembler.indexUnit(unit); |
| 221 } | 221 } |
| 222 } | 222 } |
| 223 } | 223 } |
| OLD | NEW |