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 // This code was auto-generated, is not intended to be edited, and is subject to | 5 // This code was auto-generated, is not intended to be edited, and is subject to |
| 6 // significant change. Please see the README file for more information. | 6 // significant change. Please see the README file for more information. |
| 7 | 7 |
| 8 library engine; | 8 library engine; |
| 9 | 9 |
| 10 import "dart:math" as math; | 10 import "dart:math" as math; |
| (...skipping 941 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 952 * client has not provided a name. | 952 * client has not provided a name. |
| 953 */ | 953 */ |
| 954 String name; | 954 String name; |
| 955 | 955 |
| 956 /** | 956 /** |
| 957 * The set of analysis options controlling the behavior of this context. | 957 * The set of analysis options controlling the behavior of this context. |
| 958 */ | 958 */ |
| 959 AnalysisOptionsImpl _options = new AnalysisOptionsImpl(); | 959 AnalysisOptionsImpl _options = new AnalysisOptionsImpl(); |
| 960 | 960 |
| 961 /** | 961 /** |
| 962 * A flag indicating whether errors related to sources in the SDK should be ge nerated and | 962 * A flag indicating whether errors related to implicitly analyzed sources |
| 963 * reported. | 963 * should be generated and reported. |
| 964 */ | |
| 965 bool _generateImplicitErrors = true; | |
| 966 | |
| 967 /** | |
| 968 * A flag indicating whether errors related to sources in the SDK should be | |
| 969 * generated and reported. | |
| 964 */ | 970 */ |
| 965 bool _generateSdkErrors = true; | 971 bool _generateSdkErrors = true; |
| 966 | 972 |
| 967 /** | 973 /** |
| 968 * A flag indicating whether this context is disposed. | 974 * A flag indicating whether this context is disposed. |
| 969 */ | 975 */ |
| 970 bool _disposed = false; | 976 bool _disposed = false; |
| 971 | 977 |
| 972 /** | 978 /** |
| 973 * A cache of content used to override the default content of a source. | 979 * A cache of content used to override the default content of a source. |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1108 new StreamController<SourcesChangedEvent>.broadcast(); | 1114 new StreamController<SourcesChangedEvent>.broadcast(); |
| 1109 } | 1115 } |
| 1110 | 1116 |
| 1111 @override | 1117 @override |
| 1112 AnalysisOptions get analysisOptions => _options; | 1118 AnalysisOptions get analysisOptions => _options; |
| 1113 | 1119 |
| 1114 @override | 1120 @override |
| 1115 void set analysisOptions(AnalysisOptions options) { | 1121 void set analysisOptions(AnalysisOptions options) { |
| 1116 bool needsRecompute = this._options.analyzeFunctionBodiesPredicate != | 1122 bool needsRecompute = this._options.analyzeFunctionBodiesPredicate != |
| 1117 options.analyzeFunctionBodiesPredicate || | 1123 options.analyzeFunctionBodiesPredicate || |
| 1124 this._options.generateImplicitErrors != options.generateImplicitErro rs || | |
| 1118 this._options.generateSdkErrors != options.generateSdkErrors || | 1125 this._options.generateSdkErrors != options.generateSdkErrors || |
| 1119 this._options.dart2jsHint != options.dart2jsHint || | 1126 this._options.dart2jsHint != options.dart2jsHint || |
| 1120 (this._options.hint && !options.hint) || | 1127 (this._options.hint && !options.hint) || |
| 1121 this._options.preserveComments != options.preserveComments; | 1128 this._options.preserveComments != options.preserveComments; |
| 1122 int cacheSize = options.cacheSize; | 1129 int cacheSize = options.cacheSize; |
| 1123 if (this._options.cacheSize != cacheSize) { | 1130 if (this._options.cacheSize != cacheSize) { |
| 1124 this._options.cacheSize = cacheSize; | 1131 this._options.cacheSize = cacheSize; |
| 1125 //cache.setMaxCacheSize(cacheSize); | 1132 //cache.setMaxCacheSize(cacheSize); |
| 1126 _privatePartition.maxCacheSize = cacheSize; | 1133 _privatePartition.maxCacheSize = cacheSize; |
| 1127 // | 1134 // |
| 1128 // Cap the size of the priority list to being less than the cache size. | 1135 // Cap the size of the priority list to being less than the cache size. |
| 1129 // Failure to do so can result in an infinite loop in | 1136 // Failure to do so can result in an infinite loop in |
| 1130 // performAnalysisTask() because re-caching one AST structure | 1137 // performAnalysisTask() because re-caching one AST structure |
| 1131 // can cause another priority source's AST structure to be flushed. | 1138 // can cause another priority source's AST structure to be flushed. |
| 1132 // | 1139 // |
| 1133 int maxPriorityOrderSize = cacheSize - _PRIORITY_ORDER_SIZE_DELTA; | 1140 int maxPriorityOrderSize = cacheSize - _PRIORITY_ORDER_SIZE_DELTA; |
| 1134 if (_priorityOrder.length > maxPriorityOrderSize) { | 1141 if (_priorityOrder.length > maxPriorityOrderSize) { |
| 1135 List<Source> newPriorityOrder = new List<Source>(maxPriorityOrderSize); | 1142 List<Source> newPriorityOrder = new List<Source>(maxPriorityOrderSize); |
| 1136 JavaSystem.arraycopy( | 1143 JavaSystem.arraycopy( |
| 1137 _priorityOrder, 0, newPriorityOrder, 0, maxPriorityOrderSize); | 1144 _priorityOrder, 0, newPriorityOrder, 0, maxPriorityOrderSize); |
| 1138 _priorityOrder = newPriorityOrder; | 1145 _priorityOrder = newPriorityOrder; |
| 1139 } | 1146 } |
| 1140 } | 1147 } |
| 1141 this._options.analyzeFunctionBodiesPredicate = | 1148 this._options.analyzeFunctionBodiesPredicate = |
| 1142 options.analyzeFunctionBodiesPredicate; | 1149 options.analyzeFunctionBodiesPredicate; |
| 1150 this._options.generateImplicitErrors = options.generateImplicitErrors; | |
| 1143 this._options.generateSdkErrors = options.generateSdkErrors; | 1151 this._options.generateSdkErrors = options.generateSdkErrors; |
| 1144 this._options.dart2jsHint = options.dart2jsHint; | 1152 this._options.dart2jsHint = options.dart2jsHint; |
| 1145 this._options.hint = options.hint; | 1153 this._options.hint = options.hint; |
| 1146 this._options.incremental = options.incremental; | 1154 this._options.incremental = options.incremental; |
| 1147 this._options.incrementalApi = options.incrementalApi; | 1155 this._options.incrementalApi = options.incrementalApi; |
| 1148 this._options.incrementalValidation = options.incrementalValidation; | 1156 this._options.incrementalValidation = options.incrementalValidation; |
| 1149 this._options.lint = options.lint; | 1157 this._options.lint = options.lint; |
| 1150 this._options.preserveComments = options.preserveComments; | 1158 this._options.preserveComments = options.preserveComments; |
| 1159 _generateImplicitErrors = options.generateImplicitErrors; | |
| 1151 _generateSdkErrors = options.generateSdkErrors; | 1160 _generateSdkErrors = options.generateSdkErrors; |
| 1152 if (needsRecompute) { | 1161 if (needsRecompute) { |
| 1153 _invalidateAllLocalResolutionInformation(false); | 1162 _invalidateAllLocalResolutionInformation(false); |
| 1154 } | 1163 } |
| 1155 } | 1164 } |
| 1156 | 1165 |
| 1157 @override | 1166 @override |
| 1158 void set analysisPriorityOrder(List<Source> sources) { | 1167 void set analysisPriorityOrder(List<Source> sources) { |
| 1159 if (sources == null || sources.isEmpty) { | 1168 if (sources == null || sources.isEmpty) { |
| 1160 _priorityOrder = Source.EMPTY_ARRAY; | 1169 _priorityOrder = Source.EMPTY_ARRAY; |
| (...skipping 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2577 if (sourceEntry is DartEntry) { | 2586 if (sourceEntry is DartEntry) { |
| 2578 // get library-specific values | 2587 // get library-specific values |
| 2579 List<Source> librarySources = getLibrariesContaining(source); | 2588 List<Source> librarySources = getLibrariesContaining(source); |
| 2580 for (Source librarySource in librarySources) { | 2589 for (Source librarySource in librarySources) { |
| 2581 for (DataDescriptor descriptor in sourceEntry.libraryDescriptors) { | 2590 for (DataDescriptor descriptor in sourceEntry.libraryDescriptors) { |
| 2582 if (descriptor == DartEntry.BUILT_ELEMENT || | 2591 if (descriptor == DartEntry.BUILT_ELEMENT || |
| 2583 descriptor == DartEntry.BUILT_UNIT) { | 2592 descriptor == DartEntry.BUILT_UNIT) { |
| 2584 // These values are not currently being computed, so their state | 2593 // These values are not currently being computed, so their state |
| 2585 // is not interesting. | 2594 // is not interesting. |
| 2586 continue; | 2595 continue; |
| 2596 } else if (!sourceEntry.explicitlyAdded && | |
| 2597 !_generateImplicitErrors && | |
| 2598 (descriptor == DartEntry.VERIFICATION_ERRORS || | |
| 2599 descriptor == DartEntry.HINTS || | |
| 2600 descriptor == DartEntry.LINTS)) { | |
| 2601 continue; | |
|
scheglov
2015/03/05 18:54:04
Can this code be moved outside of the libraries cy
Brian Wilkerson
2015/03/05 19:47:58
I don't think so, although it would be nice. The p
| |
| 2587 } else if (source.isInSystemLibrary && | 2602 } else if (source.isInSystemLibrary && |
| 2588 !_generateSdkErrors && | 2603 !_generateSdkErrors && |
| 2589 (descriptor == DartEntry.VERIFICATION_ERRORS || | 2604 (descriptor == DartEntry.VERIFICATION_ERRORS || |
| 2590 descriptor == DartEntry.HINTS || | 2605 descriptor == DartEntry.HINTS || |
| 2591 descriptor == DartEntry.LINTS)) { | 2606 descriptor == DartEntry.LINTS)) { |
| 2592 continue; | 2607 continue; |
| 2593 } else if (!hintsEnabled && descriptor == DartEntry.HINTS) { | 2608 } else if (!hintsEnabled && descriptor == DartEntry.HINTS) { |
| 2594 continue; | 2609 continue; |
| 2595 } else if (!lintsEnabled && descriptor == DartEntry.LINTS) { | 2610 } else if (!lintsEnabled && descriptor == DartEntry.LINTS) { |
| 2596 continue; | 2611 continue; |
| (...skipping 1242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3839 // | 3854 // |
| 3840 // LibraryElement libraryElement = libraryEntry.getValue(DartEntry.EL EMENT); | 3855 // LibraryElement libraryElement = libraryEntry.getValue(DartEntry.EL EMENT); |
| 3841 // if (libraryElement != null) { | 3856 // if (libraryElement != null) { |
| 3842 // return new ResolveDartUnitTask(this, source, libraryElement); | 3857 // return new ResolveDartUnitTask(this, source, libraryElement); |
| 3843 // } | 3858 // } |
| 3844 // Possibly replace with: | 3859 // Possibly replace with: |
| 3845 // return createResolveDartLibraryTask(librarySource, (DartEntry) li braryEntry); | 3860 // return createResolveDartLibraryTask(librarySource, (DartEntry) li braryEntry); |
| 3846 return new AnalysisContextImpl_TaskData( | 3861 return new AnalysisContextImpl_TaskData( |
| 3847 new ResolveDartLibraryTask(this, source, librarySource), false); | 3862 new ResolveDartLibraryTask(this, source, librarySource), false); |
| 3848 } | 3863 } |
| 3849 if (_generateSdkErrors || !source.isInSystemLibrary) { | 3864 if ((!source.isInSystemLibrary || _generateSdkErrors) |
|
Paul Berry
2015/03/05 19:16:53
I had to write out a truth table to determine if t
Brian Wilkerson
2015/03/05 19:55:41
Done
| |
| 3865 && (dartEntry.explicitlyAdded || _generateImplicitErrors)) { | |
| 3850 CacheState verificationErrorsState = dartEntry.getStateInLibrary( | 3866 CacheState verificationErrorsState = dartEntry.getStateInLibrary( |
| 3851 DartEntry.VERIFICATION_ERRORS, librarySource); | 3867 DartEntry.VERIFICATION_ERRORS, librarySource); |
| 3852 if (verificationErrorsState == CacheState.INVALID || | 3868 if (verificationErrorsState == CacheState.INVALID || |
| 3853 (isPriority && verificationErrorsState == CacheState.FLUSHED)) { | 3869 (isPriority && verificationErrorsState == CacheState.FLUSHED)) { |
| 3854 return _createGenerateDartErrorsTask( | 3870 return _createGenerateDartErrorsTask( |
| 3855 source, dartEntry, librarySource, libraryEntry); | 3871 source, dartEntry, librarySource, libraryEntry); |
| 3856 } | 3872 } |
| 3857 if (hintsEnabled) { | 3873 if (hintsEnabled) { |
| 3858 CacheState hintsState = | 3874 CacheState hintsState = |
| 3859 dartEntry.getStateInLibrary(DartEntry.HINTS, librarySource); | 3875 dartEntry.getStateInLibrary(DartEntry.HINTS, librarySource); |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4055 DartEntry.RESOLVED_UNIT, librarySource); | 4071 DartEntry.RESOLVED_UNIT, librarySource); |
| 4056 if (resolvedUnitState == CacheState.INVALID || | 4072 if (resolvedUnitState == CacheState.INVALID || |
| 4057 (isPriority && resolvedUnitState == CacheState.FLUSHED)) { | 4073 (isPriority && resolvedUnitState == CacheState.FLUSHED)) { |
| 4058 LibraryElement libraryElement = | 4074 LibraryElement libraryElement = |
| 4059 libraryEntry.getValue(DartEntry.ELEMENT); | 4075 libraryEntry.getValue(DartEntry.ELEMENT); |
| 4060 if (libraryElement != null) { | 4076 if (libraryElement != null) { |
| 4061 sources.add(source); | 4077 sources.add(source); |
| 4062 return; | 4078 return; |
| 4063 } | 4079 } |
| 4064 } | 4080 } |
| 4065 if (_generateSdkErrors || !source.isInSystemLibrary) { | 4081 if ((!source.isInSystemLibrary || _generateSdkErrors) |
| 4082 && (dartEntry.explicitlyAdded || _generateImplicitErrors)) { | |
| 4066 CacheState verificationErrorsState = dartEntry.getStateInLibrary( | 4083 CacheState verificationErrorsState = dartEntry.getStateInLibrary( |
| 4067 DartEntry.VERIFICATION_ERRORS, librarySource); | 4084 DartEntry.VERIFICATION_ERRORS, librarySource); |
| 4068 if (verificationErrorsState == CacheState.INVALID || | 4085 if (verificationErrorsState == CacheState.INVALID || |
| 4069 (isPriority && verificationErrorsState == CacheState.FLUSHED)) { | 4086 (isPriority && verificationErrorsState == CacheState.FLUSHED)) { |
| 4070 LibraryElement libraryElement = | 4087 LibraryElement libraryElement = |
| 4071 libraryEntry.getValue(DartEntry.ELEMENT); | 4088 libraryEntry.getValue(DartEntry.ELEMENT); |
| 4072 if (libraryElement != null) { | 4089 if (libraryElement != null) { |
| 4073 sources.add(source); | 4090 sources.add(source); |
| 4074 return; | 4091 return; |
| 4075 } | 4092 } |
| (...skipping 2212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6288 /** | 6305 /** |
| 6289 * Futures returned by [AnalysisContext] for pending analysis results will | 6306 * Futures returned by [AnalysisContext] for pending analysis results will |
| 6290 * complete with this error if it is determined that analysis results will | 6307 * complete with this error if it is determined that analysis results will |
| 6291 * never become available (e.g. because the requested source is not subject to | 6308 * never become available (e.g. because the requested source is not subject to |
| 6292 * analysis, or because the requested source is a part file which is not a part | 6309 * analysis, or because the requested source is a part file which is not a part |
| 6293 * of any known library). | 6310 * of any known library). |
| 6294 */ | 6311 */ |
| 6295 class AnalysisNotScheduledError implements Exception {} | 6312 class AnalysisNotScheduledError implements Exception {} |
| 6296 | 6313 |
| 6297 /** | 6314 /** |
| 6298 * The interface `AnalysisOptions` defines the behavior of objects that provide access to a | 6315 * A set of analysis options used to control the behavior of an analysis |
| 6299 * set of analysis options used to control the behavior of an analysis context. | 6316 * context. |
| 6300 */ | 6317 */ |
| 6301 abstract class AnalysisOptions { | 6318 abstract class AnalysisOptions { |
| 6302 /** | 6319 /** |
| 6303 * If analysis is to parse and analyze all function bodies, return `true`. | 6320 * If analysis is to parse and analyze all function bodies, return `true`. |
| 6304 * If analysis is to skip all function bodies, return `false`. If analysis | 6321 * If analysis is to skip all function bodies, return `false`. If analysis |
| 6305 * is to parse and analyze function bodies in some sources and not in others, | 6322 * is to parse and analyze function bodies in some sources and not in others, |
| 6306 * throw an exception. | 6323 * throw an exception. |
| 6307 * | 6324 * |
| 6308 * This getter is deprecated; consider using [analyzeFunctionBodiesPredicate] | 6325 * This getter is deprecated; consider using [analyzeFunctionBodiesPredicate] |
| 6309 * instead. | 6326 * instead. |
| 6310 */ | 6327 */ |
| 6311 @deprecated | 6328 @deprecated // Use this.analyzeFunctionBodiesPredicate |
| 6312 bool get analyzeFunctionBodies; | 6329 bool get analyzeFunctionBodies; |
| 6313 | 6330 |
| 6314 /** | 6331 /** |
| 6315 * Function that returns `true` if analysis is to parse and analyze function | 6332 * Function that returns `true` if analysis is to parse and analyze function |
| 6316 * bodies for a given source. | 6333 * bodies for a given source. |
| 6317 */ | 6334 */ |
| 6318 AnalyzeFunctionBodiesPredicate get analyzeFunctionBodiesPredicate; | 6335 AnalyzeFunctionBodiesPredicate get analyzeFunctionBodiesPredicate; |
| 6319 | 6336 |
| 6320 /** | 6337 /** |
| 6321 * Return the maximum number of sources for which AST structures should be kep t in the cache. | 6338 * Return the maximum number of sources for which AST structures should be |
| 6322 * | 6339 * kept in the cache. |
| 6323 * @return the maximum number of sources for which AST structures should be ke pt in the cache | |
| 6324 */ | 6340 */ |
| 6325 int get cacheSize; | 6341 int get cacheSize; |
| 6326 | 6342 |
| 6327 /** | 6343 /** |
| 6328 * Return `true` if analysis is to generate dart2js related hint results. | 6344 * Return `true` if analysis is to generate dart2js related hint results. |
| 6329 * | |
| 6330 * @return `true` if analysis is to generate dart2js related hint results | |
| 6331 */ | 6345 */ |
| 6332 bool get dart2jsHint; | 6346 bool get dart2jsHint; |
| 6333 | 6347 |
| 6334 /** | 6348 /** |
| 6335 * Return `true` if analysis is to include the new async support. | 6349 * Return `true` if analysis is to include the new async support. |
| 6336 */ | 6350 */ |
| 6337 @deprecated | 6351 @deprecated // Always true |
| 6338 bool get enableAsync; | 6352 bool get enableAsync; |
| 6339 | 6353 |
| 6340 /** | 6354 /** |
| 6341 * Return `true` if analysis is to include the new deferred loading support. | 6355 * Return `true` if analysis is to include the new deferred loading support. |
| 6342 * | |
| 6343 * @return `true` if analysis is to include the new deferred loading support | |
| 6344 */ | 6356 */ |
| 6345 @deprecated | 6357 @deprecated // Always true |
| 6346 bool get enableDeferredLoading; | 6358 bool get enableDeferredLoading; |
| 6347 | 6359 |
| 6348 /** | 6360 /** |
| 6349 * Return `true` if analysis is to include the new enum support. | 6361 * Return `true` if analysis is to include the new enum support. |
| 6350 * | |
| 6351 * @return `true` if analysis is to include the new enum support | |
| 6352 */ | 6362 */ |
| 6353 @deprecated | 6363 @deprecated // Always true |
| 6354 bool get enableEnum; | 6364 bool get enableEnum; |
| 6355 | 6365 |
| 6356 /** | 6366 /** |
| 6357 * Return `true` if errors, warnings and hints should be generated for sources in the SDK. | 6367 * Return `true` if errors, warnings and hints should be generated for sources |
| 6358 * The default value is `false`. | 6368 * that are implicitly being analyzed. The default value is `true`. |
| 6359 * | 6369 */ |
| 6360 * @return `true` if errors, warnings and hints should be generated for the SD K | 6370 bool get generateImplicitErrors; |
| 6371 | |
| 6372 /** | |
| 6373 * Return `true` if errors, warnings and hints should be generated for sources | |
| 6374 * in the SDK. The default value is `false`. | |
| 6361 */ | 6375 */ |
| 6362 bool get generateSdkErrors; | 6376 bool get generateSdkErrors; |
| 6363 | 6377 |
| 6364 /** | 6378 /** |
| 6365 * Return `true` if analysis is to generate hint results (e.g. type inference based | 6379 * Return `true` if analysis is to generate hint results (e.g. type inference |
| 6366 * information and pub best practices). | 6380 * based information and pub best practices). |
| 6367 * | |
| 6368 * @return `true` if analysis is to generate hint results | |
| 6369 */ | 6381 */ |
| 6370 bool get hint; | 6382 bool get hint; |
| 6371 | 6383 |
| 6372 /** | 6384 /** |
| 6373 * Return `true` if incremental analysis should be used. | 6385 * Return `true` if incremental analysis should be used. |
| 6374 * | |
| 6375 * @return `true` if incremental analysis should be used | |
| 6376 */ | 6386 */ |
| 6377 bool get incremental; | 6387 bool get incremental; |
| 6378 | 6388 |
| 6379 /** | 6389 /** |
| 6380 * A flag indicating whether incremental analysis should be used for API | 6390 * A flag indicating whether incremental analysis should be used for API |
| 6381 * changes. | 6391 * changes. |
| 6382 */ | 6392 */ |
| 6383 bool get incrementalApi; | 6393 bool get incrementalApi; |
| 6384 | 6394 |
| 6385 /** | 6395 /** |
| 6386 * A flag indicating whether validation should be performed after incremental | 6396 * A flag indicating whether validation should be performed after incremental |
| 6387 * analysis. | 6397 * analysis. |
| 6388 */ | 6398 */ |
| 6389 bool get incrementalValidation; | 6399 bool get incrementalValidation; |
| 6390 | 6400 |
| 6391 /** | 6401 /** |
| 6392 * Return `true` if analysis is to generate lint warnings. | 6402 * Return `true` if analysis is to generate lint warnings. |
| 6393 * | |
| 6394 * @return `true` if analysis is to generate lint warnings | |
| 6395 */ | 6403 */ |
| 6396 bool get lint; | 6404 bool get lint; |
| 6397 | 6405 |
| 6398 /** | 6406 /** |
| 6399 * Return `true` if analysis is to parse comments. | 6407 * Return `true` if analysis is to parse comments. |
| 6400 * | |
| 6401 * @return `true` if analysis is to parse comments | |
| 6402 */ | 6408 */ |
| 6403 bool get preserveComments; | 6409 bool get preserveComments; |
| 6404 } | 6410 } |
| 6405 | 6411 |
| 6406 /** | 6412 /** |
| 6407 * Instances of the class `AnalysisOptions` represent a set of analysis options used to | 6413 * A set of analysis options used to control the behavior of an analysis |
| 6408 * control the behavior of an analysis context. | 6414 * context. |
| 6409 */ | 6415 */ |
| 6410 class AnalysisOptionsImpl implements AnalysisOptions { | 6416 class AnalysisOptionsImpl implements AnalysisOptions { |
| 6411 /** | 6417 /** |
| 6412 * The maximum number of sources for which data should be kept in the cache. | 6418 * The maximum number of sources for which data should be kept in the cache. |
| 6413 */ | 6419 */ |
| 6414 static const int DEFAULT_CACHE_SIZE = 64; | 6420 static const int DEFAULT_CACHE_SIZE = 64; |
| 6415 | 6421 |
| 6416 /** | 6422 /** |
| 6417 * The default value for enabling deferred loading. | 6423 * The default value for enabling deferred loading. |
| 6418 */ | 6424 */ |
| 6419 @deprecated | 6425 @deprecated |
| 6420 static bool DEFAULT_ENABLE_DEFERRED_LOADING = true; | 6426 static bool DEFAULT_ENABLE_DEFERRED_LOADING = true; |
| 6421 | 6427 |
| 6422 /** | 6428 /** |
| 6423 * The default value for enabling enum support. | 6429 * The default value for enabling enum support. |
| 6424 */ | 6430 */ |
| 6425 @deprecated | 6431 @deprecated |
| 6426 static bool DEFAULT_ENABLE_ENUM = false; | 6432 static bool DEFAULT_ENABLE_ENUM = false; |
| 6427 | 6433 |
| 6428 /** | 6434 /** |
| 6429 * A predicate indicating whether analysis is to parse and analyze function | 6435 * A predicate indicating whether analysis is to parse and analyze function |
| 6430 * bodies. | 6436 * bodies. |
| 6431 */ | 6437 */ |
| 6432 AnalyzeFunctionBodiesPredicate _analyzeFunctionBodiesPredicate = | 6438 AnalyzeFunctionBodiesPredicate _analyzeFunctionBodiesPredicate = |
| 6433 _analyzeAllFunctionBodies; | 6439 _analyzeAllFunctionBodies; |
| 6434 | 6440 |
| 6435 /** | 6441 /** |
| 6436 * The maximum number of sources for which AST structures should be kept in th e cache. | 6442 * The maximum number of sources for which AST structures should be kept in |
| 6443 * the cache. | |
| 6437 */ | 6444 */ |
| 6438 int cacheSize = DEFAULT_CACHE_SIZE; | 6445 int cacheSize = DEFAULT_CACHE_SIZE; |
| 6439 | 6446 |
| 6440 /** | 6447 /** |
| 6441 * A flag indicating whether analysis is to generate dart2js related hint resu lts. | 6448 * A flag indicating whether analysis is to generate dart2js related hint |
| 6449 * results. | |
| 6442 */ | 6450 */ |
| 6443 bool dart2jsHint = true; | 6451 bool dart2jsHint = true; |
| 6444 | 6452 |
| 6445 /** | 6453 /** |
| 6446 * A flag indicating whether errors, warnings and hints should be generated fo r sources in the | 6454 * A flag indicating whether errors, warnings and hints should be generated |
| 6447 * SDK. | 6455 * for sources that are implicitly being analyzed. |
| 6448 */ | 6456 */ |
| 6449 bool _generateSdkErrors = false; | 6457 bool generateImplicitErrors = true; |
| 6450 | 6458 |
| 6451 /** | 6459 /** |
| 6452 * A flag indicating whether analysis is to generate hint results (e.g. type i nference based | 6460 * A flag indicating whether errors, warnings and hints should be generated |
| 6453 * information and pub best practices). | 6461 * for sources in the SDK. |
| 6462 */ | |
| 6463 bool generateSdkErrors = false; | |
| 6464 | |
| 6465 /** | |
| 6466 * A flag indicating whether analysis is to generate hint results (e.g. type | |
| 6467 * inference based information and pub best practices). | |
| 6454 */ | 6468 */ |
| 6455 bool hint = true; | 6469 bool hint = true; |
| 6456 | 6470 |
| 6457 /** | 6471 /** |
| 6458 * A flag indicating whether incremental analysis should be used. | 6472 * A flag indicating whether incremental analysis should be used. |
| 6459 */ | 6473 */ |
| 6460 bool incremental = false; | 6474 bool incremental = false; |
| 6461 | 6475 |
| 6462 /** | 6476 /** |
| 6463 * A flag indicating whether incremental analysis should be used for API | 6477 * A flag indicating whether incremental analysis should be used for API |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 6475 * A flag indicating whether analysis is to generate lint warnings. | 6489 * A flag indicating whether analysis is to generate lint warnings. |
| 6476 */ | 6490 */ |
| 6477 bool lint = false; | 6491 bool lint = false; |
| 6478 | 6492 |
| 6479 /** | 6493 /** |
| 6480 * A flag indicating whether analysis is to parse comments. | 6494 * A flag indicating whether analysis is to parse comments. |
| 6481 */ | 6495 */ |
| 6482 bool preserveComments = true; | 6496 bool preserveComments = true; |
| 6483 | 6497 |
| 6484 /** | 6498 /** |
| 6485 * Initialize a newly created set of analysis options to have their default va lues. | 6499 * Initialize a newly created set of analysis options to have their default |
| 6500 * values. | |
| 6486 */ | 6501 */ |
| 6487 AnalysisOptionsImpl(); | 6502 AnalysisOptionsImpl(); |
| 6488 | 6503 |
| 6489 /** | 6504 /** |
| 6490 * Initialize a newly created set of analysis options to have the same values as those in the | 6505 * Initialize a newly created set of analysis options to have the same values |
| 6491 * given set of analysis options. | 6506 * as those in the given set of analysis [options]. |
| 6492 * | |
| 6493 * @param options the analysis options whose values are being copied | |
| 6494 */ | 6507 */ |
| 6495 AnalysisOptionsImpl.con1(AnalysisOptions options) { | 6508 AnalysisOptionsImpl.con1(AnalysisOptions options) { |
| 6496 analyzeFunctionBodiesPredicate = options.analyzeFunctionBodiesPredicate; | 6509 analyzeFunctionBodiesPredicate = options.analyzeFunctionBodiesPredicate; |
| 6497 cacheSize = options.cacheSize; | 6510 cacheSize = options.cacheSize; |
| 6498 dart2jsHint = options.dart2jsHint; | 6511 dart2jsHint = options.dart2jsHint; |
| 6499 _generateSdkErrors = options.generateSdkErrors; | 6512 generateImplicitErrors = options.generateImplicitErrors; |
| 6513 generateSdkErrors = options.generateSdkErrors; | |
| 6500 hint = options.hint; | 6514 hint = options.hint; |
| 6501 incremental = options.incremental; | 6515 incremental = options.incremental; |
| 6502 incrementalApi = options.incrementalApi; | 6516 incrementalApi = options.incrementalApi; |
| 6503 incrementalValidation = options.incrementalValidation; | 6517 incrementalValidation = options.incrementalValidation; |
| 6504 lint = options.lint; | 6518 lint = options.lint; |
| 6505 preserveComments = options.preserveComments; | 6519 preserveComments = options.preserveComments; |
| 6506 } | 6520 } |
| 6507 | 6521 |
| 6508 bool get analyzeFunctionBodies { | 6522 bool get analyzeFunctionBodies { |
| 6509 if (identical(analyzeFunctionBodiesPredicate, _analyzeAllFunctionBodies)) { | 6523 if (identical(analyzeFunctionBodiesPredicate, _analyzeAllFunctionBodies)) { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 6555 | 6569 |
| 6556 @deprecated | 6570 @deprecated |
| 6557 @override | 6571 @override |
| 6558 bool get enableEnum => true; | 6572 bool get enableEnum => true; |
| 6559 | 6573 |
| 6560 @deprecated | 6574 @deprecated |
| 6561 void set enableEnum(bool enable) { | 6575 void set enableEnum(bool enable) { |
| 6562 // Enum support cannot be disabled | 6576 // Enum support cannot be disabled |
| 6563 } | 6577 } |
| 6564 | 6578 |
| 6565 @override | |
| 6566 bool get generateSdkErrors => _generateSdkErrors; | |
| 6567 | |
| 6568 /** | |
| 6569 * Set whether errors, warnings and hints should be generated for sources in t he SDK to match the | |
| 6570 * given value. | |
| 6571 * | |
| 6572 * @param generate `true` if errors, warnings and hints should be generated fo r sources in | |
| 6573 * the SDK | |
| 6574 */ | |
| 6575 void set generateSdkErrors(bool generate) { | |
| 6576 _generateSdkErrors = generate; | |
| 6577 } | |
| 6578 | |
| 6579 /** | 6579 /** |
| 6580 * Predicate used for [analyzeFunctionBodiesPredicate] when | 6580 * Predicate used for [analyzeFunctionBodiesPredicate] when |
| 6581 * [analyzeFunctionBodies] is set to `true`. | 6581 * [analyzeFunctionBodies] is set to `true`. |
| 6582 */ | 6582 */ |
| 6583 static bool _analyzeAllFunctionBodies(Source _) => true; | 6583 static bool _analyzeAllFunctionBodies(Source _) => true; |
| 6584 | 6584 |
| 6585 /** | 6585 /** |
| 6586 * Predicate used for [analyzeFunctionBodiesPredicate] when | 6586 * Predicate used for [analyzeFunctionBodiesPredicate] when |
| 6587 * [analyzeFunctionBodies] is set to `false`. | 6587 * [analyzeFunctionBodies] is set to `false`. |
| 6588 */ | 6588 */ |
| (...skipping 5571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 12160 visitElement(Element element) { | 12160 visitElement(Element element) { |
| 12161 if (element.id == _id) { | 12161 if (element.id == _id) { |
| 12162 result = element; | 12162 result = element; |
| 12163 throw new _ElementByIdFinderException(); | 12163 throw new _ElementByIdFinderException(); |
| 12164 } | 12164 } |
| 12165 super.visitElement(element); | 12165 super.visitElement(element); |
| 12166 } | 12166 } |
| 12167 } | 12167 } |
| 12168 | 12168 |
| 12169 class _ElementByIdFinderException {} | 12169 class _ElementByIdFinderException {} |
| OLD | NEW |