Chromium Code Reviews| 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 200 * The directory containing the SDK. | 200 * The directory containing the SDK. |
| 201 */ | 201 */ |
| 202 JavaFile _sdkDirectory; | 202 JavaFile _sdkDirectory; |
| 203 | 203 |
| 204 /** | 204 /** |
| 205 * The directory within the SDK directory that contains the libraries. | 205 * The directory within the SDK directory that contains the libraries. |
| 206 */ | 206 */ |
| 207 JavaFile _libraryDirectory; | 207 JavaFile _libraryDirectory; |
| 208 | 208 |
| 209 /** | 209 /** |
| 210 * The flag that specifies whether SDK summary should be used. | |
| 211 */ | |
| 212 bool _useSummary = false; | |
|
Brian Wilkerson
2016/02/09 20:41:07
I don't understand what the value of this flag is
| |
| 213 | |
| 214 /** | |
| 210 * The revision number of this SDK, or `"0"` if the revision number cannot be | 215 * The revision number of this SDK, or `"0"` if the revision number cannot be |
| 211 * discovered. | 216 * discovered. |
| 212 */ | 217 */ |
| 213 String _sdkVersion; | 218 String _sdkVersion; |
| 214 | 219 |
| 215 /** | 220 /** |
| 216 * The file containing the dart2js executable. | 221 * The file containing the dart2js executable. |
| 217 */ | 222 */ |
| 218 JavaFile _dart2jsExecutable; | 223 JavaFile _dart2jsExecutable; |
| 219 | 224 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 252 _libraryMap = initialLibraryMap(useDart2jsPaths); | 257 _libraryMap = initialLibraryMap(useDart2jsPaths); |
| 253 } | 258 } |
| 254 | 259 |
| 255 @override | 260 @override |
| 256 AnalysisContext get context { | 261 AnalysisContext get context { |
| 257 if (_analysisContext == null) { | 262 if (_analysisContext == null) { |
| 258 _analysisContext = new SdkAnalysisContext(); | 263 _analysisContext = new SdkAnalysisContext(); |
| 259 SourceFactory factory = new SourceFactory([new DartUriResolver(this)]); | 264 SourceFactory factory = new SourceFactory([new DartUriResolver(this)]); |
| 260 _analysisContext.sourceFactory = factory; | 265 _analysisContext.sourceFactory = factory; |
| 261 // Try to use summaries. | 266 // Try to use summaries. |
| 262 SdkBundle sdkBundle = _getSummarySdkBundle(); | 267 if (_useSummary) { |
| 263 if (sdkBundle != null) { | 268 SdkBundle sdkBundle = _getSummarySdkBundle(); |
| 264 _analysisContext.resultProvider = | 269 if (sdkBundle != null) { |
| 265 new SdkSummaryResultProvider(_analysisContext, sdkBundle); | 270 _analysisContext.resultProvider = |
| 271 new SdkSummaryResultProvider(_analysisContext, sdkBundle); | |
| 272 } | |
| 266 } | 273 } |
| 267 } | 274 } |
| 268 return _analysisContext; | 275 return _analysisContext; |
| 269 } | 276 } |
| 270 | 277 |
| 271 /** | 278 /** |
| 272 * Return the file containing the dart2js executable, or `null` if it does not | 279 * Return the file containing the dart2js executable, or `null` if it does not |
| 273 * exist. | 280 * exist. |
| 274 */ | 281 */ |
| 275 JavaFile get dart2JsExecutable { | 282 JavaFile get dart2JsExecutable { |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 383 // Fall through to return the default. | 390 // Fall through to return the default. |
| 384 } | 391 } |
| 385 } | 392 } |
| 386 return _sdkVersion; | 393 return _sdkVersion; |
| 387 } | 394 } |
| 388 | 395 |
| 389 @override | 396 @override |
| 390 List<String> get uris => _libraryMap.uris; | 397 List<String> get uris => _libraryMap.uris; |
| 391 | 398 |
| 392 /** | 399 /** |
| 400 * Specify whether SDK summary should be used. This property can only be set | |
| 401 * before [context] was invoked. | |
|
Paul Berry
2016/02/09 20:36:08
s/was/is/
| |
| 402 */ | |
| 403 void set useSummary(bool use) { | |
| 404 if (_analysisContext != null) { | |
| 405 throw new StateError('SDK analysis context has been already created.'); | |
| 406 } | |
| 407 _useSummary = use; | |
| 408 } | |
| 409 | |
| 410 /** | |
| 393 * Return the name of the file containing the VM executable. | 411 * Return the name of the file containing the VM executable. |
| 394 */ | 412 */ |
| 395 String get vmBinaryName { | 413 String get vmBinaryName { |
| 396 if (OSUtilities.isWindows()) { | 414 if (OSUtilities.isWindows()) { |
| 397 return _VM_EXECUTABLE_NAME_WIN; | 415 return _VM_EXECUTABLE_NAME_WIN; |
| 398 } else { | 416 } else { |
| 399 return _VM_EXECUTABLE_NAME; | 417 return _VM_EXECUTABLE_NAME; |
| 400 } | 418 } |
| 401 } | 419 } |
| 402 | 420 |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 644 SdkLibrariesReader_LibraryBuilder libraryBuilder = | 662 SdkLibrariesReader_LibraryBuilder libraryBuilder = |
| 645 new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths); | 663 new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths); |
| 646 // If any syntactic errors were found then don't try to visit the AST | 664 // If any syntactic errors were found then don't try to visit the AST |
| 647 // structure. | 665 // structure. |
| 648 if (!errorListener.errorReported) { | 666 if (!errorListener.errorReported) { |
| 649 unit.accept(libraryBuilder); | 667 unit.accept(libraryBuilder); |
| 650 } | 668 } |
| 651 return libraryBuilder.librariesMap; | 669 return libraryBuilder.librariesMap; |
| 652 } | 670 } |
| 653 } | 671 } |
| OLD | NEW |