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

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

Issue 742103003: Update 'nameOffset' for elements during incremental analysis. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | Annotate | Revision Log
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:math" as math; 10 import "dart:math" as math;
(...skipping 2289 matching lines...) Expand 10 before | Expand all | Expand 10 after
2300 computeHtmlElement(htmlSource); 2300 computeHtmlElement(htmlSource);
2301 return parseHtmlUnit(htmlSource); 2301 return parseHtmlUnit(htmlSource);
2302 } 2302 }
2303 2303
2304 @override 2304 @override
2305 void setChangedContents(Source source, String contents, int offset, 2305 void setChangedContents(Source source, String contents, int offset,
2306 int oldLength, int newLength) { 2306 int oldLength, int newLength) {
2307 if (_contentRangeChanged(source, contents, offset, oldLength, newLength)) { 2307 if (_contentRangeChanged(source, contents, offset, oldLength, newLength)) {
2308 _onSourcesChangedController.add( 2308 _onSourcesChangedController.add(
2309 new SourcesChangedEvent.changedRange( 2309 new SourcesChangedEvent.changedRange(
2310 source, contents, offset, oldLength, newLength)); 2310 source,
2311 contents,
2312 offset,
2313 oldLength,
2314 newLength));
2311 } 2315 }
2312 } 2316 }
2313 2317
2314 @override 2318 @override
2315 void setContents(Source source, String contents) { 2319 void setContents(Source source, String contents) {
2316 if (_contentsChanged(source, contents)) { 2320 if (_contentsChanged(source, contents)) {
2317 _onSourcesChangedController.add( 2321 _onSourcesChangedController.add(
2318 new SourcesChangedEvent.changedContent(source, contents)); 2322 new SourcesChangedEvent.changedContent(source, contents));
2319 } 2323 }
2320 } 2324 }
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
2855 * changed. The additional offset and length information is used by the contex t to determine what 2859 * changed. The additional offset and length information is used by the contex t to determine what
2856 * reanalysis is necessary. [setChangedContents] triggers a source changed eve nt 2860 * reanalysis is necessary. [setChangedContents] triggers a source changed eve nt
2857 * where as this method does not. 2861 * where as this method does not.
2858 * 2862 *
2859 * @param source the source whose contents are being overridden 2863 * @param source the source whose contents are being overridden
2860 * @param contents the text to replace the range in the current contents 2864 * @param contents the text to replace the range in the current contents
2861 * @param offset the offset into the current contents 2865 * @param offset the offset into the current contents
2862 * @param oldLength the number of characters in the original contents that wer e replaced 2866 * @param oldLength the number of characters in the original contents that wer e replaced
2863 * @param newLength the number of characters in the replacement text 2867 * @param newLength the number of characters in the replacement text
2864 */ 2868 */
2865 bool _contentRangeChanged(Source source, String contents, int offset, int oldL ength, int newLength) { 2869 bool _contentRangeChanged(Source source, String contents, int offset,
2870 int oldLength, int newLength) {
2866 bool changed = false; 2871 bool changed = false;
2867 String originalContents = _contentCache.setContents(source, contents); 2872 String originalContents = _contentCache.setContents(source, contents);
2868 if (contents != null) { 2873 if (contents != null) {
2869 if (contents != originalContents) { 2874 if (contents != originalContents) {
2870 if (_options.incremental) { 2875 if (_options.incremental) {
2871 _incrementalAnalysisCache = IncrementalAnalysisCache.update(_increment alAnalysisCache, source, originalContents, contents, offset, oldLength, newLengt h, _getReadableSourceEntry(source)); 2876 _incrementalAnalysisCache = IncrementalAnalysisCache.update(
2877 _incrementalAnalysisCache,
2878 source,
2879 originalContents,
2880 contents,
2881 offset,
2882 oldLength,
2883 newLength,
2884 _getReadableSourceEntry(source));
2872 } 2885 }
2873 _sourceChanged(source); 2886 _sourceChanged(source);
2874 changed = true; 2887 changed = true;
2875 SourceEntry sourceEntry = _cache.get(source); 2888 SourceEntry sourceEntry = _cache.get(source);
2876 if (sourceEntry != null) { 2889 if (sourceEntry != null) {
2877 sourceEntry.modificationTime = _contentCache.getModificationStamp(sour ce); 2890 sourceEntry.modificationTime =
2891 _contentCache.getModificationStamp(source);
2878 sourceEntry.setValue(SourceEntry.CONTENT, contents); 2892 sourceEntry.setValue(SourceEntry.CONTENT, contents);
2879 } 2893 }
2880 } 2894 }
2881 } else if (originalContents != null) { 2895 } else if (originalContents != null) {
2882 _incrementalAnalysisCache = IncrementalAnalysisCache.clear(_incrementalAna lysisCache, source); 2896 _incrementalAnalysisCache =
2897 IncrementalAnalysisCache.clear(_incrementalAnalysisCache, source);
2883 _sourceChanged(source); 2898 _sourceChanged(source);
2884 changed = true; 2899 changed = true;
2885 } 2900 }
2886 return changed; 2901 return changed;
2887 } 2902 }
2888 2903
2889 /** 2904 /**
2890 * Set the contents of the given source to the given contents and mark the sou rce as having 2905 * Set the contents of the given source to the given contents and mark the sou rce as having
2891 * changed. This has the effect of overriding the default contents of the sour ce. If the contents 2906 * changed. This has the effect of overriding the default contents of the sour ce. If the contents
2892 * are `null` the override is removed so that the default contents will be ret urned. 2907 * are `null` the override is removed so that the default contents will be ret urned.
2893 * [setContents] triggers a source changed event where as this method does not . 2908 * [setContents] triggers a source changed event where as this method does not .
2894 * 2909 *
2895 * @param source the source whose contents are being overridden 2910 * @param source the source whose contents are being overridden
2896 * @param contents the new contents of the source 2911 * @param contents the new contents of the source
2897 */ 2912 */
2898 bool _contentsChanged(Source source, String contents) { 2913 bool _contentsChanged(Source source, String contents) {
2899 bool changed = false; 2914 bool changed = false;
2900 String originalContents = _contentCache.setContents(source, contents); 2915 String originalContents = _contentCache.setContents(source, contents);
2901 if (contents != null) { 2916 if (contents != null) {
2902 if (contents != originalContents) { 2917 if (contents != originalContents) {
2903 _incrementalAnalysisCache = IncrementalAnalysisCache.clear(_incrementalA nalysisCache, source); 2918 _incrementalAnalysisCache =
2919 IncrementalAnalysisCache.clear(_incrementalAnalysisCache, source);
2904 _sourceChanged(source); 2920 _sourceChanged(source);
2905 changed = true; 2921 changed = true;
2906 SourceEntry sourceEntry = _cache.get(source); 2922 SourceEntry sourceEntry = _cache.get(source);
2907 if (sourceEntry != null) { 2923 if (sourceEntry != null) {
2908 sourceEntry.modificationTime = _contentCache.getModificationStamp(sour ce); 2924 sourceEntry.modificationTime =
2925 _contentCache.getModificationStamp(source);
2909 sourceEntry.setValue(SourceEntry.CONTENT, contents); 2926 sourceEntry.setValue(SourceEntry.CONTENT, contents);
2910 } 2927 }
2911 } 2928 }
2912 } else if (originalContents != null) { 2929 } else if (originalContents != null) {
2913 _incrementalAnalysisCache = IncrementalAnalysisCache.clear(_incrementalAna lysisCache, source); 2930 _incrementalAnalysisCache =
2931 IncrementalAnalysisCache.clear(_incrementalAnalysisCache, source);
2914 _sourceChanged(source); 2932 _sourceChanged(source);
2915 changed = true; 2933 changed = true;
2916 } 2934 }
2917 return changed; 2935 return changed;
2918 } 2936 }
2919 2937
2920 // /** 2938 // /**
2921 // * Create a [BuildUnitElementTask] for the given [source]. 2939 // * Create a [BuildUnitElementTask] for the given [source].
2922 // */ 2940 // */
2923 // AnalysisContextImpl_TaskData _createBuildUnitElementTask(Source source, 2941 // AnalysisContextImpl_TaskData _createBuildUnitElementTask(Source source,
(...skipping 7489 matching lines...) Expand 10 before | Expand all | Expand 10 after
10413 scanner.rightToken, 10431 scanner.rightToken,
10414 cache.offset, 10432 cache.offset,
10415 cache.offset + cache.oldLength); 10433 cache.offset + cache.oldLength);
10416 // Update the resolution 10434 // Update the resolution
10417 TypeProvider typeProvider = this.typeProvider; 10435 TypeProvider typeProvider = this.typeProvider;
10418 if (_updatedUnit != null && typeProvider != null) { 10436 if (_updatedUnit != null && typeProvider != null) {
10419 CompilationUnitElement element = _updatedUnit.element; 10437 CompilationUnitElement element = _updatedUnit.element;
10420 if (element != null) { 10438 if (element != null) {
10421 LibraryElement library = element.library; 10439 LibraryElement library = element.library;
10422 if (library != null) { 10440 if (library != null) {
10423 IncrementalResolver resolver = 10441 IncrementalResolver resolver = new IncrementalResolver(
10424 new IncrementalResolver(library, cache.source, typeProvider, error Listener); 10442 errorListener,
10443 typeProvider,
10444 library,
10445 element,
10446 cache.source,
10447 cache.offset,
10448 cache.oldLength,
10449 cache.newLength);
10425 resolver.resolve(parser.updatedNode); 10450 resolver.resolve(parser.updatedNode);
10426 } 10451 }
10427 } 10452 }
10428 } 10453 }
10429 } 10454 }
10430 } 10455 }
10431 10456
10432 /** 10457 /**
10433 * Instances of the class `InstrumentedAnalysisContextImpl` implement an 10458 * Instances of the class `InstrumentedAnalysisContextImpl` implement an
10434 * [AnalysisContext] by recording instrumentation data and delegating to 10459 * [AnalysisContext] by recording instrumentation data and delegating to
(...skipping 4068 matching lines...) Expand 10 before | Expand all | Expand 10 after
14503 } 14528 }
14504 14529
14505 /** 14530 /**
14506 * Return `true` if any sources were added. 14531 * Return `true` if any sources were added.
14507 */ 14532 */
14508 bool get wereSourcesAdded => _changeSet.addedSources.length > 0; 14533 bool get wereSourcesAdded => _changeSet.addedSources.length > 0;
14509 14534
14510 /** 14535 /**
14511 * Return `true` if any sources were removed or deleted. 14536 * Return `true` if any sources were removed or deleted.
14512 */ 14537 */
14513 bool get wereSourcesRemovedOrDeleted => _changeSet.removedSources.length > 0 14538 bool get wereSourcesRemovedOrDeleted =>
14514 || _changeSet.removedContainers.length > 0 14539 _changeSet.removedSources.length > 0 ||
14515 || _changeSet.deletedSources.length > 0; 14540 _changeSet.removedContainers.length > 0 ||
14541 _changeSet.deletedSources.length > 0;
14516 } 14542 }
14517 14543
14518 /** 14544 /**
14519 * Instances of the class `TimestampedData` represent analysis data for which we have a 14545 * Instances of the class `TimestampedData` represent analysis data for which we have a
14520 * modification time. 14546 * modification time.
14521 */ 14547 */
14522 class TimestampedData<E> { 14548 class TimestampedData<E> {
14523 /** 14549 /**
14524 * The modification time of the source from which the data was created. 14550 * The modification time of the source from which the data was created.
14525 */ 14551 */
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
14806 14832
14807 @override 14833 @override
14808 Object visitPolymerTagDartElement(PolymerTagDartElement element) { 14834 Object visitPolymerTagDartElement(PolymerTagDartElement element) {
14809 if (element.name == PolymerHtmlUnitBuilder_this._elementName) { 14835 if (element.name == PolymerHtmlUnitBuilder_this._elementName) {
14810 throw new PolymerHtmlUnitBuilder_FoundTagDartElementError( 14836 throw new PolymerHtmlUnitBuilder_FoundTagDartElementError(
14811 element as PolymerTagDartElementImpl); 14837 element as PolymerTagDartElementImpl);
14812 } 14838 }
14813 return null; 14839 return null;
14814 } 14840 }
14815 } 14841 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/element.dart ('k') | pkg/analyzer/lib/src/generated/incremental_resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698