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/instrumentation/instrumentation.dart'; | 10 import 'package:analyzer/instrumentation/instrumentation.dart'; |
(...skipping 1374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1385 * [newLength] information is used by the context to determine what reanalysis | 1385 * [newLength] information is used by the context to determine what reanalysis |
1386 * is necessary. The method [setChangedContents] triggers a source changed | 1386 * is necessary. The method [setChangedContents] triggers a source changed |
1387 * event where as this method does not. | 1387 * event where as this method does not. |
1388 */ | 1388 */ |
1389 bool _contentRangeChanged(Source source, String contents, int offset, | 1389 bool _contentRangeChanged(Source source, String contents, int offset, |
1390 int oldLength, int newLength) { | 1390 int oldLength, int newLength) { |
1391 bool changed = false; | 1391 bool changed = false; |
1392 String originalContents = _contentCache.setContents(source, contents); | 1392 String originalContents = _contentCache.setContents(source, contents); |
1393 if (contents != null) { | 1393 if (contents != null) { |
1394 if (contents != originalContents) { | 1394 if (contents != originalContents) { |
1395 // TODO(brianwilkerson) Find a better way to do incremental analysis. | |
1396 // if (_options.incremental) { | |
1397 // _incrementalAnalysisCache = IncrementalAnalysisCache.update( | |
1398 // _incrementalAnalysisCache, source, originalContents, contents, | |
1399 // offset, oldLength, newLength, _cache.get(source)); | |
1400 // } | |
1401 _sourceChanged(source); | 1395 _sourceChanged(source); |
1402 changed = true; | 1396 changed = true; |
1403 CacheEntry entry = _cache.get(source); | 1397 CacheEntry entry = _cache.get(source); |
1404 if (entry != null) { | 1398 if (entry != null) { |
1405 entry.modificationTime = _contentCache.getModificationStamp(source); | 1399 entry.modificationTime = _contentCache.getModificationStamp(source); |
1406 entry.setValue(CONTENT, contents, TargetedResult.EMPTY_LIST); | 1400 entry.setValue(CONTENT, contents, TargetedResult.EMPTY_LIST); |
1407 } | 1401 } |
1408 } | 1402 } |
1409 } else if (originalContents != null) { | 1403 } else if (originalContents != null) { |
1410 _sourceChanged(source); | 1404 _sourceChanged(source); |
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2033 new PendingFuture<T>(_context, target, computeValue); | 2027 new PendingFuture<T>(_context, target, computeValue); |
2034 if (!pendingFuture.evaluate(entry)) { | 2028 if (!pendingFuture.evaluate(entry)) { |
2035 _context._pendingFutureTargets | 2029 _context._pendingFutureTargets |
2036 .putIfAbsent(target, () => <PendingFuture>[]) | 2030 .putIfAbsent(target, () => <PendingFuture>[]) |
2037 .add(pendingFuture); | 2031 .add(pendingFuture); |
2038 scheduleComputation(); | 2032 scheduleComputation(); |
2039 } | 2033 } |
2040 return pendingFuture.future; | 2034 return pendingFuture.future; |
2041 } | 2035 } |
2042 } | 2036 } |
OLD | NEW |