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

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

Issue 175793004: Option to disable Angular in Dart-based Analyzer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analyzer/pubspec.yaml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 'java_core.dart'; 10 import 'java_core.dart';
(...skipping 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
749 * @return `true` if incremental analysis should be used 749 * @return `true` if incremental analysis should be used
750 */ 750 */
751 bool get incremental; 751 bool get incremental;
752 752
753 /** 753 /**
754 * Return `true` if analysis is to parse comments. 754 * Return `true` if analysis is to parse comments.
755 * 755 *
756 * @return `true` if analysis is to parse comments 756 * @return `true` if analysis is to parse comments
757 */ 757 */
758 bool get preserveComments; 758 bool get preserveComments;
759
760 /**
761 * Return `true` if analysis is to analyze Angular.
762 *
763 * @return `true` if analysis is to analyze Angular
764 */
765 bool get analyzeAngular;
759 } 766 }
760 767
761 /** 768 /**
762 * Instances of the class `AnalysisResult` 769 * Instances of the class `AnalysisResult`
763 */ 770 */
764 class AnalysisResult { 771 class AnalysisResult {
765 /** 772 /**
766 * The change notices associated with this result, or `null` if there were no changes and 773 * The change notices associated with this result, or `null` if there were no changes and
767 * there is no more work to be done. 774 * there is no more work to be done.
768 */ 775 */
(...skipping 4362 matching lines...) Expand 10 before | Expand all | Expand 10 after
5131 return new ParseHtmlTask(this, source); 5138 return new ParseHtmlTask(this, source);
5132 } 5139 }
5133 } 5140 }
5134 CacheState resolvedUnitState = htmlEntry.getState(HtmlEntry.RESOLVED_UNIT) ; 5141 CacheState resolvedUnitState = htmlEntry.getState(HtmlEntry.RESOLVED_UNIT) ;
5135 if (identical(resolvedUnitState, CacheState.INVALID) || (isPriority && ide ntical(resolvedUnitState, CacheState.FLUSHED))) { 5142 if (identical(resolvedUnitState, CacheState.INVALID) || (isPriority && ide ntical(resolvedUnitState, CacheState.FLUSHED))) {
5136 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; 5143 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
5137 htmlCopy.setState(HtmlEntry.RESOLVED_UNIT, CacheState.IN_PROCESS); 5144 htmlCopy.setState(HtmlEntry.RESOLVED_UNIT, CacheState.IN_PROCESS);
5138 _cache.put(source, htmlCopy); 5145 _cache.put(source, htmlCopy);
5139 return new ResolveHtmlTask(this, source); 5146 return new ResolveHtmlTask(this, source);
5140 } 5147 }
5141 CacheState angularErrorsState = htmlEntry.getState(HtmlEntry.ANGULAR_ERROR S); 5148 if (_options.analyzeAngular) {
5142 if (identical(angularErrorsState, CacheState.INVALID)) { 5149 CacheState angularErrorsState = htmlEntry.getState(HtmlEntry.ANGULAR_ERR ORS);
5143 AngularApplicationInfo entryInfo = htmlEntry.getValue(HtmlEntry.ANGULAR_ ENTRY); 5150 if (identical(angularErrorsState, CacheState.INVALID)) {
5144 if (entryInfo != null) { 5151 AngularApplicationInfo entryInfo = htmlEntry.getValue(HtmlEntry.ANGULA R_ENTRY);
5145 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; 5152 if (entryInfo != null) {
5146 htmlCopy.setState(HtmlEntry.ANGULAR_ERRORS, CacheState.IN_PROCESS);
5147 _cache.put(source, htmlCopy);
5148 return new ResolveAngularEntryHtmlTask(this, source, entryInfo);
5149 }
5150 AngularApplicationInfo applicationInfo = htmlEntry.getValue(HtmlEntry.AN GULAR_APPLICATION);
5151 if (applicationInfo != null) {
5152 AngularComponentElement component = htmlEntry.getValue(HtmlEntry.ANGUL AR_COMPONENT);
5153 if (component != null) {
5154 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy; 5153 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
5155 htmlCopy.setState(HtmlEntry.ANGULAR_ERRORS, CacheState.IN_PROCESS); 5154 htmlCopy.setState(HtmlEntry.ANGULAR_ERRORS, CacheState.IN_PROCESS);
5156 _cache.put(source, htmlCopy); 5155 _cache.put(source, htmlCopy);
5157 return new ResolveAngularComponentTemplateTask(this, source, compone nt, applicationInfo); 5156 return new ResolveAngularEntryHtmlTask(this, source, entryInfo);
5158 } 5157 }
5158 AngularApplicationInfo applicationInfo = htmlEntry.getValue(HtmlEntry. ANGULAR_APPLICATION);
5159 if (applicationInfo != null) {
5160 AngularComponentElement component = htmlEntry.getValue(HtmlEntry.ANG ULAR_COMPONENT);
5161 if (component != null) {
5162 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
5163 htmlCopy.setState(HtmlEntry.ANGULAR_ERRORS, CacheState.IN_PROCESS) ;
5164 _cache.put(source, htmlCopy);
5165 return new ResolveAngularComponentTemplateTask(this, source, compo nent, applicationInfo);
5166 }
5167 }
5168 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
5169 htmlCopy.setValue(HtmlEntry.ANGULAR_ERRORS, AnalysisError.NO_ERRORS);
5170 _cache.put(source, htmlCopy);
5159 } 5171 }
5160 HtmlEntryImpl htmlCopy = htmlEntry.writableCopy;
5161 htmlCopy.setValue(HtmlEntry.ANGULAR_ERRORS, AnalysisError.NO_ERRORS);
5162 _cache.put(source, htmlCopy);
5163 } 5172 }
5164 } 5173 }
5165 return null; 5174 return null;
5166 } 5175 }
5167 5176
5168 /** 5177 /**
5169 * Return a change notice for the given source, creating one if one does not a lready exist. 5178 * Return a change notice for the given source, creating one if one does not a lready exist.
5170 * 5179 *
5171 * @param source the source for which changes are being reported 5180 * @param source the source for which changes are being reported
5172 * @return a change notice for the given source 5181 * @return a change notice for the given source
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
5326 CacheState parsedUnitState = htmlEntry.getState(HtmlEntry.PARSED_UNIT); 5335 CacheState parsedUnitState = htmlEntry.getState(HtmlEntry.PARSED_UNIT);
5327 if (identical(parsedUnitState, CacheState.INVALID) || (isPriority && ident ical(parsedUnitState, CacheState.FLUSHED))) { 5336 if (identical(parsedUnitState, CacheState.INVALID) || (isPriority && ident ical(parsedUnitState, CacheState.FLUSHED))) {
5328 sources.add(source); 5337 sources.add(source);
5329 return; 5338 return;
5330 } 5339 }
5331 CacheState resolvedUnitState = htmlEntry.getState(HtmlEntry.RESOLVED_UNIT) ; 5340 CacheState resolvedUnitState = htmlEntry.getState(HtmlEntry.RESOLVED_UNIT) ;
5332 if (identical(resolvedUnitState, CacheState.INVALID) || (isPriority && ide ntical(resolvedUnitState, CacheState.FLUSHED))) { 5341 if (identical(resolvedUnitState, CacheState.INVALID) || (isPriority && ide ntical(resolvedUnitState, CacheState.FLUSHED))) {
5333 sources.add(source); 5342 sources.add(source);
5334 return; 5343 return;
5335 } 5344 }
5336 CacheState angularErrorsState = htmlEntry.getState(HtmlEntry.ANGULAR_ERROR S); 5345 if (_options.analyzeAngular) {
5337 if (identical(angularErrorsState, CacheState.INVALID)) { 5346 CacheState angularErrorsState = htmlEntry.getState(HtmlEntry.ANGULAR_ERR ORS);
5338 AngularApplicationInfo entryInfo = htmlEntry.getValue(HtmlEntry.ANGULAR_ ENTRY); 5347 if (identical(angularErrorsState, CacheState.INVALID)) {
5339 if (entryInfo != null) { 5348 AngularApplicationInfo entryInfo = htmlEntry.getValue(HtmlEntry.ANGULA R_ENTRY);
5340 sources.add(source); 5349 if (entryInfo != null) {
5341 return;
5342 }
5343 AngularApplicationInfo applicationInfo = htmlEntry.getValue(HtmlEntry.AN GULAR_APPLICATION);
5344 if (applicationInfo != null) {
5345 AngularComponentElement component = htmlEntry.getValue(HtmlEntry.ANGUL AR_COMPONENT);
5346 if (component != null) {
5347 sources.add(source); 5350 sources.add(source);
5348 return; 5351 return;
5349 } 5352 }
5353 AngularApplicationInfo applicationInfo = htmlEntry.getValue(HtmlEntry. ANGULAR_APPLICATION);
5354 if (applicationInfo != null) {
5355 AngularComponentElement component = htmlEntry.getValue(HtmlEntry.ANG ULAR_COMPONENT);
5356 if (component != null) {
5357 sources.add(source);
5358 return;
5359 }
5360 }
5350 } 5361 }
5351 } 5362 }
5352 } 5363 }
5353 } 5364 }
5354 5365
5355 /** 5366 /**
5356 * Invalidate all of the resolution results computed by this context. 5367 * Invalidate all of the resolution results computed by this context.
5357 * 5368 *
5358 * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock]. 5369 * <b>Note:</b> This method must only be invoked while we are synchronized on [cacheLock].
5359 */ 5370 */
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
5474 } 5485 }
5475 } 5486 }
5476 5487
5477 /** 5488 /**
5478 * Updates [HtmlEntry]s that correspond to the previously known and new Angula r components. 5489 * Updates [HtmlEntry]s that correspond to the previously known and new Angula r components.
5479 * 5490 *
5480 * @param library the [Library] that was resolved 5491 * @param library the [Library] that was resolved
5481 * @param dartCopy the [DartEntryImpl] to record new Angular components 5492 * @param dartCopy the [DartEntryImpl] to record new Angular components
5482 */ 5493 */
5483 void recordAngularComponents(HtmlEntryImpl entry, AngularApplicationInfo app) { 5494 void recordAngularComponents(HtmlEntryImpl entry, AngularApplicationInfo app) {
5495 if (!_options.analyzeAngular) {
5496 return;
5497 }
5484 // reset old Angular errors 5498 // reset old Angular errors
5485 AngularApplicationInfo oldApp = entry.getValue(HtmlEntry.ANGULAR_ENTRY); 5499 AngularApplicationInfo oldApp = entry.getValue(HtmlEntry.ANGULAR_ENTRY);
5486 if (oldApp != null) { 5500 if (oldApp != null) {
5487 List<AngularElement> oldAngularElements = oldApp.elements; 5501 List<AngularElement> oldAngularElements = oldApp.elements;
5488 for (AngularElement angularElement in oldAngularElements) { 5502 for (AngularElement angularElement in oldAngularElements) {
5489 if (angularElement is AngularComponentElement) { 5503 if (angularElement is AngularComponentElement) {
5490 AngularComponentElement component = angularElement; 5504 AngularComponentElement component = angularElement;
5491 Source templateSource = component.templateSource; 5505 Source templateSource = component.templateSource;
5492 if (templateSource != null) { 5506 if (templateSource != null) {
5493 HtmlEntry htmlEntry = getReadableHtmlEntry(templateSource); 5507 HtmlEntry htmlEntry = getReadableHtmlEntry(templateSource);
(...skipping 1170 matching lines...) Expand 10 before | Expand all | Expand 10 after
6664 * information and pub best practices). 6678 * information and pub best practices).
6665 */ 6679 */
6666 bool hint = true; 6680 bool hint = true;
6667 6681
6668 /** 6682 /**
6669 * A flag indicating whether incremental analysis should be used. 6683 * A flag indicating whether incremental analysis should be used.
6670 */ 6684 */
6671 bool incremental = false; 6685 bool incremental = false;
6672 6686
6673 /** 6687 /**
6674 * flag indicating whether analysis is to parse comments. 6688 * A flag indicating whether analysis is to parse comments.
6675 */ 6689 */
6676 bool preserveComments = true; 6690 bool preserveComments = true;
6677 6691
6678 /** 6692 /**
6693 * A flag indicating whether analysis is to parse comments.
6694 */
6695 bool analyzeAngular = true;
6696
6697 /**
6679 * Initialize a newly created set of analysis options to have their default va lues. 6698 * Initialize a newly created set of analysis options to have their default va lues.
6680 */ 6699 */
6681 AnalysisOptionsImpl(); 6700 AnalysisOptionsImpl();
6682 6701
6683 /** 6702 /**
6684 * Initialize a newly created set of analysis options to have the same values as those in the 6703 * Initialize a newly created set of analysis options to have the same values as those in the
6685 * given set of analysis options. 6704 * given set of analysis options.
6686 * 6705 *
6687 * @param options the analysis options whose values are being copied 6706 * @param options the analysis options whose values are being copied
6688 */ 6707 */
6689 AnalysisOptionsImpl.con1(AnalysisOptions options) { 6708 AnalysisOptionsImpl.con1(AnalysisOptions options) {
6690 cacheSize = options.cacheSize; 6709 cacheSize = options.cacheSize;
6691 dart2jsHint = options.dart2jsHint; 6710 dart2jsHint = options.dart2jsHint;
6692 hint = options.hint; 6711 hint = options.hint;
6693 incremental = options.incremental; 6712 incremental = options.incremental;
6713 analyzeAngular = options.analyzeAngular;
6694 } 6714 }
6695 } 6715 }
6696 6716
6697 /** 6717 /**
6698 * Instances of the class `ChangeNoticeImpl` represent a change to the analysis results 6718 * Instances of the class `ChangeNoticeImpl` represent a change to the analysis results
6699 * associated with a given source. 6719 * associated with a given source.
6700 * 6720 *
6701 * @coverage dart.engine 6721 * @coverage dart.engine
6702 */ 6722 */
6703 class ChangeNoticeImpl implements ChangeNotice { 6723 class ChangeNoticeImpl implements ChangeNotice {
(...skipping 4192 matching lines...) Expand 10 before | Expand all | Expand 10 after
10896 if (unit == null) { 10916 if (unit == null) {
10897 throw new AnalysisException.con1("Internal error: computeResolvableHtmlUni t returned a value without a parsed HTML unit"); 10917 throw new AnalysisException.con1("Internal error: computeResolvableHtmlUni t returned a value without a parsed HTML unit");
10898 } 10918 }
10899 _modificationTime = resolvableHtmlUnit.modificationTime; 10919 _modificationTime = resolvableHtmlUnit.modificationTime;
10900 // build standard HTML element 10920 // build standard HTML element
10901 HtmlUnitBuilder builder = new HtmlUnitBuilder(context); 10921 HtmlUnitBuilder builder = new HtmlUnitBuilder(context);
10902 _element = builder.buildHtmlElement2(source, _modificationTime, unit); 10922 _element = builder.buildHtmlElement2(source, _modificationTime, unit);
10903 RecordingErrorListener errorListener = builder.errorListener; 10923 RecordingErrorListener errorListener = builder.errorListener;
10904 LineInfo lineInfo = context.getLineInfo(source); 10924 LineInfo lineInfo = context.getLineInfo(source);
10905 // try to resolve as an Angular entry point 10925 // try to resolve as an Angular entry point
10906 _isAngularApplication2 = AngularHtmlUnitResolver.hasAngularAnnotation(unit); 10926 if (context.analysisOptions.analyzeAngular) {
10907 _angularApplication = new AngularHtmlUnitResolver(context, errorListener, so urce, lineInfo, unit).calculateAngularApplication(); 10927 _isAngularApplication2 = AngularHtmlUnitResolver.hasAngularAnnotation(unit );
10928 _angularApplication = new AngularHtmlUnitResolver(context, errorListener, source, lineInfo, unit).calculateAngularApplication();
10929 }
10908 // record all resolution errors 10930 // record all resolution errors
10909 _resolutionErrors = errorListener.getErrors2(source); 10931 _resolutionErrors = errorListener.getErrors2(source);
10910 // remember resolved unit 10932 // remember resolved unit
10911 _resolvedUnit = unit; 10933 _resolvedUnit = unit;
10912 } 10934 }
10913 } 10935 }
10914 10936
10915 /** 10937 /**
10916 * The interface `Logger` defines the behavior of objects that can be used to re ceive 10938 * The interface `Logger` defines the behavior of objects that can be used to re ceive
10917 * information about errors within the analysis engine. Implementations usually write this 10939 * information about errors within the analysis engine. Implementations usually write this
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
10964 10986
10965 void logError2(String message, Exception exception) { 10987 void logError2(String message, Exception exception) {
10966 } 10988 }
10967 10989
10968 void logInformation(String message) { 10990 void logInformation(String message) {
10969 } 10991 }
10970 10992
10971 void logInformation3(String message, Exception exception) { 10993 void logInformation3(String message, Exception exception) {
10972 } 10994 }
10973 } 10995 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698