Chromium Code Reviews| 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 import 'dart:collection' show HashSet, Queue; | 5 import 'dart:collection' show HashSet, Queue; |
| 6 import 'dart:convert' show BASE64, JSON, UTF8; | 6 import 'dart:convert' show BASE64, JSON, UTF8; |
| 7 import 'dart:io' show File; | 7 import 'dart:io' show File; |
| 8 import 'package:analyzer/dart/element/element.dart' show LibraryElement; | 8 import 'package:analyzer/dart/element/element.dart' show LibraryElement; |
| 9 import 'package:analyzer/analyzer.dart' | 9 import 'package:analyzer/analyzer.dart' |
| 10 show AnalysisError, CompilationUnit, ErrorSeverity; | 10 show AnalysisError, CompilationUnit, ErrorSeverity; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 79 options: options.contextBuilderOptions); | 79 options: options.contextBuilderOptions); |
| 80 | 80 |
| 81 var analysisOptions = contextBuilder.getAnalysisOptions(analysisRoot); | 81 var analysisOptions = contextBuilder.getAnalysisOptions(analysisRoot); |
| 82 var sdk = contextBuilder.findSdk(null, analysisOptions); | 82 var sdk = contextBuilder.findSdk(null, analysisOptions); |
| 83 | 83 |
| 84 var sdkResolver = new DartUriResolver(sdk); | 84 var sdkResolver = new DartUriResolver(sdk); |
| 85 | 85 |
| 86 // Read the summaries. | 86 // Read the summaries. |
| 87 var summaryData = | 87 var summaryData = |
| 88 new SummaryDataStore(options.summaryPaths, recordDependencyInfo: true); | 88 new SummaryDataStore(options.summaryPaths, recordDependencyInfo: true); |
| 89 summaryData.addBundle(null, sdk.getLinkedBundle()); | |
|
vsm
2017/01/23 23:43:37
Does it make sense to pass the sdk to the SummaryD
| |
| 89 | 90 |
| 90 var srcFactory = createSourceFactory(options, | 91 var srcFactory = createSourceFactory(options, |
| 91 sdkResolver: sdkResolver, | 92 sdkResolver: sdkResolver, |
| 92 fileResolvers: fileResolvers, | 93 fileResolvers: fileResolvers, |
| 93 summaryData: summaryData, | 94 summaryData: summaryData, |
| 94 resourceProvider: resourceProvider); | 95 resourceProvider: resourceProvider); |
| 95 | 96 |
| 96 var context = | 97 var context = |
| 97 AnalysisEngine.instance.createAnalysisContext() as AnalysisContextImpl; | 98 AnalysisEngine.instance.createAnalysisContext() as AnalysisContextImpl; |
| 98 context.analysisOptions = analysisOptions; | 99 context.analysisOptions = analysisOptions; |
| 99 context.sourceFactory = srcFactory; | 100 context.sourceFactory = srcFactory; |
| 100 context.typeProvider = sdkResolver.dartSdk.context.typeProvider; | |
| 101 context.resultProvider = | 101 context.resultProvider = |
| 102 new InputPackagesResultProvider(context, summaryData); | 102 new InputPackagesResultProvider(context, summaryData); |
| 103 options.declaredVariables.forEach(context.declaredVariables.define); | 103 options.declaredVariables.forEach(context.declaredVariables.define); |
| 104 context.declaredVariables.define('dart.isVM', 'false'); | 104 context.declaredVariables.define('dart.isVM', 'false'); |
| 105 | 105 |
| 106 // TODO(vsm): Should this be hardcoded? | 106 // TODO(vsm): Should this be hardcoded? |
| 107 context.declaredVariables.define('dart.library.html', 'true'); | 107 context.declaredVariables.define('dart.library.html', 'true'); |
| 108 context.declaredVariables.define('dart.library.io', 'false'); | 108 context.declaredVariables.define('dart.library.io', 'false'); |
| 109 | 109 |
| 110 if (!context.analysisOptions.strongMode) { | 110 if (!context.analysisOptions.strongMode) { |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 571 // Fall back to a relative path. | 571 // Fall back to a relative path. |
| 572 return path.toUri(path.relative(path.fromUri(uri), from: dir)).toString(); | 572 return path.toUri(path.relative(path.fromUri(uri), from: dir)).toString(); |
| 573 } | 573 } |
| 574 | 574 |
| 575 for (int i = 0; i < list.length; i++) { | 575 for (int i = 0; i < list.length; i++) { |
| 576 list[i] = transformUri(list[i]); | 576 list[i] = transformUri(list[i]); |
| 577 } | 577 } |
| 578 map['file'] = transformUri(map['file']); | 578 map['file'] = transformUri(map['file']); |
| 579 return map; | 579 return map; |
| 580 } | 580 } |
| OLD | NEW |