| 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 engine; | 5 library engine; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 import 'dart:math' as math; | 9 import 'dart:math' as math; |
| 10 | 10 |
| (...skipping 1152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1163 void set analysisOptions(AnalysisOptions options) { | 1163 void set analysisOptions(AnalysisOptions options) { |
| 1164 bool needsRecompute = this._options.analyzeFunctionBodiesPredicate != | 1164 bool needsRecompute = this._options.analyzeFunctionBodiesPredicate != |
| 1165 options.analyzeFunctionBodiesPredicate || | 1165 options.analyzeFunctionBodiesPredicate || |
| 1166 this._options.generateImplicitErrors != | 1166 this._options.generateImplicitErrors != |
| 1167 options.generateImplicitErrors || | 1167 options.generateImplicitErrors || |
| 1168 this._options.generateSdkErrors != options.generateSdkErrors || | 1168 this._options.generateSdkErrors != options.generateSdkErrors || |
| 1169 this._options.dart2jsHint != options.dart2jsHint || | 1169 this._options.dart2jsHint != options.dart2jsHint || |
| 1170 (this._options.hint && !options.hint) || | 1170 (this._options.hint && !options.hint) || |
| 1171 this._options.preserveComments != options.preserveComments || | 1171 this._options.preserveComments != options.preserveComments || |
| 1172 this._options.strongMode != options.strongMode || | 1172 this._options.strongMode != options.strongMode || |
| 1173 ((options is AnalysisOptionsImpl) |
| 1174 ? this._options.strongModeHints != options.strongModeHints |
| 1175 : false) || |
| 1173 this._options.enableStrictCallChecks != | 1176 this._options.enableStrictCallChecks != |
| 1174 options.enableStrictCallChecks || | 1177 options.enableStrictCallChecks || |
| 1175 this._options.enableSuperMixins != options.enableSuperMixins; | 1178 this._options.enableSuperMixins != options.enableSuperMixins; |
| 1176 int cacheSize = options.cacheSize; | 1179 int cacheSize = options.cacheSize; |
| 1177 if (this._options.cacheSize != cacheSize) { | 1180 if (this._options.cacheSize != cacheSize) { |
| 1178 this._options.cacheSize = cacheSize; | 1181 this._options.cacheSize = cacheSize; |
| 1179 //cache.setMaxCacheSize(cacheSize); | 1182 //cache.setMaxCacheSize(cacheSize); |
| 1180 _privatePartition.maxCacheSize = cacheSize; | 1183 _privatePartition.maxCacheSize = cacheSize; |
| 1181 // | 1184 // |
| 1182 // Cap the size of the priority list to being less than the cache size. | 1185 // Cap the size of the priority list to being less than the cache size. |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1199 this._options.dart2jsHint = options.dart2jsHint; | 1202 this._options.dart2jsHint = options.dart2jsHint; |
| 1200 this._options.enableStrictCallChecks = options.enableStrictCallChecks; | 1203 this._options.enableStrictCallChecks = options.enableStrictCallChecks; |
| 1201 this._options.enableSuperMixins = options.enableSuperMixins; | 1204 this._options.enableSuperMixins = options.enableSuperMixins; |
| 1202 this._options.hint = options.hint; | 1205 this._options.hint = options.hint; |
| 1203 this._options.incremental = options.incremental; | 1206 this._options.incremental = options.incremental; |
| 1204 this._options.incrementalApi = options.incrementalApi; | 1207 this._options.incrementalApi = options.incrementalApi; |
| 1205 this._options.incrementalValidation = options.incrementalValidation; | 1208 this._options.incrementalValidation = options.incrementalValidation; |
| 1206 this._options.lint = options.lint; | 1209 this._options.lint = options.lint; |
| 1207 this._options.preserveComments = options.preserveComments; | 1210 this._options.preserveComments = options.preserveComments; |
| 1208 this._options.strongMode = options.strongMode; | 1211 this._options.strongMode = options.strongMode; |
| 1212 if (options is AnalysisOptionsImpl) { |
| 1213 this._options.strongModeHints = options.strongModeHints; |
| 1214 } |
| 1209 _generateImplicitErrors = options.generateImplicitErrors; | 1215 _generateImplicitErrors = options.generateImplicitErrors; |
| 1210 _generateSdkErrors = options.generateSdkErrors; | 1216 _generateSdkErrors = options.generateSdkErrors; |
| 1211 if (needsRecompute) { | 1217 if (needsRecompute) { |
| 1212 _invalidateAllLocalResolutionInformation(false); | 1218 _invalidateAllLocalResolutionInformation(false); |
| 1213 } | 1219 } |
| 1214 } | 1220 } |
| 1215 | 1221 |
| 1216 @override | 1222 @override |
| 1217 void set analysisPriorityOrder(List<Source> sources) { | 1223 void set analysisPriorityOrder(List<Source> sources) { |
| 1218 if (sources == null || sources.isEmpty) { | 1224 if (sources == null || sources.isEmpty) { |
| (...skipping 5236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6455 * A flag indicating whether analysis is to parse comments. | 6461 * A flag indicating whether analysis is to parse comments. |
| 6456 */ | 6462 */ |
| 6457 bool preserveComments = true; | 6463 bool preserveComments = true; |
| 6458 | 6464 |
| 6459 /** | 6465 /** |
| 6460 * A flag indicating whether strong-mode analysis should be used. | 6466 * A flag indicating whether strong-mode analysis should be used. |
| 6461 */ | 6467 */ |
| 6462 bool strongMode = false; | 6468 bool strongMode = false; |
| 6463 | 6469 |
| 6464 /** | 6470 /** |
| 6471 * A flag indicating whether strong-mode inference hints should be |
| 6472 * used. This flag is not exposed in the interface, and should be |
| 6473 * replaced by something more general. |
| 6474 */ |
| 6475 // TODO(leafp): replace this with something more general |
| 6476 bool strongModeHints = false; |
| 6477 |
| 6478 /** |
| 6465 * Initialize a newly created set of analysis options to have their default | 6479 * Initialize a newly created set of analysis options to have their default |
| 6466 * values. | 6480 * values. |
| 6467 */ | 6481 */ |
| 6468 AnalysisOptionsImpl(); | 6482 AnalysisOptionsImpl(); |
| 6469 | 6483 |
| 6470 /** | 6484 /** |
| 6471 * Initialize a newly created set of analysis options to have the same values | 6485 * Initialize a newly created set of analysis options to have the same values |
| 6472 * as those in the given set of analysis [options]. | 6486 * as those in the given set of analysis [options]. |
| 6473 */ | 6487 */ |
| 6474 @deprecated // Use new AnalysisOptionsImpl.from(options) | 6488 @deprecated // Use new AnalysisOptionsImpl.from(options) |
| 6475 AnalysisOptionsImpl.con1(AnalysisOptions options) { | 6489 AnalysisOptionsImpl.con1(AnalysisOptions options) { |
| 6476 analyzeFunctionBodiesPredicate = options.analyzeFunctionBodiesPredicate; | 6490 analyzeFunctionBodiesPredicate = options.analyzeFunctionBodiesPredicate; |
| 6477 cacheSize = options.cacheSize; | 6491 cacheSize = options.cacheSize; |
| 6478 dart2jsHint = options.dart2jsHint; | 6492 dart2jsHint = options.dart2jsHint; |
| 6479 enableStrictCallChecks = options.enableStrictCallChecks; | 6493 enableStrictCallChecks = options.enableStrictCallChecks; |
| 6480 enableGenericMethods = options.enableGenericMethods; | 6494 enableGenericMethods = options.enableGenericMethods; |
| 6481 enableSuperMixins = options.enableSuperMixins; | 6495 enableSuperMixins = options.enableSuperMixins; |
| 6482 generateImplicitErrors = options.generateImplicitErrors; | 6496 generateImplicitErrors = options.generateImplicitErrors; |
| 6483 generateSdkErrors = options.generateSdkErrors; | 6497 generateSdkErrors = options.generateSdkErrors; |
| 6484 hint = options.hint; | 6498 hint = options.hint; |
| 6485 incremental = options.incremental; | 6499 incremental = options.incremental; |
| 6486 incrementalApi = options.incrementalApi; | 6500 incrementalApi = options.incrementalApi; |
| 6487 incrementalValidation = options.incrementalValidation; | 6501 incrementalValidation = options.incrementalValidation; |
| 6488 lint = options.lint; | 6502 lint = options.lint; |
| 6489 preserveComments = options.preserveComments; | 6503 preserveComments = options.preserveComments; |
| 6490 strongMode = options.strongMode; | 6504 strongMode = options.strongMode; |
| 6505 if (options is AnalysisOptionsImpl) { |
| 6506 strongModeHints = options.strongModeHints; |
| 6507 } |
| 6491 } | 6508 } |
| 6492 | 6509 |
| 6493 /** | 6510 /** |
| 6494 * Initialize a newly created set of analysis options to have the same values | 6511 * Initialize a newly created set of analysis options to have the same values |
| 6495 * as those in the given set of analysis [options]. | 6512 * as those in the given set of analysis [options]. |
| 6496 */ | 6513 */ |
| 6497 AnalysisOptionsImpl.from(AnalysisOptions options) { | 6514 AnalysisOptionsImpl.from(AnalysisOptions options) { |
| 6498 analyzeFunctionBodiesPredicate = options.analyzeFunctionBodiesPredicate; | 6515 analyzeFunctionBodiesPredicate = options.analyzeFunctionBodiesPredicate; |
| 6499 cacheSize = options.cacheSize; | 6516 cacheSize = options.cacheSize; |
| 6500 dart2jsHint = options.dart2jsHint; | 6517 dart2jsHint = options.dart2jsHint; |
| 6501 enableStrictCallChecks = options.enableStrictCallChecks; | 6518 enableStrictCallChecks = options.enableStrictCallChecks; |
| 6502 enableGenericMethods = options.enableGenericMethods; | 6519 enableGenericMethods = options.enableGenericMethods; |
| 6503 enableSuperMixins = options.enableSuperMixins; | 6520 enableSuperMixins = options.enableSuperMixins; |
| 6504 generateImplicitErrors = options.generateImplicitErrors; | 6521 generateImplicitErrors = options.generateImplicitErrors; |
| 6505 generateSdkErrors = options.generateSdkErrors; | 6522 generateSdkErrors = options.generateSdkErrors; |
| 6506 hint = options.hint; | 6523 hint = options.hint; |
| 6507 incremental = options.incremental; | 6524 incremental = options.incremental; |
| 6508 incrementalApi = options.incrementalApi; | 6525 incrementalApi = options.incrementalApi; |
| 6509 incrementalValidation = options.incrementalValidation; | 6526 incrementalValidation = options.incrementalValidation; |
| 6510 lint = options.lint; | 6527 lint = options.lint; |
| 6511 preserveComments = options.preserveComments; | 6528 preserveComments = options.preserveComments; |
| 6512 strongMode = options.strongMode; | 6529 strongMode = options.strongMode; |
| 6530 if (options is AnalysisOptionsImpl) { |
| 6531 strongModeHints = options.strongModeHints; |
| 6532 } |
| 6513 } | 6533 } |
| 6514 | 6534 |
| 6515 bool get analyzeFunctionBodies { | 6535 bool get analyzeFunctionBodies { |
| 6516 if (identical(analyzeFunctionBodiesPredicate, _analyzeAllFunctionBodies)) { | 6536 if (identical(analyzeFunctionBodiesPredicate, _analyzeAllFunctionBodies)) { |
| 6517 return true; | 6537 return true; |
| 6518 } else if (identical( | 6538 } else if (identical( |
| 6519 analyzeFunctionBodiesPredicate, _analyzeNoFunctionBodies)) { | 6539 analyzeFunctionBodiesPredicate, _analyzeNoFunctionBodies)) { |
| 6520 return false; | 6540 return false; |
| 6521 } else { | 6541 } else { |
| 6522 throw new StateError('analyzeFunctionBodiesPredicate in use'); | 6542 throw new StateError('analyzeFunctionBodiesPredicate in use'); |
| (...skipping 5613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12136 PendingFuture pendingFuture = | 12156 PendingFuture pendingFuture = |
| 12137 new PendingFuture<T>(_context, source, computeValue); | 12157 new PendingFuture<T>(_context, source, computeValue); |
| 12138 if (!pendingFuture.evaluate(sourceEntry)) { | 12158 if (!pendingFuture.evaluate(sourceEntry)) { |
| 12139 _context._pendingFutureSources | 12159 _context._pendingFutureSources |
| 12140 .putIfAbsent(source, () => <PendingFuture>[]) | 12160 .putIfAbsent(source, () => <PendingFuture>[]) |
| 12141 .add(pendingFuture); | 12161 .add(pendingFuture); |
| 12142 } | 12162 } |
| 12143 return pendingFuture.future; | 12163 return pendingFuture.future; |
| 12144 } | 12164 } |
| 12145 } | 12165 } |
| OLD | NEW |