Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(300)

Side by Side Diff: pkg/analyzer/lib/src/generated/engine.dart

Issue 1144023009: Adapt the existing incremental resolution implementation to the new model. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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:async'; 10 import 'dart:async';
(...skipping 694 matching lines...) Expand 10 before | Expand all | Expand 10 after
705 */ 705 */
706 ht.HtmlUnit getResolvedHtmlUnit(Source htmlSource); 706 ht.HtmlUnit getResolvedHtmlUnit(Source htmlSource);
707 707
708 /** 708 /**
709 * Return a list of the sources being analyzed in this context whose full path 709 * Return a list of the sources being analyzed in this context whose full path
710 * is equal to the given [path]. 710 * is equal to the given [path].
711 */ 711 */
712 List<Source> getSourcesWithFullName(String path); 712 List<Source> getSourcesWithFullName(String path);
713 713
714 /** 714 /**
715 * Invalidates hints in the given [librarySource] and included parts.
716 */
717 void invalidateLibraryHints(Source librarySource);
718
719 /**
715 * Return `true` if the given [librarySource] is known to be the defining 720 * Return `true` if the given [librarySource] is known to be the defining
716 * compilation unit of a library that can be run on a client (references 721 * compilation unit of a library that can be run on a client (references
717 * 'dart:html', either directly or indirectly). 722 * 'dart:html', either directly or indirectly).
718 * 723 *
719 * <b>Note:</b> In addition to the expected case of returning `false` if the 724 * <b>Note:</b> In addition to the expected case of returning `false` if the
720 * source is known to be a library that cannot be run on a client, this method 725 * source is known to be a library that cannot be run on a client, this method
721 * will also return `false` if the source is not known to be a library or if 726 * will also return `false` if the source is not known to be a library or if
722 * we do not know whether it can be run on a client. 727 * we do not know whether it can be run on a client.
723 */ 728 */
724 bool isClientLibrary(Source librarySource); 729 bool isClientLibrary(Source librarySource);
(...skipping 1422 matching lines...) Expand 10 before | Expand all | Expand 10 after
2147 _sourceChanged(source); 2152 _sourceChanged(source);
2148 } 2153 }
2149 } 2154 }
2150 if (notify && changed) { 2155 if (notify && changed) {
2151 _onSourcesChangedController 2156 _onSourcesChangedController
2152 .add(new SourcesChangedEvent.changedContent(source, newContents)); 2157 .add(new SourcesChangedEvent.changedContent(source, newContents));
2153 } 2158 }
2154 return changed; 2159 return changed;
2155 } 2160 }
2156 2161
2157 /** 2162 @override
2158 * Invalidates hints in the given [librarySource] and included parts.
2159 */
2160 void invalidateLibraryHints(Source librarySource) { 2163 void invalidateLibraryHints(Source librarySource) {
2161 SourceEntry sourceEntry = _cache.get(librarySource); 2164 SourceEntry sourceEntry = _cache.get(librarySource);
2162 if (sourceEntry is! DartEntry) { 2165 if (sourceEntry is! DartEntry) {
2163 return; 2166 return;
2164 } 2167 }
2165 DartEntry dartEntry = sourceEntry; 2168 DartEntry dartEntry = sourceEntry;
2166 // Prepare sources to invalidate hints in. 2169 // Prepare sources to invalidate hints in.
2167 List<Source> sources = <Source>[librarySource]; 2170 List<Source> sources = <Source>[librarySource];
2168 sources.addAll(dartEntry.getValue(DartEntry.INCLUDED_PARTS)); 2171 sources.addAll(dartEntry.getValue(DartEntry.INCLUDED_PARTS));
2169 // Invalidate hints. 2172 // Invalidate hints.
(...skipping 2475 matching lines...) Expand 10 before | Expand all | Expand 10 after
4645 } 4648 }
4646 // prepare the existing unit 4649 // prepare the existing unit
4647 CompilationUnit oldUnit = 4650 CompilationUnit oldUnit =
4648 getResolvedCompilationUnit2(unitSource, librarySource); 4651 getResolvedCompilationUnit2(unitSource, librarySource);
4649 if (oldUnit == null) { 4652 if (oldUnit == null) {
4650 return false; 4653 return false;
4651 } 4654 }
4652 // do resolution 4655 // do resolution
4653 Stopwatch perfCounter = new Stopwatch()..start(); 4656 Stopwatch perfCounter = new Stopwatch()..start();
4654 PoorMansIncrementalResolver resolver = new PoorMansIncrementalResolver( 4657 PoorMansIncrementalResolver resolver = new PoorMansIncrementalResolver(
4655 typeProvider, unitSource, dartEntry, oldUnit, 4658 typeProvider, unitSource, getReadableSourceEntryOrNull(unitSource),
4656 analysisOptions.incrementalApi, analysisOptions); 4659 null, null, oldUnit, analysisOptions.incrementalApi, analysisOptions);
4657 bool success = resolver.resolve(newCode); 4660 bool success = resolver.resolve(newCode);
4658 AnalysisEngine.instance.instrumentationService.logPerformance( 4661 AnalysisEngine.instance.instrumentationService.logPerformance(
4659 AnalysisPerformanceKind.INCREMENTAL, perfCounter, 4662 AnalysisPerformanceKind.INCREMENTAL, perfCounter,
4660 'success=$success,context_id=$_id,code_length=${newCode.length}'); 4663 'success=$success,context_id=$_id,code_length=${newCode.length}');
4661 if (!success) { 4664 if (!success) {
4662 return false; 4665 return false;
4663 } 4666 }
4664 // if validation, remember the result, but throw it away 4667 // if validation, remember the result, but throw it away
4665 if (analysisOptions.incrementalValidation) { 4668 if (analysisOptions.incrementalValidation) {
4666 incrementalResolutionValidation_lastUnitSource = oldUnit.element.source; 4669 incrementalResolutionValidation_lastUnitSource = oldUnit.element.source;
(...skipping 4332 matching lines...) Expand 10 before | Expand all | Expand 10 after
8999 cache.source, scanner.tokenMap, AnalysisErrorListener.NULL_LISTENER); 9002 cache.source, scanner.tokenMap, AnalysisErrorListener.NULL_LISTENER);
9000 _updatedUnit = parser.reparse(cache.resolvedUnit, scanner.leftToken, 9003 _updatedUnit = parser.reparse(cache.resolvedUnit, scanner.leftToken,
9001 scanner.rightToken, cache.offset, cache.offset + cache.oldLength); 9004 scanner.rightToken, cache.offset, cache.offset + cache.oldLength);
9002 // Update the resolution 9005 // Update the resolution
9003 TypeProvider typeProvider = this.typeProvider; 9006 TypeProvider typeProvider = this.typeProvider;
9004 if (_updatedUnit != null && typeProvider != null) { 9007 if (_updatedUnit != null && typeProvider != null) {
9005 CompilationUnitElement element = _updatedUnit.element; 9008 CompilationUnitElement element = _updatedUnit.element;
9006 if (element != null) { 9009 if (element != null) {
9007 LibraryElement library = element.library; 9010 LibraryElement library = element.library;
9008 if (library != null) { 9011 if (library != null) {
9009 IncrementalResolver resolver = new IncrementalResolver( 9012 IncrementalResolver resolver = new IncrementalResolver(null, null,
9010 element, cache.offset, cache.oldLength, cache.newLength); 9013 null, element, cache.offset, cache.oldLength, cache.newLength);
9011 resolver.resolve(parser.updatedNode); 9014 resolver.resolve(parser.updatedNode);
9012 } 9015 }
9013 } 9016 }
9014 } 9017 }
9015 } 9018 }
9016 } 9019 }
9017 9020
9018 /** 9021 /**
9019 * Additional behavior for an analysis context that is required by internal 9022 * Additional behavior for an analysis context that is required by internal
9020 * users of the context. 9023 * users of the context.
(...skipping 2670 matching lines...) Expand 10 before | Expand all | Expand 10 after
11691 PendingFuture pendingFuture = 11694 PendingFuture pendingFuture =
11692 new PendingFuture<T>(_context, source, computeValue); 11695 new PendingFuture<T>(_context, source, computeValue);
11693 if (!pendingFuture.evaluate(sourceEntry)) { 11696 if (!pendingFuture.evaluate(sourceEntry)) {
11694 _context._pendingFutureSources 11697 _context._pendingFutureSources
11695 .putIfAbsent(source, () => <PendingFuture>[]) 11698 .putIfAbsent(source, () => <PendingFuture>[])
11696 .add(pendingFuture); 11699 .add(pendingFuture);
11697 } 11700 }
11698 return pendingFuture.future; 11701 return pendingFuture.future;
11699 } 11702 }
11700 } 11703 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698