| 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; |
| 11 import 'dart:async'; | 11 import 'dart:async'; |
| 12 import 'dart:collection'; | 12 import 'dart:collection'; |
| 13 | 13 |
| 14 import 'package:analyzer/src/cancelable_future.dart'; | 14 import 'package:analyzer/src/cancelable_future.dart'; |
| 15 import 'package:analyzer/src/generated/incremental_resolution_validator.dart'; | 15 import 'package:analyzer/src/generated/incremental_resolution_validator.dart'; |
| 16 import 'package:analyzer/src/services/lint.dart'; | 16 import 'package:analyzer/src/services/lint.dart'; |
| 17 import 'package:analyzer/src/task/task_dart.dart'; | 17 import 'package:analyzer/src/task/task_dart.dart'; |
| 18 import 'package:analyzer/src/util/lru_map.dart'; | |
| 19 | 18 |
| 20 import '../../instrumentation/instrumentation.dart'; | 19 import '../../instrumentation/instrumentation.dart'; |
| 21 import 'ast.dart'; | 20 import 'ast.dart'; |
| 22 import 'constant.dart'; | 21 import 'constant.dart'; |
| 23 import 'element.dart'; | 22 import 'element.dart'; |
| 24 import 'error.dart'; | 23 import 'error.dart'; |
| 25 import 'error_verifier.dart'; | 24 import 'error_verifier.dart'; |
| 26 import 'html.dart' as ht; | 25 import 'html.dart' as ht; |
| 27 import 'incremental_resolver.dart' show IncrementalResolver, | 26 import 'incremental_resolver.dart' show IncrementalResolver, |
| 28 PoorMansIncrementalResolver; | 27 PoorMansIncrementalResolver; |
| (...skipping 935 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 964 * A flag indicating whether this context is disposed. | 963 * A flag indicating whether this context is disposed. |
| 965 */ | 964 */ |
| 966 bool _disposed = false; | 965 bool _disposed = false; |
| 967 | 966 |
| 968 /** | 967 /** |
| 969 * A cache of content used to override the default content of a source. | 968 * A cache of content used to override the default content of a source. |
| 970 */ | 969 */ |
| 971 ContentCache _contentCache = new ContentCache(); | 970 ContentCache _contentCache = new ContentCache(); |
| 972 | 971 |
| 973 /** | 972 /** |
| 974 * A cache of content used to override the default content of a source | |
| 975 * before the corresponding override was removed from [_contentCache]. | |
| 976 */ | |
| 977 LRUMap<Source, String> _prevOverlayCache = new LRUMap<Source, String>(5); | |
| 978 | |
| 979 /** | |
| 980 * The source factory used to create the sources that can be analyzed in this
context. | 973 * The source factory used to create the sources that can be analyzed in this
context. |
| 981 */ | 974 */ |
| 982 SourceFactory _sourceFactory; | 975 SourceFactory _sourceFactory; |
| 983 | 976 |
| 984 /** | 977 /** |
| 985 * The set of declared variables used when computing constant values. | 978 * The set of declared variables used when computing constant values. |
| 986 */ | 979 */ |
| 987 DeclaredVariables _declaredVariables = new DeclaredVariables(); | 980 DeclaredVariables _declaredVariables = new DeclaredVariables(); |
| 988 | 981 |
| 989 /** | 982 /** |
| (...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2239 } else if (originalContents != null) { | 2232 } else if (originalContents != null) { |
| 2240 _incrementalAnalysisCache = | 2233 _incrementalAnalysisCache = |
| 2241 IncrementalAnalysisCache.clear(_incrementalAnalysisCache, source); | 2234 IncrementalAnalysisCache.clear(_incrementalAnalysisCache, source); |
| 2242 changed = newContents != originalContents; | 2235 changed = newContents != originalContents; |
| 2243 // We are removing the overlay for the file, check if the file's | 2236 // We are removing the overlay for the file, check if the file's |
| 2244 // contents is the same as it was in the overlay. | 2237 // contents is the same as it was in the overlay. |
| 2245 try { | 2238 try { |
| 2246 TimestampedData<String> fileContents = getContents(source); | 2239 TimestampedData<String> fileContents = getContents(source); |
| 2247 String fileContentsData = fileContents.data; | 2240 String fileContentsData = fileContents.data; |
| 2248 if (fileContentsData == originalContents) { | 2241 if (fileContentsData == originalContents) { |
| 2249 _prevOverlayCache.put(source, fileContentsData); | 2242 sourceEntry.setValue(SourceEntry.CONTENT, fileContentsData); |
| 2250 sourceEntry.modificationTime = fileContents.modificationTime; | 2243 sourceEntry.modificationTime = fileContents.modificationTime; |
| 2251 changed = false; | 2244 changed = false; |
| 2252 } | 2245 } |
| 2253 } catch (e) { | 2246 } catch (e) { |
| 2254 } | 2247 } |
| 2255 // If not the same content (e.g. the file is being closed without save), | 2248 // If not the same content (e.g. the file is being closed without save), |
| 2256 // then force analysis. | 2249 // then force analysis. |
| 2257 if (changed) { | 2250 if (changed) { |
| 2258 _sourceChanged(source); | 2251 _sourceChanged(source); |
| 2259 } | 2252 } |
| (...skipping 2752 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5012 * <b>Note:</b> This method must only be invoked while we are synchronized on | 5005 * <b>Note:</b> This method must only be invoked while we are synchronized on |
| 5013 * [cacheLock]. | 5006 * [cacheLock]. |
| 5014 */ | 5007 */ |
| 5015 void _sourceChanged(Source source) { | 5008 void _sourceChanged(Source source) { |
| 5016 SourceEntry sourceEntry = _cache.get(source); | 5009 SourceEntry sourceEntry = _cache.get(source); |
| 5017 // If the source is removed, we don't care about it. | 5010 // If the source is removed, we don't care about it. |
| 5018 if (sourceEntry == null) { | 5011 if (sourceEntry == null) { |
| 5019 return; | 5012 return; |
| 5020 } | 5013 } |
| 5021 // Check if the content of the source is the same as it was the last time. | 5014 // Check if the content of the source is the same as it was the last time. |
| 5022 String sourceContent = _prevOverlayCache.get(source); | 5015 String sourceContent = sourceEntry.getValue(SourceEntry.CONTENT); |
| 5023 if (sourceContent != null) { | 5016 if (sourceContent != null) { |
| 5017 sourceEntry.setState(SourceEntry.CONTENT, CacheState.FLUSHED); |
| 5024 try { | 5018 try { |
| 5025 TimestampedData<String> fileContents = getContents(source); | 5019 TimestampedData<String> fileContents = getContents(source); |
| 5026 if (fileContents.data == sourceContent) { | 5020 if (fileContents.data == sourceContent) { |
| 5027 return; | 5021 return; |
| 5028 } | 5022 } |
| 5029 } catch (e) { | 5023 } catch (e) { |
| 5030 } | 5024 } |
| 5031 } | 5025 } |
| 5032 // We have to invalidate the cache. | 5026 // We have to invalidate the cache. |
| 5033 _propagateInvalidation(source, sourceEntry); | 5027 _propagateInvalidation(source, sourceEntry); |
| (...skipping 7465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12499 if (element.id == _id) { | 12493 if (element.id == _id) { |
| 12500 result = element; | 12494 result = element; |
| 12501 throw new _ElementByIdFinderException(); | 12495 throw new _ElementByIdFinderException(); |
| 12502 } | 12496 } |
| 12503 super.visitElement(element); | 12497 super.visitElement(element); |
| 12504 } | 12498 } |
| 12505 } | 12499 } |
| 12506 | 12500 |
| 12507 class _ElementByIdFinderException { | 12501 class _ElementByIdFinderException { |
| 12508 } | 12502 } |
| OLD | NEW |