Chromium Code Reviews| 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 1709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1720 } | 1720 } |
| 1721 } catch (e) {} | 1721 } catch (e) {} |
| 1722 } | 1722 } |
| 1723 // We need to invalidate the cache. | 1723 // We need to invalidate the cache. |
| 1724 { | 1724 { |
| 1725 Object delta = null; | 1725 Object delta = null; |
| 1726 if (AnalysisEngine.instance.limitInvalidationInTaskModel && | 1726 if (AnalysisEngine.instance.limitInvalidationInTaskModel && |
| 1727 AnalysisEngine.isDartFileName(source.fullName)) { | 1727 AnalysisEngine.isDartFileName(source.fullName)) { |
| 1728 // TODO(scheglov) Incorrect implementation in general. | 1728 // TODO(scheglov) Incorrect implementation in general. |
| 1729 entry.setState(TOKEN_STREAM, CacheState.FLUSHED); | 1729 entry.setState(TOKEN_STREAM, CacheState.FLUSHED); |
| 1730 entry.setState(SCAN_ERRORS, CacheState.FLUSHED); | |
| 1731 entry.setState(PARSED_UNIT, CacheState.FLUSHED); | 1730 entry.setState(PARSED_UNIT, CacheState.FLUSHED); |
| 1732 entry.setState(PARSE_ERRORS, CacheState.FLUSHED); | 1731 List<Source> librarySources = getLibrariesContaining(source); |
| 1733 CompilationUnit oldUnit = getResolvedCompilationUnit2(source, source); | 1732 if (librarySources.length == 1) { |
| 1734 if (oldUnit != null) { | 1733 Source librarySource = librarySources[0]; |
| 1735 CompilationUnit newUnit = parseCompilationUnit(source); | 1734 CompilationUnit oldUnit = |
| 1736 IncrementalCompilationUnitElementBuilder builder = | 1735 getResolvedCompilationUnit2(source, librarySource); |
| 1737 new IncrementalCompilationUnitElementBuilder(oldUnit, newUnit); | 1736 if (oldUnit != null) { |
| 1738 builder.build(); | 1737 CompilationUnit newUnit = parseCompilationUnit(source); |
| 1739 CompilationUnitElementDelta unitDelta = builder.unitDelta; | 1738 IncrementalCompilationUnitElementBuilder builder = |
| 1740 DartDelta dartDelta = new DartDelta(source); | 1739 new IncrementalCompilationUnitElementBuilder(oldUnit, newUnit); |
| 1741 dartDelta.hasDirectiveChange = unitDelta.hasDirectiveChange; | 1740 builder.build(); |
| 1742 unitDelta.addedDeclarations.forEach(dartDelta.elementAdded); | 1741 CompilationUnitElementDelta unitDelta = builder.unitDelta; |
| 1743 unitDelta.removedDeclarations.forEach(dartDelta.elementRemoved); | 1742 if (!unitDelta.hasDirectiveChange) { |
| 1744 delta = dartDelta; | 1743 DartDelta dartDelta = new DartDelta(source); |
| 1744 dartDelta.hasDirectiveChange = unitDelta.hasDirectiveChange; | |
| 1745 unitDelta.addedDeclarations.forEach(dartDelta.elementAdded); | |
| 1746 unitDelta.removedDeclarations.forEach(dartDelta.elementRemoved); | |
| 1747 print( | |
|
Brian Wilkerson
2015/06/26 16:12:07
Remove or comment out debugging statement?
| |
| 1748 'dartDelta: add=${dartDelta.addedNames} remove=${dartDelta.rem ovedNames}'); | |
| 1749 delta = dartDelta; | |
| 1750 entry.setState(CONTENT, CacheState.INVALID, delta: delta); | |
| 1751 return; | |
| 1752 } | |
| 1753 } | |
| 1745 } | 1754 } |
| 1746 } | 1755 } |
| 1747 entry.setState(CONTENT, CacheState.INVALID, delta: delta); | 1756 entry.setState(CONTENT, CacheState.INVALID); |
| 1748 } | 1757 } |
| 1749 dartWorkManager.applyChange( | 1758 dartWorkManager.applyChange( |
| 1750 Source.EMPTY_LIST, <Source>[source], Source.EMPTY_LIST); | 1759 Source.EMPTY_LIST, <Source>[source], Source.EMPTY_LIST); |
| 1751 htmlWorkManager.applyChange( | 1760 htmlWorkManager.applyChange( |
| 1752 Source.EMPTY_LIST, <Source>[source], Source.EMPTY_LIST); | 1761 Source.EMPTY_LIST, <Source>[source], Source.EMPTY_LIST); |
| 1753 } | 1762 } |
| 1754 | 1763 |
| 1755 /** | 1764 /** |
| 1756 * Record that the give [source] has been deleted. | 1765 * Record that the give [source] has been deleted. |
| 1757 */ | 1766 */ |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2043 new PendingFuture<T>(_context, target, computeValue); | 2052 new PendingFuture<T>(_context, target, computeValue); |
| 2044 if (!pendingFuture.evaluate(entry)) { | 2053 if (!pendingFuture.evaluate(entry)) { |
| 2045 _context._pendingFutureTargets | 2054 _context._pendingFutureTargets |
| 2046 .putIfAbsent(target, () => <PendingFuture>[]) | 2055 .putIfAbsent(target, () => <PendingFuture>[]) |
| 2047 .add(pendingFuture); | 2056 .add(pendingFuture); |
| 2048 scheduleComputation(); | 2057 scheduleComputation(); |
| 2049 } | 2058 } |
| 2050 return pendingFuture.future; | 2059 return pendingFuture.future; |
| 2051 } | 2060 } |
| 2052 } | 2061 } |
| OLD | NEW |