OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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.context.context; | 5 library analyzer.src.context.context; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 | 9 |
10 import 'package:analyzer/dart/ast/ast.dart'; | 10 import 'package:analyzer/dart/ast/ast.dart'; |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 : false) || | 293 : false) || |
294 ((options is AnalysisOptionsImpl) | 294 ((options is AnalysisOptionsImpl) |
295 ? this._options.nonnullableTypes != options.nonnullableTypes | 295 ? this._options.nonnullableTypes != options.nonnullableTypes |
296 : false) || | 296 : false) || |
297 ((options is AnalysisOptionsImpl) | 297 ((options is AnalysisOptionsImpl) |
298 ? this._options.implicitDynamic != options.implicitDynamic | 298 ? this._options.implicitDynamic != options.implicitDynamic |
299 : false) || | 299 : false) || |
300 this._options.enableStrictCallChecks != | 300 this._options.enableStrictCallChecks != |
301 options.enableStrictCallChecks || | 301 options.enableStrictCallChecks || |
302 this._options.enableSuperMixins != options.enableSuperMixins || | 302 this._options.enableSuperMixins != options.enableSuperMixins || |
303 this._options.patchPlatform != options.patchPlatform; | 303 !_samePatchPaths(this._options.patchPaths, options.patchPaths); |
304 this._options.analyzeFunctionBodiesPredicate = | 304 this._options.analyzeFunctionBodiesPredicate = |
305 options.analyzeFunctionBodiesPredicate; | 305 options.analyzeFunctionBodiesPredicate; |
306 this._options.generateImplicitErrors = options.generateImplicitErrors; | 306 this._options.generateImplicitErrors = options.generateImplicitErrors; |
307 this._options.generateSdkErrors = options.generateSdkErrors; | 307 this._options.generateSdkErrors = options.generateSdkErrors; |
308 this._options.dart2jsHint = options.dart2jsHint; | 308 this._options.dart2jsHint = options.dart2jsHint; |
309 this._options.enableAssertInitializer = options.enableAssertInitializer; | 309 this._options.enableAssertInitializer = options.enableAssertInitializer; |
310 this._options.enableStrictCallChecks = options.enableStrictCallChecks; | 310 this._options.enableStrictCallChecks = options.enableStrictCallChecks; |
311 this._options.enableLazyAssignmentOperators = | 311 this._options.enableLazyAssignmentOperators = |
312 options.enableLazyAssignmentOperators; | 312 options.enableLazyAssignmentOperators; |
313 this._options.enableSuperMixins = options.enableSuperMixins; | 313 this._options.enableSuperMixins = options.enableSuperMixins; |
314 this._options.enableTiming = options.enableTiming; | 314 this._options.enableTiming = options.enableTiming; |
315 this._options.errorProcessors = options.errorProcessors; | 315 this._options.errorProcessors = options.errorProcessors; |
316 this._options.excludePatterns = options.excludePatterns; | 316 this._options.excludePatterns = options.excludePatterns; |
317 this._options.hint = options.hint; | 317 this._options.hint = options.hint; |
318 this._options.incremental = options.incremental; | 318 this._options.incremental = options.incremental; |
319 this._options.incrementalApi = options.incrementalApi; | 319 this._options.incrementalApi = options.incrementalApi; |
320 this._options.incrementalValidation = options.incrementalValidation; | 320 this._options.incrementalValidation = options.incrementalValidation; |
321 this._options.lint = options.lint; | 321 this._options.lint = options.lint; |
322 this._options.lintRules = options.lintRules; | 322 this._options.lintRules = options.lintRules; |
323 this._options.preserveComments = options.preserveComments; | 323 this._options.preserveComments = options.preserveComments; |
324 if (this._options.strongMode != options.strongMode) { | 324 if (this._options.strongMode != options.strongMode) { |
325 _typeSystem = null; | 325 _typeSystem = null; |
326 } | 326 } |
327 this._options.strongMode = options.strongMode; | 327 this._options.strongMode = options.strongMode; |
328 this._options.trackCacheDependencies = options.trackCacheDependencies; | 328 this._options.trackCacheDependencies = options.trackCacheDependencies; |
329 this._options.disableCacheFlushing = options.disableCacheFlushing; | 329 this._options.disableCacheFlushing = options.disableCacheFlushing; |
330 this._options.finerGrainedInvalidation = options.finerGrainedInvalidation; | 330 this._options.finerGrainedInvalidation = options.finerGrainedInvalidation; |
331 this._options.patchPlatform = options.patchPlatform; | 331 this._options.patchPaths = options.patchPaths; |
332 if (options is AnalysisOptionsImpl) { | 332 if (options is AnalysisOptionsImpl) { |
333 this._options.strongModeHints = options.strongModeHints; | 333 this._options.strongModeHints = options.strongModeHints; |
334 this._options.implicitCasts = options.implicitCasts; | 334 this._options.implicitCasts = options.implicitCasts; |
335 this._options.nonnullableTypes = options.nonnullableTypes; | 335 this._options.nonnullableTypes = options.nonnullableTypes; |
336 this._options.implicitDynamic = options.implicitDynamic; | 336 this._options.implicitDynamic = options.implicitDynamic; |
337 } | 337 } |
338 if (needsRecompute) { | 338 if (needsRecompute) { |
339 for (WorkManager workManager in workManagers) { | 339 for (WorkManager workManager in workManagers) { |
340 workManager.onAnalysisOptionsChanged(); | 340 workManager.onAnalysisOptionsChanged(); |
341 } | 341 } |
(...skipping 1617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1959 AnalysisErrorInfo errorInfo = getErrors(unitSource); | 1959 AnalysisErrorInfo errorInfo = getErrors(unitSource); |
1960 notice.setErrors(errorInfo.errors, errorInfo.lineInfo); | 1960 notice.setErrors(errorInfo.errors, errorInfo.lineInfo); |
1961 } | 1961 } |
1962 // schedule | 1962 // schedule |
1963 dartWorkManager.unitIncrementallyResolved(librarySource, unitSource); | 1963 dartWorkManager.unitIncrementallyResolved(librarySource, unitSource); |
1964 // OK | 1964 // OK |
1965 driver.reset(); | 1965 driver.reset(); |
1966 return true; | 1966 return true; |
1967 }); | 1967 }); |
1968 } | 1968 } |
| 1969 |
| 1970 static bool _samePatchPaths( |
| 1971 Map<String, List<String>> a, Map<String, List<String>> b) { |
| 1972 if (a.length != b.length) return false; |
| 1973 for (var key in a.keys) { |
| 1974 if (!b.containsKey(key)) return false; |
| 1975 var aValue = a[key]; |
| 1976 var bValue = b[key]; |
| 1977 if (aValue.length != bValue.length) return false; |
| 1978 for (var i = 0; i < aValue.length; i++) { |
| 1979 if (aValue[i] != bValue[i]) return false; |
| 1980 } |
| 1981 } |
| 1982 return true; |
| 1983 } |
1969 } | 1984 } |
1970 | 1985 |
1971 /** | 1986 /** |
1972 * A helper class used to create futures for [AnalysisContextImpl]. | 1987 * A helper class used to create futures for [AnalysisContextImpl]. |
1973 * Using a helper class allows us to preserve the generic parameter T. | 1988 * Using a helper class allows us to preserve the generic parameter T. |
1974 */ | 1989 */ |
1975 class AnalysisFutureHelper<T> { | 1990 class AnalysisFutureHelper<T> { |
1976 final AnalysisContextImpl _context; | 1991 final AnalysisContextImpl _context; |
1977 final AnalysisTarget _target; | 1992 final AnalysisTarget _target; |
1978 final ResultDescriptor<T> _descriptor; | 1993 final ResultDescriptor<T> _descriptor; |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2246 } | 2261 } |
2247 DartSdk sdk = factory.dartSdk; | 2262 DartSdk sdk = factory.dartSdk; |
2248 if (sdk == null) { | 2263 if (sdk == null) { |
2249 throw new ArgumentError( | 2264 throw new ArgumentError( |
2250 "The source factory for an SDK analysis context must have a DartUriRes
olver"); | 2265 "The source factory for an SDK analysis context must have a DartUriRes
olver"); |
2251 } | 2266 } |
2252 return new AnalysisCache( | 2267 return new AnalysisCache( |
2253 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); | 2268 <CachePartition>[AnalysisEngine.instance.partitionManager.forSdk(sdk)]); |
2254 } | 2269 } |
2255 } | 2270 } |
OLD | NEW |