| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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.sdk_io; | 5 library analyzer.src.generated.sdk_io; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
| (...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 251 this._sdkDirectory = sdkDirectory.getAbsoluteFile(); | 251 this._sdkDirectory = sdkDirectory.getAbsoluteFile(); |
| 252 _libraryMap = initialLibraryMap(useDart2jsPaths); | 252 _libraryMap = initialLibraryMap(useDart2jsPaths); |
| 253 } | 253 } |
| 254 | 254 |
| 255 @override | 255 @override |
| 256 AnalysisContext get context { | 256 AnalysisContext get context { |
| 257 if (_analysisContext == null) { | 257 if (_analysisContext == null) { |
| 258 _analysisContext = new SdkAnalysisContext(); | 258 _analysisContext = new SdkAnalysisContext(); |
| 259 SourceFactory factory = new SourceFactory([new DartUriResolver(this)]); | 259 SourceFactory factory = new SourceFactory([new DartUriResolver(this)]); |
| 260 _analysisContext.sourceFactory = factory; | 260 _analysisContext.sourceFactory = factory; |
| 261 List<String> uris = this.uris; | |
| 262 // Try to use summaries. | 261 // Try to use summaries. |
| 263 SdkBundle sdkBundle = _getSummarySdkBundle(); | 262 SdkBundle sdkBundle = _getSummarySdkBundle(); |
| 264 if (sdkBundle != null) { | 263 if (sdkBundle != null) { |
| 265 _analysisContext.resultProvider = | 264 _analysisContext.resultProvider = |
| 266 new SdkSummaryResultProvider(_analysisContext, sdkBundle); | 265 new SdkSummaryResultProvider(_analysisContext, sdkBundle); |
| 267 } | 266 } |
| 268 // Add sources. | |
| 269 ChangeSet changeSet = new ChangeSet(); | |
| 270 for (String uri in uris) { | |
| 271 changeSet.addedSource(factory.forUri(uri)); | |
| 272 } | |
| 273 _analysisContext.applyChanges(changeSet); | |
| 274 } | 267 } |
| 275 return _analysisContext; | 268 return _analysisContext; |
| 276 } | 269 } |
| 277 | 270 |
| 278 /** | 271 /** |
| 279 * Return the file containing the dart2js executable, or `null` if it does not | 272 * Return the file containing the dart2js executable, or `null` if it does not |
| 280 * exist. | 273 * exist. |
| 281 */ | 274 */ |
| 282 JavaFile get dart2JsExecutable { | 275 JavaFile get dart2JsExecutable { |
| 283 if (_dart2jsExecutable == null) { | 276 if (_dart2jsExecutable == null) { |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 SdkLibrariesReader_LibraryBuilder libraryBuilder = | 644 SdkLibrariesReader_LibraryBuilder libraryBuilder = |
| 652 new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths); | 645 new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths); |
| 653 // If any syntactic errors were found then don't try to visit the AST | 646 // If any syntactic errors were found then don't try to visit the AST |
| 654 // structure. | 647 // structure. |
| 655 if (!errorListener.errorReported) { | 648 if (!errorListener.errorReported) { |
| 656 unit.accept(libraryBuilder); | 649 unit.accept(libraryBuilder); |
| 657 } | 650 } |
| 658 return libraryBuilder.librariesMap; | 651 return libraryBuilder.librariesMap; |
| 659 } | 652 } |
| 660 } | 653 } |
| OLD | NEW |