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

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

Issue 23769004: java2dart improvement - use field if getter/setter are trivial. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 3 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
OLDNEW
1 // This code was auto-generated, is not intended to be edited, and is subject to 1 // This code was auto-generated, is not intended to be edited, and is subject to
2 // significant change. Please see the README file for more information. 2 // significant change. Please see the README file for more information.
3 library engine; 3 library engine;
4 import 'java_core.dart'; 4 import 'java_core.dart';
5 import 'java_engine.dart'; 5 import 'java_engine.dart';
6 import 'utilities_collection.dart'; 6 import 'utilities_collection.dart';
7 import 'instrumentation.dart'; 7 import 'instrumentation.dart';
8 import 'error.dart'; 8 import 'error.dart';
9 import 'source.dart'; 9 import 'source.dart';
10 import 'scanner.dart' show Token, CharBufferScanner, StringScanner; 10 import 'scanner.dart' show Token, CharBufferScanner, StringScanner;
(...skipping 22 matching lines...) Expand all
33 static String SUFFIX_HTM = "htm"; 33 static String SUFFIX_HTM = "htm";
34 34
35 /** 35 /**
36 * The long suffix used for HTML files. 36 * The long suffix used for HTML files.
37 */ 37 */
38 static String SUFFIX_HTML = "html"; 38 static String SUFFIX_HTML = "html";
39 39
40 /** 40 /**
41 * The unique instance of this class. 41 * The unique instance of this class.
42 */ 42 */
43 static AnalysisEngine _UniqueInstance = new AnalysisEngine(); 43 static final AnalysisEngine instance = new AnalysisEngine();
44
45 /**
46 * Return the unique instance of this class.
47 *
48 * @return the unique instance of this class
49 */
50 static AnalysisEngine get instance => _UniqueInstance;
51 44
52 /** 45 /**
53 * Return `true` if the given file name is assumed to contain Dart source code . 46 * Return `true` if the given file name is assumed to contain Dart source code .
54 * 47 *
55 * @param fileName the name of the file being tested 48 * @param fileName the name of the file being tested
56 * @return `true` if the given file name is assumed to contain Dart source cod e 49 * @return `true` if the given file name is assumed to contain Dart source cod e
57 */ 50 */
58 static bool isDartFileName(String fileName) { 51 static bool isDartFileName(String fileName) {
59 if (fileName == null) { 52 if (fileName == null) {
60 return false; 53 return false;
(...skipping 665 matching lines...) Expand 10 before | Expand all | Expand 10 after
726 * Instances of the class `ChangeSet` indicate what sources have been added, cha nged, or 719 * Instances of the class `ChangeSet` indicate what sources have been added, cha nged, or
727 * removed. 720 * removed.
728 * 721 *
729 * @coverage dart.engine 722 * @coverage dart.engine
730 */ 723 */
731 class ChangeSet { 724 class ChangeSet {
732 725
733 /** 726 /**
734 * A list containing the sources that have been added. 727 * A list containing the sources that have been added.
735 */ 728 */
736 List<Source> _added2 = new List<Source>(); 729 final List<Source> added3 = new List<Source>();
737 730
738 /** 731 /**
739 * A list containing the sources that have been changed. 732 * A list containing the sources that have been changed.
740 */ 733 */
741 List<Source> _changed2 = new List<Source>(); 734 final List<Source> changed3 = new List<Source>();
742 735
743 /** 736 /**
744 * A list containing the sources that have been removed. 737 * A list containing the sources that have been removed.
745 */ 738 */
746 List<Source> _removed2 = new List<Source>(); 739 final List<Source> removed3 = new List<Source>();
747 740
748 /** 741 /**
749 * A list containing the source containers specifying additional sources that have been removed. 742 * A list containing the source containers specifying additional sources that have been removed.
750 */ 743 */
751 List<SourceContainer> _removedContainers = new List<SourceContainer>(); 744 final List<SourceContainer> removedContainers = new List<SourceContainer>();
752 745
753 /** 746 /**
754 * Record that the specified source has been added and that it's content is th e default contents 747 * Record that the specified source has been added and that it's content is th e default contents
755 * of the source. 748 * of the source.
756 * 749 *
757 * @param source the source that was added 750 * @param source the source that was added
758 */ 751 */
759 void added(Source source) { 752 void added(Source source) {
760 _added2.add(source); 753 added3.add(source);
761 } 754 }
762 755
763 /** 756 /**
764 * Record that the specified source has been changed and that it's content is the default contents 757 * Record that the specified source has been changed and that it's content is the default contents
765 * of the source. 758 * of the source.
766 * 759 *
767 * @param source the source that was changed 760 * @param source the source that was changed
768 */ 761 */
769 void changed(Source source) { 762 void changed(Source source) {
770 _changed2.add(source); 763 changed3.add(source);
771 } 764 }
772 765
773 /** 766 /**
774 * Return a collection of the sources that have been added.
775 *
776 * @return a collection of the sources that have been added
777 */
778 List<Source> get added3 => _added2;
779
780 /**
781 * Return a collection of sources that have been changed.
782 *
783 * @return a collection of sources that have been changed
784 */
785 List<Source> get changed3 => _changed2;
786
787 /**
788 * Return a list containing the sources that were removed.
789 *
790 * @return a list containing the sources that were removed
791 */
792 List<Source> get removed => _removed2;
793
794 /**
795 * Return a list containing the source containers that were removed.
796 *
797 * @return a list containing the source containers that were removed
798 */
799 List<SourceContainer> get removedContainers => _removedContainers;
800
801 /**
802 * Return `true` if this change set does not contain any changes. 767 * Return `true` if this change set does not contain any changes.
803 * 768 *
804 * @return `true` if this change set does not contain any changes 769 * @return `true` if this change set does not contain any changes
805 */ 770 */
806 bool get isEmpty => _added2.isEmpty && _changed2.isEmpty && _removed2.isEmpty && _removedContainers.isEmpty; 771 bool get isEmpty => added3.isEmpty && changed3.isEmpty && removed3.isEmpty && removedContainers.isEmpty;
807 772
808 /** 773 /**
809 * Record that the specified source has been removed. 774 * Record that the specified source has been removed.
810 * 775 *
811 * @param source the source that was removed 776 * @param source the source that was removed
812 */ 777 */
813 void removed3(Source source) { 778 void removed(Source source) {
814 if (source != null) { 779 if (source != null) {
815 _removed2.add(source); 780 removed3.add(source);
816 } 781 }
817 } 782 }
818 783
819 /** 784 /**
820 * Record that the specified source container has been removed. 785 * Record that the specified source container has been removed.
821 * 786 *
822 * @param container the source container that was removed 787 * @param container the source container that was removed
823 */ 788 */
824 void removedContainer(SourceContainer container) { 789 void removedContainer(SourceContainer container) {
825 if (container != null) { 790 if (container != null) {
826 _removedContainers.add(container); 791 removedContainers.add(container);
827 } 792 }
828 } 793 }
829 } 794 }
830 /** 795 /**
831 * Instances of the class `AnalysisCache` implement an LRU cache of information related to 796 * Instances of the class `AnalysisCache` implement an LRU cache of information related to
832 * analysis. 797 * analysis.
833 */ 798 */
834 class AnalysisCache { 799 class AnalysisCache {
835 800
836 /** 801 /**
(...skipping 1819 matching lines...) Expand 10 before | Expand all | Expand 10 after
2656 } 2621 }
2657 } 2622 }
2658 void addSourceInfo(Source source, SourceEntry info) { 2623 void addSourceInfo(Source source, SourceEntry info) {
2659 _sourceMap[source] = info; 2624 _sourceMap[source] = info;
2660 } 2625 }
2661 void applyChanges(ChangeSet changeSet) { 2626 void applyChanges(ChangeSet changeSet) {
2662 if (changeSet.isEmpty) { 2627 if (changeSet.isEmpty) {
2663 return; 2628 return;
2664 } 2629 }
2665 { 2630 {
2666 List<Source> removedSources = new List<Source>.from(changeSet.removed); 2631 List<Source> removedSources = new List<Source>.from(changeSet.removed3);
2667 for (SourceContainer container in changeSet.removedContainers) { 2632 for (SourceContainer container in changeSet.removedContainers) {
2668 addSourcesInContainer(removedSources, container); 2633 addSourcesInContainer(removedSources, container);
2669 } 2634 }
2670 bool addedDartSource = false; 2635 bool addedDartSource = false;
2671 for (Source source in changeSet.added3) { 2636 for (Source source in changeSet.added3) {
2672 if (sourceAvailable(source)) { 2637 if (sourceAvailable(source)) {
2673 addedDartSource = true; 2638 addedDartSource = true;
2674 } 2639 }
2675 } 2640 }
2676 for (Source source in changeSet.changed3) { 2641 for (Source source in changeSet.changed3) {
(...skipping 2218 matching lines...) Expand 10 before | Expand all | Expand 10 after
4895 } 4860 }
4896 } 4861 }
4897 /** 4862 /**
4898 * Instances of the class `ScanResult` represent the results of scanning a sourc e. 4863 * Instances of the class `ScanResult` represent the results of scanning a sourc e.
4899 */ 4864 */
4900 class AnalysisContextImpl_ScanResult { 4865 class AnalysisContextImpl_ScanResult {
4901 4866
4902 /** 4867 /**
4903 * The time at which the contents of the source were last modified. 4868 * The time at which the contents of the source were last modified.
4904 */ 4869 */
4905 int _modificationTime = 0; 4870 int modificationTime = 0;
4906 4871
4907 /** 4872 /**
4908 * The first token in the token stream. 4873 * The first token in the token stream.
4909 */ 4874 */
4910 Token _token; 4875 Token _token;
4911 4876
4912 /** 4877 /**
4913 * The line start information that was produced. 4878 * The line start information that was produced.
4914 */ 4879 */
4915 List<int> _lineStarts; 4880 List<int> _lineStarts;
4916
4917 /**
4918 * Return the time at which the contents of the source were last modified.
4919 *
4920 * @return the time at which the contents of the source were last modified
4921 */
4922 int get modificationTime => _modificationTime;
4923 } 4881 }
4924 class RecursiveXmlVisitor_6 extends RecursiveXmlVisitor<Object> { 4882 class RecursiveXmlVisitor_6 extends RecursiveXmlVisitor<Object> {
4925 final AnalysisContextImpl AnalysisContextImpl_this; 4883 final AnalysisContextImpl AnalysisContextImpl_this;
4926 Source htmlSource; 4884 Source htmlSource;
4927 List<Source> libraries; 4885 List<Source> libraries;
4928 RecursiveXmlVisitor_6(this.AnalysisContextImpl_this, this.htmlSource, this.lib raries) : super(); 4886 RecursiveXmlVisitor_6(this.AnalysisContextImpl_this, this.htmlSource, this.lib raries) : super();
4929 Object visitXmlTagNode(XmlTagNode node) { 4887 Object visitXmlTagNode(XmlTagNode node) {
4930 if (javaStringEqualsIgnoreCase(node.tag.lexeme, AnalysisContextImpl._TAG_SCR IPT)) { 4888 if (javaStringEqualsIgnoreCase(node.tag.lexeme, AnalysisContextImpl._TAG_SCR IPT)) {
4931 bool isDartScript = false; 4889 bool isDartScript = false;
4932 XmlAttributeNode scriptAttribute = null; 4890 XmlAttributeNode scriptAttribute = null;
(...skipping 26 matching lines...) Expand all
4959 return super.visitXmlTagNode(node); 4917 return super.visitXmlTagNode(node);
4960 } 4918 }
4961 } 4919 }
4962 class Source_ContentReceiver_7 implements Source_ContentReceiver { 4920 class Source_ContentReceiver_7 implements Source_ContentReceiver {
4963 Source source; 4921 Source source;
4964 AnalysisErrorListener errorListener; 4922 AnalysisErrorListener errorListener;
4965 AnalysisContextImpl_ScanResult result; 4923 AnalysisContextImpl_ScanResult result;
4966 Source_ContentReceiver_7(this.source, this.errorListener, this.result); 4924 Source_ContentReceiver_7(this.source, this.errorListener, this.result);
4967 void accept(CharBuffer contents, int modificationTime2) { 4925 void accept(CharBuffer contents, int modificationTime2) {
4968 CharBufferScanner scanner = new CharBufferScanner(source, contents, errorLis tener); 4926 CharBufferScanner scanner = new CharBufferScanner(source, contents, errorLis tener);
4969 result._modificationTime = modificationTime2; 4927 result.modificationTime = modificationTime2;
4970 result._token = scanner.tokenize(); 4928 result._token = scanner.tokenize();
4971 result._lineStarts = scanner.lineStarts; 4929 result._lineStarts = scanner.lineStarts;
4972 } 4930 }
4973 void accept2(String contents, int modificationTime2) { 4931 void accept2(String contents, int modificationTime2) {
4974 StringScanner scanner = new StringScanner(source, contents, errorListener); 4932 StringScanner scanner = new StringScanner(source, contents, errorListener);
4975 result._modificationTime = modificationTime2; 4933 result.modificationTime = modificationTime2;
4976 result._token = scanner.tokenize(); 4934 result._token = scanner.tokenize();
4977 result._lineStarts = scanner.lineStarts; 4935 result._lineStarts = scanner.lineStarts;
4978 } 4936 }
4979 } 4937 }
4980 /** 4938 /**
4981 * Instances of the class `AnalysisContextImpl` implement an [AnalysisContext]. 4939 * Instances of the class `AnalysisContextImpl` implement an [AnalysisContext].
4982 * 4940 *
4983 * @coverage dart.engine 4941 * @coverage dart.engine
4984 */ 4942 */
4985 class AnalysisContextImpl2 implements InternalAnalysisContext { 4943 class AnalysisContextImpl2 implements InternalAnalysisContext {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
5042 _resultRecorder = new AnalysisContextImpl2_AnalysisTaskResultRecorder(this); 5000 _resultRecorder = new AnalysisContextImpl2_AnalysisTaskResultRecorder(this);
5043 } 5001 }
5044 void addSourceInfo(Source source, SourceEntry info) { 5002 void addSourceInfo(Source source, SourceEntry info) {
5045 _cache.put(source, info); 5003 _cache.put(source, info);
5046 } 5004 }
5047 void applyChanges(ChangeSet changeSet) { 5005 void applyChanges(ChangeSet changeSet) {
5048 if (changeSet.isEmpty) { 5006 if (changeSet.isEmpty) {
5049 return; 5007 return;
5050 } 5008 }
5051 { 5009 {
5052 List<Source> removedSources = new List<Source>.from(changeSet.removed); 5010 List<Source> removedSources = new List<Source>.from(changeSet.removed3);
5053 for (SourceContainer container in changeSet.removedContainers) { 5011 for (SourceContainer container in changeSet.removedContainers) {
5054 addSourcesInContainer(removedSources, container); 5012 addSourcesInContainer(removedSources, container);
5055 } 5013 }
5056 bool addedDartSource = false; 5014 bool addedDartSource = false;
5057 for (Source source in changeSet.added3) { 5015 for (Source source in changeSet.added3) {
5058 if (sourceAvailable(source)) { 5016 if (sourceAvailable(source)) {
5059 addedDartSource = true; 5017 addedDartSource = true;
5060 } 5018 }
5061 } 5019 }
5062 for (Source source in changeSet.changed3) { 5020 for (Source source in changeSet.changed3) {
(...skipping 2428 matching lines...) Expand 10 before | Expand all | Expand 10 after
7491 } 7449 }
7492 7450
7493 /** 7451 /**
7494 * The unique identifier used to identify this analysis context in the instrum entation data. 7452 * The unique identifier used to identify this analysis context in the instrum entation data.
7495 */ 7453 */
7496 String _contextId = UUID.randomUUID().toString(); 7454 String _contextId = UUID.randomUUID().toString();
7497 7455
7498 /** 7456 /**
7499 * The analysis context to which all of the non-instrumentation work is delega ted. 7457 * The analysis context to which all of the non-instrumentation work is delega ted.
7500 */ 7458 */
7501 InternalAnalysisContext _basis; 7459 InternalAnalysisContext basis;
7502 7460
7503 /** 7461 /**
7504 * Create a new [InstrumentedAnalysisContextImpl] which wraps a new 7462 * Create a new [InstrumentedAnalysisContextImpl] which wraps a new
7505 * [AnalysisContextImpl] as the basis context. 7463 * [AnalysisContextImpl] as the basis context.
7506 */ 7464 */
7507 InstrumentedAnalysisContextImpl() : this.con1(AnalysisEngine.instance.useExper imentalContext ? new DelegatingAnalysisContextImpl2() : new DelegatingAnalysisCo ntextImpl()); 7465 InstrumentedAnalysisContextImpl() : this.con1(AnalysisEngine.instance.useExper imentalContext ? new DelegatingAnalysisContextImpl2() : new DelegatingAnalysisCo ntextImpl());
7508 7466
7509 /** 7467 /**
7510 * Create a new [InstrumentedAnalysisContextImpl] with a specified basis conte xt, aka the 7468 * Create a new [InstrumentedAnalysisContextImpl] with a specified basis conte xt, aka the
7511 * context to wrap and instrument. 7469 * context to wrap and instrument.
7512 * 7470 *
7513 * @param context some [InstrumentedAnalysisContext] to wrap and instrument 7471 * @param context some [InstrumentedAnalysisContext] to wrap and instrument
7514 */ 7472 */
7515 InstrumentedAnalysisContextImpl.con1(InternalAnalysisContext context) { 7473 InstrumentedAnalysisContextImpl.con1(InternalAnalysisContext context) {
7516 _basis = context; 7474 basis = context;
7517 } 7475 }
7518 void addSourceInfo(Source source, SourceEntry info) { 7476 void addSourceInfo(Source source, SourceEntry info) {
7519 _basis.addSourceInfo(source, info); 7477 basis.addSourceInfo(source, info);
7520 } 7478 }
7521 void applyChanges(ChangeSet changeSet) { 7479 void applyChanges(ChangeSet changeSet) {
7522 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- applyChanges"); 7480 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- applyChanges");
7523 try { 7481 try {
7524 instrumentation.metric3("contextId", _contextId); 7482 instrumentation.metric3("contextId", _contextId);
7525 _basis.applyChanges(changeSet); 7483 basis.applyChanges(changeSet);
7526 } finally { 7484 } finally {
7527 instrumentation.log(); 7485 instrumentation.log();
7528 } 7486 }
7529 } 7487 }
7530 String computeDocumentationComment(Element element) { 7488 String computeDocumentationComment(Element element) {
7531 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- computeDocumentationComment"); 7489 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- computeDocumentationComment");
7532 try { 7490 try {
7533 instrumentation.metric3("contextId", _contextId); 7491 instrumentation.metric3("contextId", _contextId);
7534 return _basis.computeDocumentationComment(element); 7492 return basis.computeDocumentationComment(element);
7535 } finally { 7493 } finally {
7536 instrumentation.log(); 7494 instrumentation.log();
7537 } 7495 }
7538 } 7496 }
7539 List<AnalysisError> computeErrors(Source source) { 7497 List<AnalysisError> computeErrors(Source source) {
7540 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- computeErrors"); 7498 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- computeErrors");
7541 try { 7499 try {
7542 instrumentation.metric3("contextId", _contextId); 7500 instrumentation.metric3("contextId", _contextId);
7543 List<AnalysisError> errors = _basis.computeErrors(source); 7501 List<AnalysisError> errors = basis.computeErrors(source);
7544 instrumentation.metric2("Errors-count", errors.length); 7502 instrumentation.metric2("Errors-count", errors.length);
7545 return errors; 7503 return errors;
7546 } finally { 7504 } finally {
7547 instrumentation.log(); 7505 instrumentation.log();
7548 } 7506 }
7549 } 7507 }
7550 List<Source> computeExportedLibraries(Source source) { 7508 List<Source> computeExportedLibraries(Source source) {
7551 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- computeExportedLibraries"); 7509 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- computeExportedLibraries");
7552 try { 7510 try {
7553 instrumentation.metric3("contextId", _contextId); 7511 instrumentation.metric3("contextId", _contextId);
7554 return _basis.computeExportedLibraries(source); 7512 return basis.computeExportedLibraries(source);
7555 } finally { 7513 } finally {
7556 instrumentation.log(); 7514 instrumentation.log();
7557 } 7515 }
7558 } 7516 }
7559 HtmlElement computeHtmlElement(Source source) { 7517 HtmlElement computeHtmlElement(Source source) {
7560 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- computeHtmlElement"); 7518 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- computeHtmlElement");
7561 try { 7519 try {
7562 instrumentation.metric3("contextId", _contextId); 7520 instrumentation.metric3("contextId", _contextId);
7563 return _basis.computeHtmlElement(source); 7521 return basis.computeHtmlElement(source);
7564 } on AnalysisException catch (e) { 7522 } on AnalysisException catch (e) {
7565 recordAnalysisException(instrumentation, e); 7523 recordAnalysisException(instrumentation, e);
7566 throw e; 7524 throw e;
7567 } finally { 7525 } finally {
7568 instrumentation.log(); 7526 instrumentation.log();
7569 } 7527 }
7570 } 7528 }
7571 List<Source> computeImportedLibraries(Source source) { 7529 List<Source> computeImportedLibraries(Source source) {
7572 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- computeImportedLibraries"); 7530 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- computeImportedLibraries");
7573 try { 7531 try {
7574 instrumentation.metric3("contextId", _contextId); 7532 instrumentation.metric3("contextId", _contextId);
7575 return _basis.computeImportedLibraries(source); 7533 return basis.computeImportedLibraries(source);
7576 } finally { 7534 } finally {
7577 instrumentation.log(); 7535 instrumentation.log();
7578 } 7536 }
7579 } 7537 }
7580 SourceKind computeKindOf(Source source) { 7538 SourceKind computeKindOf(Source source) {
7581 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- computeKindOf"); 7539 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- computeKindOf");
7582 try { 7540 try {
7583 instrumentation.metric3("contextId", _contextId); 7541 instrumentation.metric3("contextId", _contextId);
7584 return _basis.computeKindOf(source); 7542 return basis.computeKindOf(source);
7585 } finally { 7543 } finally {
7586 instrumentation.log(); 7544 instrumentation.log();
7587 } 7545 }
7588 } 7546 }
7589 LibraryElement computeLibraryElement(Source source) { 7547 LibraryElement computeLibraryElement(Source source) {
7590 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- computeLibraryElement"); 7548 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- computeLibraryElement");
7591 try { 7549 try {
7592 instrumentation.metric3("contextId", _contextId); 7550 instrumentation.metric3("contextId", _contextId);
7593 return _basis.computeLibraryElement(source); 7551 return basis.computeLibraryElement(source);
7594 } on AnalysisException catch (e) { 7552 } on AnalysisException catch (e) {
7595 recordAnalysisException(instrumentation, e); 7553 recordAnalysisException(instrumentation, e);
7596 throw e; 7554 throw e;
7597 } finally { 7555 } finally {
7598 instrumentation.log(); 7556 instrumentation.log();
7599 } 7557 }
7600 } 7558 }
7601 LineInfo computeLineInfo(Source source) { 7559 LineInfo computeLineInfo(Source source) {
7602 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- computeLineInfo"); 7560 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- computeLineInfo");
7603 try { 7561 try {
7604 instrumentation.metric3("contextId", _contextId); 7562 instrumentation.metric3("contextId", _contextId);
7605 return _basis.computeLineInfo(source); 7563 return basis.computeLineInfo(source);
7606 } on AnalysisException catch (e) { 7564 } on AnalysisException catch (e) {
7607 recordAnalysisException(instrumentation, e); 7565 recordAnalysisException(instrumentation, e);
7608 throw e; 7566 throw e;
7609 } finally { 7567 } finally {
7610 instrumentation.log(); 7568 instrumentation.log();
7611 } 7569 }
7612 } 7570 }
7613 ResolvableCompilationUnit computeResolvableCompilationUnit(Source source) => _ basis.computeResolvableCompilationUnit(source); 7571 ResolvableCompilationUnit computeResolvableCompilationUnit(Source source) => b asis.computeResolvableCompilationUnit(source);
7614 ResolvableHtmlUnit computeResolvableHtmlUnit(Source source) => _basis.computeR esolvableHtmlUnit(source); 7572 ResolvableHtmlUnit computeResolvableHtmlUnit(Source source) => basis.computeRe solvableHtmlUnit(source);
7615 AnalysisContext extractContext(SourceContainer container) { 7573 AnalysisContext extractContext(SourceContainer container) {
7616 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- extractContext"); 7574 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- extractContext");
7617 try { 7575 try {
7618 instrumentation.metric3("contextId", _contextId); 7576 instrumentation.metric3("contextId", _contextId);
7619 InstrumentedAnalysisContextImpl newContext = new InstrumentedAnalysisConte xtImpl(); 7577 InstrumentedAnalysisContextImpl newContext = new InstrumentedAnalysisConte xtImpl();
7620 _basis.extractContextInto(container, newContext._basis); 7578 basis.extractContextInto(container, newContext.basis);
7621 return newContext; 7579 return newContext;
7622 } finally { 7580 } finally {
7623 instrumentation.log(); 7581 instrumentation.log();
7624 } 7582 }
7625 } 7583 }
7626 InternalAnalysisContext extractContextInto(SourceContainer container, Internal AnalysisContext newContext) => _basis.extractContextInto(container, newContext); 7584 InternalAnalysisContext extractContextInto(SourceContainer container, Internal AnalysisContext newContext) => basis.extractContextInto(container, newContext);
7627 AnalysisOptions get analysisOptions { 7585 AnalysisOptions get analysisOptions {
7628 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getAnalysisOptions"); 7586 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getAnalysisOptions");
7629 try { 7587 try {
7630 instrumentation.metric3("contextId", _contextId); 7588 instrumentation.metric3("contextId", _contextId);
7631 return _basis.analysisOptions; 7589 return basis.analysisOptions;
7632 } finally { 7590 } finally {
7633 instrumentation.log(); 7591 instrumentation.log();
7634 } 7592 }
7635 } 7593 }
7636
7637 /**
7638 * @return the underlying [AnalysisContext].
7639 */
7640 AnalysisContext get basis => _basis;
7641 Element getElement(ElementLocation location) { 7594 Element getElement(ElementLocation location) {
7642 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getElement"); 7595 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getElement");
7643 try { 7596 try {
7644 instrumentation.metric3("contextId", _contextId); 7597 instrumentation.metric3("contextId", _contextId);
7645 return _basis.getElement(location); 7598 return basis.getElement(location);
7646 } finally { 7599 } finally {
7647 instrumentation.log(); 7600 instrumentation.log();
7648 } 7601 }
7649 } 7602 }
7650 AnalysisErrorInfo getErrors(Source source) { 7603 AnalysisErrorInfo getErrors(Source source) {
7651 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getErrors"); 7604 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getErrors");
7652 try { 7605 try {
7653 instrumentation.metric3("contextId", _contextId); 7606 instrumentation.metric3("contextId", _contextId);
7654 AnalysisErrorInfo ret = _basis.getErrors(source); 7607 AnalysisErrorInfo ret = basis.getErrors(source);
7655 if (ret != null) { 7608 if (ret != null) {
7656 instrumentation.metric2("Errors-count", ret.errors.length); 7609 instrumentation.metric2("Errors-count", ret.errors.length);
7657 } 7610 }
7658 return ret; 7611 return ret;
7659 } finally { 7612 } finally {
7660 instrumentation.log(); 7613 instrumentation.log();
7661 } 7614 }
7662 } 7615 }
7663 HtmlElement getHtmlElement(Source source) { 7616 HtmlElement getHtmlElement(Source source) {
7664 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getHtmlElement"); 7617 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getHtmlElement");
7665 try { 7618 try {
7666 instrumentation.metric3("contextId", _contextId); 7619 instrumentation.metric3("contextId", _contextId);
7667 return _basis.getHtmlElement(source); 7620 return basis.getHtmlElement(source);
7668 } finally { 7621 } finally {
7669 instrumentation.log(); 7622 instrumentation.log();
7670 } 7623 }
7671 } 7624 }
7672 List<Source> getHtmlFilesReferencing(Source source) { 7625 List<Source> getHtmlFilesReferencing(Source source) {
7673 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getHtmlFilesReferencing"); 7626 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getHtmlFilesReferencing");
7674 try { 7627 try {
7675 instrumentation.metric3("contextId", _contextId); 7628 instrumentation.metric3("contextId", _contextId);
7676 List<Source> ret = _basis.getHtmlFilesReferencing(source); 7629 List<Source> ret = basis.getHtmlFilesReferencing(source);
7677 if (ret != null) { 7630 if (ret != null) {
7678 instrumentation.metric2("Source-count", ret.length); 7631 instrumentation.metric2("Source-count", ret.length);
7679 } 7632 }
7680 return ret; 7633 return ret;
7681 } finally { 7634 } finally {
7682 instrumentation.log(); 7635 instrumentation.log();
7683 } 7636 }
7684 } 7637 }
7685 List<Source> get htmlSources { 7638 List<Source> get htmlSources {
7686 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getHtmlSources"); 7639 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getHtmlSources");
7687 try { 7640 try {
7688 instrumentation.metric3("contextId", _contextId); 7641 instrumentation.metric3("contextId", _contextId);
7689 List<Source> ret = _basis.htmlSources; 7642 List<Source> ret = basis.htmlSources;
7690 if (ret != null) { 7643 if (ret != null) {
7691 instrumentation.metric2("Source-count", ret.length); 7644 instrumentation.metric2("Source-count", ret.length);
7692 } 7645 }
7693 return ret; 7646 return ret;
7694 } finally { 7647 } finally {
7695 instrumentation.log(); 7648 instrumentation.log();
7696 } 7649 }
7697 } 7650 }
7698 SourceKind getKindOf(Source source) { 7651 SourceKind getKindOf(Source source) {
7699 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getKindOf"); 7652 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getKindOf");
7700 try { 7653 try {
7701 instrumentation.metric3("contextId", _contextId); 7654 instrumentation.metric3("contextId", _contextId);
7702 return _basis.getKindOf(source); 7655 return basis.getKindOf(source);
7703 } finally { 7656 } finally {
7704 instrumentation.log(); 7657 instrumentation.log();
7705 } 7658 }
7706 } 7659 }
7707 List<Source> get launchableClientLibrarySources { 7660 List<Source> get launchableClientLibrarySources {
7708 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getLaunchableClientLibrarySources"); 7661 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getLaunchableClientLibrarySources");
7709 try { 7662 try {
7710 instrumentation.metric3("contextId", _contextId); 7663 instrumentation.metric3("contextId", _contextId);
7711 List<Source> ret = _basis.launchableClientLibrarySources; 7664 List<Source> ret = basis.launchableClientLibrarySources;
7712 if (ret != null) { 7665 if (ret != null) {
7713 instrumentation.metric2("Source-count", ret.length); 7666 instrumentation.metric2("Source-count", ret.length);
7714 } 7667 }
7715 return ret; 7668 return ret;
7716 } finally { 7669 } finally {
7717 instrumentation.log(); 7670 instrumentation.log();
7718 } 7671 }
7719 } 7672 }
7720 List<Source> get launchableServerLibrarySources { 7673 List<Source> get launchableServerLibrarySources {
7721 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getLaunchableServerLibrarySources"); 7674 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getLaunchableServerLibrarySources");
7722 try { 7675 try {
7723 instrumentation.metric3("contextId", _contextId); 7676 instrumentation.metric3("contextId", _contextId);
7724 List<Source> ret = _basis.launchableServerLibrarySources; 7677 List<Source> ret = basis.launchableServerLibrarySources;
7725 if (ret != null) { 7678 if (ret != null) {
7726 instrumentation.metric2("Source-count", ret.length); 7679 instrumentation.metric2("Source-count", ret.length);
7727 } 7680 }
7728 return ret; 7681 return ret;
7729 } finally { 7682 } finally {
7730 instrumentation.log(); 7683 instrumentation.log();
7731 } 7684 }
7732 } 7685 }
7733 List<Source> getLibrariesContaining(Source source) { 7686 List<Source> getLibrariesContaining(Source source) {
7734 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getLibrariesContaining"); 7687 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getLibrariesContaining");
7735 try { 7688 try {
7736 instrumentation.metric3("contextId", _contextId); 7689 instrumentation.metric3("contextId", _contextId);
7737 List<Source> ret = _basis.getLibrariesContaining(source); 7690 List<Source> ret = basis.getLibrariesContaining(source);
7738 if (ret != null) { 7691 if (ret != null) {
7739 instrumentation.metric2("Source-count", ret.length); 7692 instrumentation.metric2("Source-count", ret.length);
7740 } 7693 }
7741 return ret; 7694 return ret;
7742 } finally { 7695 } finally {
7743 instrumentation.log2(2); 7696 instrumentation.log2(2);
7744 } 7697 }
7745 } 7698 }
7746 List<Source> getLibrariesDependingOn(Source librarySource) { 7699 List<Source> getLibrariesDependingOn(Source librarySource) {
7747 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getLibrariesDependingOn"); 7700 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getLibrariesDependingOn");
7748 try { 7701 try {
7749 instrumentation.metric3("contextId", _contextId); 7702 instrumentation.metric3("contextId", _contextId);
7750 List<Source> ret = _basis.getLibrariesDependingOn(librarySource); 7703 List<Source> ret = basis.getLibrariesDependingOn(librarySource);
7751 if (ret != null) { 7704 if (ret != null) {
7752 instrumentation.metric2("Source-count", ret.length); 7705 instrumentation.metric2("Source-count", ret.length);
7753 } 7706 }
7754 return ret; 7707 return ret;
7755 } finally { 7708 } finally {
7756 instrumentation.log(); 7709 instrumentation.log();
7757 } 7710 }
7758 } 7711 }
7759 LibraryElement getLibraryElement(Source source) { 7712 LibraryElement getLibraryElement(Source source) {
7760 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getLibraryElement"); 7713 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getLibraryElement");
7761 try { 7714 try {
7762 instrumentation.metric3("contextId", _contextId); 7715 instrumentation.metric3("contextId", _contextId);
7763 return _basis.getLibraryElement(source); 7716 return basis.getLibraryElement(source);
7764 } finally { 7717 } finally {
7765 instrumentation.log(); 7718 instrumentation.log();
7766 } 7719 }
7767 } 7720 }
7768 List<Source> get librarySources { 7721 List<Source> get librarySources {
7769 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getLibrarySources"); 7722 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getLibrarySources");
7770 try { 7723 try {
7771 instrumentation.metric3("contextId", _contextId); 7724 instrumentation.metric3("contextId", _contextId);
7772 List<Source> ret = _basis.librarySources; 7725 List<Source> ret = basis.librarySources;
7773 if (ret != null) { 7726 if (ret != null) {
7774 instrumentation.metric2("Source-count", ret.length); 7727 instrumentation.metric2("Source-count", ret.length);
7775 } 7728 }
7776 return ret; 7729 return ret;
7777 } finally { 7730 } finally {
7778 instrumentation.log(); 7731 instrumentation.log();
7779 } 7732 }
7780 } 7733 }
7781 LineInfo getLineInfo(Source source) { 7734 LineInfo getLineInfo(Source source) {
7782 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getLineInfo"); 7735 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getLineInfo");
7783 try { 7736 try {
7784 instrumentation.metric3("contextId", _contextId); 7737 instrumentation.metric3("contextId", _contextId);
7785 return _basis.getLineInfo(source); 7738 return basis.getLineInfo(source);
7786 } finally { 7739 } finally {
7787 instrumentation.log(); 7740 instrumentation.log();
7788 } 7741 }
7789 } 7742 }
7790 Namespace getPublicNamespace(LibraryElement library) => _basis.getPublicNamesp ace(library); 7743 Namespace getPublicNamespace(LibraryElement library) => basis.getPublicNamespa ce(library);
7791 Namespace getPublicNamespace2(Source source) => _basis.getPublicNamespace2(sou rce); 7744 Namespace getPublicNamespace2(Source source) => basis.getPublicNamespace2(sour ce);
7792 CompilationUnit getResolvedCompilationUnit(Source unitSource, LibraryElement l ibrary) { 7745 CompilationUnit getResolvedCompilationUnit(Source unitSource, LibraryElement l ibrary) {
7793 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getResolvedCompilationUnit"); 7746 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getResolvedCompilationUnit");
7794 try { 7747 try {
7795 instrumentation.metric3("contextId", _contextId); 7748 instrumentation.metric3("contextId", _contextId);
7796 return _basis.getResolvedCompilationUnit(unitSource, library); 7749 return basis.getResolvedCompilationUnit(unitSource, library);
7797 } finally { 7750 } finally {
7798 instrumentation.log(); 7751 instrumentation.log();
7799 } 7752 }
7800 } 7753 }
7801 CompilationUnit getResolvedCompilationUnit2(Source unitSource, Source libraryS ource) { 7754 CompilationUnit getResolvedCompilationUnit2(Source unitSource, Source libraryS ource) {
7802 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getResolvedCompilationUnit"); 7755 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getResolvedCompilationUnit");
7803 try { 7756 try {
7804 instrumentation.metric3("contextId", _contextId); 7757 instrumentation.metric3("contextId", _contextId);
7805 return _basis.getResolvedCompilationUnit2(unitSource, librarySource); 7758 return basis.getResolvedCompilationUnit2(unitSource, librarySource);
7806 } finally { 7759 } finally {
7807 instrumentation.log2(2); 7760 instrumentation.log2(2);
7808 } 7761 }
7809 } 7762 }
7810 SourceFactory get sourceFactory { 7763 SourceFactory get sourceFactory {
7811 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getSourceFactory"); 7764 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- getSourceFactory");
7812 try { 7765 try {
7813 instrumentation.metric3("contextId", _contextId); 7766 instrumentation.metric3("contextId", _contextId);
7814 return _basis.sourceFactory; 7767 return basis.sourceFactory;
7815 } finally { 7768 } finally {
7816 instrumentation.log2(2); 7769 instrumentation.log2(2);
7817 } 7770 }
7818 } 7771 }
7819 AnalysisContentStatistics get statistics => _basis.statistics; 7772 AnalysisContentStatistics get statistics => basis.statistics;
7820 bool isClientLibrary(Source librarySource) { 7773 bool isClientLibrary(Source librarySource) {
7821 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- isClientLibrary"); 7774 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- isClientLibrary");
7822 try { 7775 try {
7823 instrumentation.metric3("contextId", _contextId); 7776 instrumentation.metric3("contextId", _contextId);
7824 return _basis.isClientLibrary(librarySource); 7777 return basis.isClientLibrary(librarySource);
7825 } finally { 7778 } finally {
7826 instrumentation.log(); 7779 instrumentation.log();
7827 } 7780 }
7828 } 7781 }
7829 bool isServerLibrary(Source librarySource) { 7782 bool isServerLibrary(Source librarySource) {
7830 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- isServerLibrary"); 7783 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- isServerLibrary");
7831 try { 7784 try {
7832 instrumentation.metric3("contextId", _contextId); 7785 instrumentation.metric3("contextId", _contextId);
7833 return _basis.isServerLibrary(librarySource); 7786 return basis.isServerLibrary(librarySource);
7834 } finally { 7787 } finally {
7835 instrumentation.log(); 7788 instrumentation.log();
7836 } 7789 }
7837 } 7790 }
7838 void mergeContext(AnalysisContext context) { 7791 void mergeContext(AnalysisContext context) {
7839 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- mergeContext"); 7792 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- mergeContext");
7840 try { 7793 try {
7841 instrumentation.metric3("contextId", _contextId); 7794 instrumentation.metric3("contextId", _contextId);
7842 if (context is InstrumentedAnalysisContextImpl) { 7795 if (context is InstrumentedAnalysisContextImpl) {
7843 context = ((context as InstrumentedAnalysisContextImpl))._basis; 7796 context = ((context as InstrumentedAnalysisContextImpl)).basis;
7844 } 7797 }
7845 _basis.mergeContext(context); 7798 basis.mergeContext(context);
7846 } finally { 7799 } finally {
7847 instrumentation.log(); 7800 instrumentation.log();
7848 } 7801 }
7849 } 7802 }
7850 CompilationUnit parseCompilationUnit(Source source) { 7803 CompilationUnit parseCompilationUnit(Source source) {
7851 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- parseCompilationUnit"); 7804 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- parseCompilationUnit");
7852 try { 7805 try {
7853 instrumentation.metric3("contextId", _contextId); 7806 instrumentation.metric3("contextId", _contextId);
7854 return _basis.parseCompilationUnit(source); 7807 return basis.parseCompilationUnit(source);
7855 } on AnalysisException catch (e) { 7808 } on AnalysisException catch (e) {
7856 recordAnalysisException(instrumentation, e); 7809 recordAnalysisException(instrumentation, e);
7857 throw e; 7810 throw e;
7858 } finally { 7811 } finally {
7859 instrumentation.log(); 7812 instrumentation.log();
7860 } 7813 }
7861 } 7814 }
7862 HtmlUnit parseHtmlUnit(Source source) { 7815 HtmlUnit parseHtmlUnit(Source source) {
7863 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- parseHtmlUnit"); 7816 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- parseHtmlUnit");
7864 try { 7817 try {
7865 instrumentation.metric3("contextId", _contextId); 7818 instrumentation.metric3("contextId", _contextId);
7866 return _basis.parseHtmlUnit(source); 7819 return basis.parseHtmlUnit(source);
7867 } on AnalysisException catch (e) { 7820 } on AnalysisException catch (e) {
7868 recordAnalysisException(instrumentation, e); 7821 recordAnalysisException(instrumentation, e);
7869 throw e; 7822 throw e;
7870 } finally { 7823 } finally {
7871 instrumentation.log(); 7824 instrumentation.log();
7872 } 7825 }
7873 } 7826 }
7874 List<ChangeNotice> performAnalysisTask() { 7827 List<ChangeNotice> performAnalysisTask() {
7875 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- performAnalysisTask"); 7828 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- performAnalysisTask");
7876 try { 7829 try {
7877 instrumentation.metric3("contextId", _contextId); 7830 instrumentation.metric3("contextId", _contextId);
7878 List<ChangeNotice> ret = _basis.performAnalysisTask(); 7831 List<ChangeNotice> ret = basis.performAnalysisTask();
7879 if (ret != null) { 7832 if (ret != null) {
7880 instrumentation.metric2("ChangeNotice-count", ret.length); 7833 instrumentation.metric2("ChangeNotice-count", ret.length);
7881 } 7834 }
7882 return ret; 7835 return ret;
7883 } finally { 7836 } finally {
7884 instrumentation.log2(2); 7837 instrumentation.log2(2);
7885 } 7838 }
7886 } 7839 }
7887 void recordLibraryElements(Map<Source, LibraryElement> elementMap) { 7840 void recordLibraryElements(Map<Source, LibraryElement> elementMap) {
7888 _basis.recordLibraryElements(elementMap); 7841 basis.recordLibraryElements(elementMap);
7889 } 7842 }
7890 CompilationUnit resolveCompilationUnit(Source unitSource, LibraryElement libra ry) { 7843 CompilationUnit resolveCompilationUnit(Source unitSource, LibraryElement libra ry) {
7891 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- resolveCompilationUnit"); 7844 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- resolveCompilationUnit");
7892 try { 7845 try {
7893 instrumentation.metric3("contextId", _contextId); 7846 instrumentation.metric3("contextId", _contextId);
7894 return _basis.resolveCompilationUnit(unitSource, library); 7847 return basis.resolveCompilationUnit(unitSource, library);
7895 } on AnalysisException catch (e) { 7848 } on AnalysisException catch (e) {
7896 recordAnalysisException(instrumentation, e); 7849 recordAnalysisException(instrumentation, e);
7897 throw e; 7850 throw e;
7898 } finally { 7851 } finally {
7899 instrumentation.log(); 7852 instrumentation.log();
7900 } 7853 }
7901 } 7854 }
7902 CompilationUnit resolveCompilationUnit2(Source unitSource, Source librarySourc e) { 7855 CompilationUnit resolveCompilationUnit2(Source unitSource, Source librarySourc e) {
7903 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- resolveCompilationUnit"); 7856 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- resolveCompilationUnit");
7904 try { 7857 try {
7905 instrumentation.metric3("contextId", _contextId); 7858 instrumentation.metric3("contextId", _contextId);
7906 return _basis.resolveCompilationUnit2(unitSource, librarySource); 7859 return basis.resolveCompilationUnit2(unitSource, librarySource);
7907 } on AnalysisException catch (e) { 7860 } on AnalysisException catch (e) {
7908 recordAnalysisException(instrumentation, e); 7861 recordAnalysisException(instrumentation, e);
7909 throw e; 7862 throw e;
7910 } finally { 7863 } finally {
7911 instrumentation.log(); 7864 instrumentation.log();
7912 } 7865 }
7913 } 7866 }
7914 HtmlUnit resolveHtmlUnit(Source htmlSource) { 7867 HtmlUnit resolveHtmlUnit(Source htmlSource) {
7915 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- resolveHtmlUnit"); 7868 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- resolveHtmlUnit");
7916 try { 7869 try {
7917 instrumentation.metric3("contextId", _contextId); 7870 instrumentation.metric3("contextId", _contextId);
7918 return _basis.resolveHtmlUnit(htmlSource); 7871 return basis.resolveHtmlUnit(htmlSource);
7919 } on AnalysisException catch (e) { 7872 } on AnalysisException catch (e) {
7920 recordAnalysisException(instrumentation, e); 7873 recordAnalysisException(instrumentation, e);
7921 throw e; 7874 throw e;
7922 } finally { 7875 } finally {
7923 instrumentation.log(); 7876 instrumentation.log();
7924 } 7877 }
7925 } 7878 }
7926 void set analysisOptions(AnalysisOptions options) { 7879 void set analysisOptions(AnalysisOptions options) {
7927 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- setAnalysisOptions"); 7880 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- setAnalysisOptions");
7928 try { 7881 try {
7929 instrumentation.metric3("contextId", _contextId); 7882 instrumentation.metric3("contextId", _contextId);
7930 _basis.analysisOptions = options; 7883 basis.analysisOptions = options;
7931 } finally { 7884 } finally {
7932 instrumentation.log(); 7885 instrumentation.log();
7933 } 7886 }
7934 } 7887 }
7935 void set analysisPriorityOrder(List<Source> sources) { 7888 void set analysisPriorityOrder(List<Source> sources) {
7936 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- setAnalysisPriorityOrder"); 7889 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- setAnalysisPriorityOrder");
7937 try { 7890 try {
7938 instrumentation.metric3("contextId", _contextId); 7891 instrumentation.metric3("contextId", _contextId);
7939 _basis.analysisPriorityOrder = sources; 7892 basis.analysisPriorityOrder = sources;
7940 } finally { 7893 } finally {
7941 instrumentation.log(); 7894 instrumentation.log();
7942 } 7895 }
7943 } 7896 }
7944 void setContents(Source source, String contents) { 7897 void setContents(Source source, String contents) {
7945 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- setContents"); 7898 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- setContents");
7946 try { 7899 try {
7947 instrumentation.metric3("contextId", _contextId); 7900 instrumentation.metric3("contextId", _contextId);
7948 _basis.setContents(source, contents); 7901 basis.setContents(source, contents);
7949 } finally { 7902 } finally {
7950 instrumentation.log(); 7903 instrumentation.log();
7951 } 7904 }
7952 } 7905 }
7953 void set sourceFactory(SourceFactory factory) { 7906 void set sourceFactory(SourceFactory factory) {
7954 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- setSourceFactory"); 7907 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- setSourceFactory");
7955 try { 7908 try {
7956 instrumentation.metric3("contextId", _contextId); 7909 instrumentation.metric3("contextId", _contextId);
7957 _basis.sourceFactory = factory; 7910 basis.sourceFactory = factory;
7958 } finally { 7911 } finally {
7959 instrumentation.log(); 7912 instrumentation.log();
7960 } 7913 }
7961 } 7914 }
7962 Iterable<Source> sourcesToResolve(List<Source> changedSources) { 7915 Iterable<Source> sourcesToResolve(List<Source> changedSources) {
7963 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- sourcesToResolve"); 7916 InstrumentationBuilder instrumentation = Instrumentation.builder2("Analysis- sourcesToResolve");
7964 try { 7917 try {
7965 instrumentation.metric3("contextId", _contextId); 7918 instrumentation.metric3("contextId", _contextId);
7966 return _basis.sourcesToResolve(changedSources); 7919 return basis.sourcesToResolve(changedSources);
7967 } finally { 7920 } finally {
7968 instrumentation.log(); 7921 instrumentation.log();
7969 } 7922 }
7970 } 7923 }
7971 } 7924 }
7972 /** 7925 /**
7973 * The interface `InternalAnalysisContext` defines additional behavior for an an alysis context 7926 * The interface `InternalAnalysisContext` defines additional behavior for an an alysis context
7974 * that is required by internal users of the context. 7927 * that is required by internal users of the context.
7975 */ 7928 */
7976 abstract class InternalAnalysisContext implements AnalysisContext { 7929 abstract class InternalAnalysisContext implements AnalysisContext {
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
8223 /** 8176 /**
8224 * Instances of the class `ResolvableCompilationUnit` represent a compilation un it that is not 8177 * Instances of the class `ResolvableCompilationUnit` represent a compilation un it that is not
8225 * referenced by any other objects and for which we have modification stamp info rmation. It is used 8178 * referenced by any other objects and for which we have modification stamp info rmation. It is used
8226 * by the [LibraryResolver] to resolve a library. 8179 * by the [LibraryResolver] to resolve a library.
8227 */ 8180 */
8228 class ResolvableCompilationUnit { 8181 class ResolvableCompilationUnit {
8229 8182
8230 /** 8183 /**
8231 * The modification time of the source from which the AST was created. 8184 * The modification time of the source from which the AST was created.
8232 */ 8185 */
8233 int _modificationTime = 0; 8186 int modificationTime = 0;
8234 8187
8235 /** 8188 /**
8236 * The AST that was created from the source. 8189 * The AST that was created from the source.
8237 */ 8190 */
8238 CompilationUnit _unit; 8191 CompilationUnit compilationUnit;
8239 8192
8240 /** 8193 /**
8241 * Initialize a newly created holder to hold the given values. 8194 * Initialize a newly created holder to hold the given values.
8242 * 8195 *
8243 * @param modificationTime the modification time of the source from which the AST was created 8196 * @param modificationTime the modification time of the source from which the AST was created
8244 * @param unit the AST that was created from the source 8197 * @param unit the AST that was created from the source
8245 */ 8198 */
8246 ResolvableCompilationUnit(int modificationTime, CompilationUnit unit) { 8199 ResolvableCompilationUnit(int modificationTime, CompilationUnit unit) {
8247 this._modificationTime = modificationTime; 8200 this.modificationTime = modificationTime;
8248 this._unit = unit; 8201 this.compilationUnit = unit;
8249 } 8202 }
8250
8251 /**
8252 * Return the AST that was created from the source.
8253 *
8254 * @return the AST that was created from the source
8255 */
8256 CompilationUnit get compilationUnit => _unit;
8257
8258 /**
8259 * Return the modification time of the source from which the AST was created.
8260 *
8261 * @return the modification time of the source from which the AST was created
8262 */
8263 int get modificationTime => _modificationTime;
8264 } 8203 }
8265 /** 8204 /**
8266 * Instances of the class `ResolvableHtmlUnit` represent an HTML unit that is no t referenced 8205 * Instances of the class `ResolvableHtmlUnit` represent an HTML unit that is no t referenced
8267 * by any other objects and for which we have modification stamp information. It is used by the 8206 * by any other objects and for which we have modification stamp information. It is used by the
8268 * [ResolveHtmlTask] to resolve an HTML source. 8207 * [ResolveHtmlTask] to resolve an HTML source.
8269 */ 8208 */
8270 class ResolvableHtmlUnit { 8209 class ResolvableHtmlUnit {
8271 8210
8272 /** 8211 /**
8273 * The modification time of the source from which the AST was created. 8212 * The modification time of the source from which the AST was created.
8274 */ 8213 */
8275 int _modificationTime = 0; 8214 int modificationTime = 0;
8276 8215
8277 /** 8216 /**
8278 * The AST that was created from the source. 8217 * The AST that was created from the source.
8279 */ 8218 */
8280 HtmlUnit _unit; 8219 HtmlUnit compilationUnit;
8281 8220
8282 /** 8221 /**
8283 * Initialize a newly created holder to hold the given values. 8222 * Initialize a newly created holder to hold the given values.
8284 * 8223 *
8285 * @param modificationTime the modification time of the source from which the AST was created 8224 * @param modificationTime the modification time of the source from which the AST was created
8286 * @param unit the AST that was created from the source 8225 * @param unit the AST that was created from the source
8287 */ 8226 */
8288 ResolvableHtmlUnit(int modificationTime, HtmlUnit unit) { 8227 ResolvableHtmlUnit(int modificationTime, HtmlUnit unit) {
8289 this._modificationTime = modificationTime; 8228 this.modificationTime = modificationTime;
8290 this._unit = unit; 8229 this.compilationUnit = unit;
8291 } 8230 }
8292
8293 /**
8294 * Return the AST that was created from the source.
8295 *
8296 * @return the AST that was created from the source
8297 */
8298 HtmlUnit get compilationUnit => _unit;
8299
8300 /**
8301 * Return the modification time of the source from which the AST was created.
8302 *
8303 * @return the modification time of the source from which the AST was created
8304 */
8305 int get modificationTime => _modificationTime;
8306 } 8231 }
8307 /** 8232 /**
8308 * The abstract class `AnalysisTask` defines the behavior of objects used to per form an 8233 * The abstract class `AnalysisTask` defines the behavior of objects used to per form an
8309 * analysis task. 8234 * analysis task.
8310 */ 8235 */
8311 abstract class AnalysisTask { 8236 abstract class AnalysisTask {
8312 8237
8313 /** 8238 /**
8314 * The context in which the task is to be performed. 8239 * The context in which the task is to be performed.
8315 */ 8240 */
8316 InternalAnalysisContext _context; 8241 InternalAnalysisContext context;
8317 8242
8318 /** 8243 /**
8319 * The exception that was thrown while performing this task, or `null` if the task completed 8244 * The exception that was thrown while performing this task, or `null` if the task completed
8320 * successfully. 8245 * successfully.
8321 */ 8246 */
8322 AnalysisException _thrownException; 8247 AnalysisException exception;
8323 8248
8324 /** 8249 /**
8325 * Initialize a newly created task to perform analysis within the given contex t. 8250 * Initialize a newly created task to perform analysis within the given contex t.
8326 * 8251 *
8327 * @param context the context in which the task is to be performed 8252 * @param context the context in which the task is to be performed
8328 */ 8253 */
8329 AnalysisTask(InternalAnalysisContext context) { 8254 AnalysisTask(InternalAnalysisContext context) {
8330 this._context = context; 8255 this.context = context;
8331 } 8256 }
8332 8257
8333 /** 8258 /**
8334 * Use the given visitor to visit this task. 8259 * Use the given visitor to visit this task.
8335 * 8260 *
8336 * @param visitor the visitor that should be used to visit this task 8261 * @param visitor the visitor that should be used to visit this task
8337 * @return the value returned by the visitor 8262 * @return the value returned by the visitor
8338 * @throws AnalysisException if the visitor throws the exception 8263 * @throws AnalysisException if the visitor throws the exception
8339 */ 8264 */
8340 accept(AnalysisTaskVisitor visitor); 8265 accept(AnalysisTaskVisitor visitor);
8341 8266
8342 /** 8267 /**
8343 * Return the exception that was thrown while performing this task, or `null` if the task
8344 * completed successfully.
8345 *
8346 * @return the exception that was thrown while performing this task
8347 */
8348 AnalysisException get exception => _thrownException;
8349
8350 /**
8351 * Perform this analysis task and use the given visitor to visit this task aft er it has completed. 8268 * Perform this analysis task and use the given visitor to visit this task aft er it has completed.
8352 * 8269 *
8353 * @param visitor the visitor used to visit this task after it has completed 8270 * @param visitor the visitor used to visit this task after it has completed
8354 * @return the value returned by the visitor 8271 * @return the value returned by the visitor
8355 * @throws AnalysisException if the visitor throws the exception 8272 * @throws AnalysisException if the visitor throws the exception
8356 */ 8273 */
8357 Object perform(AnalysisTaskVisitor visitor) { 8274 Object perform(AnalysisTaskVisitor visitor) {
8358 try { 8275 try {
8359 safelyPerform(); 8276 safelyPerform();
8360 } on AnalysisException catch (exception) { 8277 } on AnalysisException catch (exception) {
8361 _thrownException = exception; 8278 exception = exception;
8362 AnalysisEngine.instance.logger.logInformation2("Task failed: ${taskDescrip tion}", exception); 8279 AnalysisEngine.instance.logger.logInformation2("Task failed: ${taskDescrip tion}", exception);
8363 } 8280 }
8364 return accept(visitor); 8281 return accept(visitor);
8365 } 8282 }
8366 String toString() => taskDescription; 8283 String toString() => taskDescription;
8367 8284
8368 /** 8285 /**
8369 * Return the context in which the task is to be performed.
8370 *
8371 * @return the context in which the task is to be performed
8372 */
8373 InternalAnalysisContext get context => _context;
8374
8375 /**
8376 * Return a textual description of this task. 8286 * Return a textual description of this task.
8377 * 8287 *
8378 * @return a textual description of this task 8288 * @return a textual description of this task
8379 */ 8289 */
8380 String get taskDescription; 8290 String get taskDescription;
8381 8291
8382 /** 8292 /**
8383 * Perform this analysis task, protected by an exception handler. 8293 * Perform this analysis task, protected by an exception handler.
8384 * 8294 *
8385 * @throws AnalysisException if an exception occurs while performing the task 8295 * @throws AnalysisException if an exception occurs while performing the task
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
8455 E visitResolveHtmlTask(ResolveHtmlTask task); 8365 E visitResolveHtmlTask(ResolveHtmlTask task);
8456 } 8366 }
8457 /** 8367 /**
8458 * Instances of the class `ParseDartTask` parse a specific source as a Dart file . 8368 * Instances of the class `ParseDartTask` parse a specific source as a Dart file .
8459 */ 8369 */
8460 class ParseDartTask extends AnalysisTask { 8370 class ParseDartTask extends AnalysisTask {
8461 8371
8462 /** 8372 /**
8463 * The source to be parsed. 8373 * The source to be parsed.
8464 */ 8374 */
8465 Source _source; 8375 Source source;
8466 8376
8467 /** 8377 /**
8468 * The time at which the contents of the source were last modified. 8378 * The time at which the contents of the source were last modified.
8469 */ 8379 */
8470 int _modificationTime = -1; 8380 int modificationTime = -1;
8471 8381
8472 /** 8382 /**
8473 * The line information that was produced. 8383 * The line information that was produced.
8474 */ 8384 */
8475 LineInfo _lineInfo; 8385 LineInfo lineInfo;
8476 8386
8477 /** 8387 /**
8478 * The compilation unit that was produced by parsing the source. 8388 * The compilation unit that was produced by parsing the source.
8479 */ 8389 */
8480 CompilationUnit _unit; 8390 CompilationUnit compilationUnit;
8481 8391
8482 /** 8392 /**
8483 * The errors that were produced by scanning and parsing the source. 8393 * The errors that were produced by scanning and parsing the source.
8484 */ 8394 */
8485 List<AnalysisError> _errors = AnalysisError.NO_ERRORS; 8395 List<AnalysisError> errors = AnalysisError.NO_ERRORS;
8486 8396
8487 /** 8397 /**
8488 * A flag indicating whether the source contains a 'part of' directive. 8398 * A flag indicating whether the source contains a 'part of' directive.
8489 */ 8399 */
8490 bool _hasPartOfDirective2 = false; 8400 bool _hasPartOfDirective2 = false;
8491 8401
8492 /** 8402 /**
8493 * A flag indicating whether the source contains a 'library' directive. 8403 * A flag indicating whether the source contains a 'library' directive.
8494 */ 8404 */
8495 bool _hasLibraryDirective2 = false; 8405 bool _hasLibraryDirective2 = false;
(...skipping 13 matching lines...) Expand all
8509 */ 8419 */
8510 Set<Source> _includedSources = new Set<Source>(); 8420 Set<Source> _includedSources = new Set<Source>();
8511 8421
8512 /** 8422 /**
8513 * Initialize a newly created task to perform analysis within the given contex t. 8423 * Initialize a newly created task to perform analysis within the given contex t.
8514 * 8424 *
8515 * @param context the context in which the task is to be performed 8425 * @param context the context in which the task is to be performed
8516 * @param source the source to be parsed 8426 * @param source the source to be parsed
8517 */ 8427 */
8518 ParseDartTask(InternalAnalysisContext context, Source source) : super(context) { 8428 ParseDartTask(InternalAnalysisContext context, Source source) : super(context) {
8519 this._source = source; 8429 this.source = source;
8520 } 8430 }
8521 accept(AnalysisTaskVisitor visitor) => visitor.visitParseDartTask(this); 8431 accept(AnalysisTaskVisitor visitor) => visitor.visitParseDartTask(this);
8522 8432
8523 /** 8433 /**
8524 * Return the compilation unit that was produced by parsing the source, or `nu ll` if the
8525 * task has not yet been performed or if an exception occurred.
8526 *
8527 * @return the compilation unit that was produced by parsing the source
8528 */
8529 CompilationUnit get compilationUnit => _unit;
8530
8531 /**
8532 * Return the errors that were produced by scanning and parsing the source, or `null` if the
8533 * task has not yet been performed or if an exception occurred.
8534 *
8535 * @return the errors that were produced by scanning and parsing the source
8536 */
8537 List<AnalysisError> get errors => _errors;
8538
8539 /**
8540 * Return an array containing the sources referenced by 'export' directives, o r an empty array if 8434 * Return an array containing the sources referenced by 'export' directives, o r an empty array if
8541 * the task has not yet been performed or if an exception occurred. 8435 * the task has not yet been performed or if an exception occurred.
8542 * 8436 *
8543 * @return an array containing the sources referenced by 'export' directives 8437 * @return an array containing the sources referenced by 'export' directives
8544 */ 8438 */
8545 List<Source> get exportedSources => toArray(_exportedSources); 8439 List<Source> get exportedSources => toArray(_exportedSources);
8546 8440
8547 /** 8441 /**
8548 * Return an array containing the sources referenced by 'import' directives, o r an empty array if 8442 * Return an array containing the sources referenced by 'import' directives, o r an empty array if
8549 * the task has not yet been performed or if an exception occurred. 8443 * the task has not yet been performed or if an exception occurred.
8550 * 8444 *
8551 * @return an array containing the sources referenced by 'import' directives 8445 * @return an array containing the sources referenced by 'import' directives
8552 */ 8446 */
8553 List<Source> get importedSources => toArray(_importedSources); 8447 List<Source> get importedSources => toArray(_importedSources);
8554 8448
8555 /** 8449 /**
8556 * Return an array containing the sources referenced by 'part' directives, or an empty array if 8450 * Return an array containing the sources referenced by 'part' directives, or an empty array if
8557 * the task has not yet been performed or if an exception occurred. 8451 * the task has not yet been performed or if an exception occurred.
8558 * 8452 *
8559 * @return an array containing the sources referenced by 'part' directives 8453 * @return an array containing the sources referenced by 'part' directives
8560 */ 8454 */
8561 List<Source> get includedSources => toArray(_includedSources); 8455 List<Source> get includedSources => toArray(_includedSources);
8562 8456
8563 /** 8457 /**
8564 * Return the line information that was produced, or `null` if the task has no t yet been
8565 * performed or if an exception occurred.
8566 *
8567 * @return the line information that was produced
8568 */
8569 LineInfo get lineInfo => _lineInfo;
8570
8571 /**
8572 * Return the time at which the contents of the source that was parsed were la st modified, or a
8573 * negative value if the task has not yet been performed or if an exception oc curred.
8574 *
8575 * @return the time at which the contents of the source that was parsed were l ast modified
8576 */
8577 int get modificationTime => _modificationTime;
8578
8579 /**
8580 * Return the source that is to be parsed.
8581 *
8582 * @return the source to be parsed
8583 */
8584 Source get source => _source;
8585
8586 /**
8587 * Return `true` if the source contains a 'library' directive, or `false` if t he task 8458 * Return `true` if the source contains a 'library' directive, or `false` if t he task
8588 * has not yet been performed or if an exception occurred. 8459 * has not yet been performed or if an exception occurred.
8589 * 8460 *
8590 * @return `true` if the source contains a 'library' directive 8461 * @return `true` if the source contains a 'library' directive
8591 */ 8462 */
8592 bool hasLibraryDirective() => _hasLibraryDirective2; 8463 bool hasLibraryDirective() => _hasLibraryDirective2;
8593 8464
8594 /** 8465 /**
8595 * Return `true` if the source contains a 'part of' directive, or `false` if t he task 8466 * Return `true` if the source contains a 'part of' directive, or `false` if t he task
8596 * has not yet been performed or if an exception occurred. 8467 * has not yet been performed or if an exception occurred.
8597 * 8468 *
8598 * @return `true` if the source contains a 'part of' directive 8469 * @return `true` if the source contains a 'part of' directive
8599 */ 8470 */
8600 bool hasPartOfDirective() => _hasPartOfDirective2; 8471 bool hasPartOfDirective() => _hasPartOfDirective2;
8601 String get taskDescription => "parse as dart ${_source.fullName}"; 8472 String get taskDescription => "parse as dart ${source.fullName}";
8602 void internalPerform() { 8473 void internalPerform() {
8603 RecordingErrorListener errorListener = new RecordingErrorListener(); 8474 RecordingErrorListener errorListener = new RecordingErrorListener();
8604 List<Token> token = [null]; 8475 List<Token> token = [null];
8605 Source_ContentReceiver receiver = new Source_ContentReceiver_10(this, errorL istener, token); 8476 Source_ContentReceiver receiver = new Source_ContentReceiver_10(this, errorL istener, token);
8606 try { 8477 try {
8607 _source.getContents(receiver); 8478 source.getContents(receiver);
8608 } catch (exception) { 8479 } catch (exception) {
8609 _modificationTime = _source.modificationStamp; 8480 modificationTime = source.modificationStamp;
8610 throw new AnalysisException.con3(exception); 8481 throw new AnalysisException.con3(exception);
8611 } 8482 }
8612 Parser parser = new Parser(_source, errorListener); 8483 Parser parser = new Parser(source, errorListener);
8613 _unit = parser.parseCompilationUnit(token[0]); 8484 compilationUnit = parser.parseCompilationUnit(token[0]);
8614 _errors = errorListener.getErrors2(_source); 8485 errors = errorListener.getErrors2(source);
8615 for (Directive directive in _unit.directives) { 8486 for (Directive directive in compilationUnit.directives) {
8616 if (directive is ExportDirective) { 8487 if (directive is ExportDirective) {
8617 Source exportSource = resolveSource(_source, directive as ExportDirectiv e); 8488 Source exportSource = resolveSource(source, directive as ExportDirective );
8618 if (exportSource != null) { 8489 if (exportSource != null) {
8619 javaSetAdd(_exportedSources, exportSource); 8490 javaSetAdd(_exportedSources, exportSource);
8620 } 8491 }
8621 } else if (directive is ImportDirective) { 8492 } else if (directive is ImportDirective) {
8622 Source importSource = resolveSource(_source, directive as ImportDirectiv e); 8493 Source importSource = resolveSource(source, directive as ImportDirective );
8623 if (importSource != null) { 8494 if (importSource != null) {
8624 javaSetAdd(_importedSources, importSource); 8495 javaSetAdd(_importedSources, importSource);
8625 } 8496 }
8626 } else if (directive is LibraryDirective) { 8497 } else if (directive is LibraryDirective) {
8627 _hasLibraryDirective2 = true; 8498 _hasLibraryDirective2 = true;
8628 } else if (directive is PartDirective) { 8499 } else if (directive is PartDirective) {
8629 Source partSource = resolveSource(_source, directive as PartDirective); 8500 Source partSource = resolveSource(source, directive as PartDirective);
8630 if (partSource != null) { 8501 if (partSource != null) {
8631 javaSetAdd(_includedSources, partSource); 8502 javaSetAdd(_includedSources, partSource);
8632 } 8503 }
8633 } else if (directive is PartOfDirective) { 8504 } else if (directive is PartOfDirective) {
8634 _hasPartOfDirective2 = true; 8505 _hasPartOfDirective2 = true;
8635 } 8506 }
8636 } 8507 }
8637 _unit.parsingErrors = _errors; 8508 compilationUnit.parsingErrors = errors;
8638 _unit.lineInfo = _lineInfo; 8509 compilationUnit.lineInfo = lineInfo;
8639 } 8510 }
8640 8511
8641 /** 8512 /**
8642 * Return the result of resolving the URI of the given URI-based directive aga inst the URI of the 8513 * Return the result of resolving the URI of the given URI-based directive aga inst the URI of the
8643 * given library, or `null` if the URI is not valid. 8514 * given library, or `null` if the URI is not valid.
8644 * 8515 *
8645 * @param librarySource the source representing the library containing the dir ective 8516 * @param librarySource the source representing the library containing the dir ective
8646 * @param directive the directive which URI should be resolved 8517 * @param directive the directive which URI should be resolved
8647 * @return the result of resolving the URI against the URI of the library 8518 * @return the result of resolving the URI against the URI of the library
8648 */ 8519 */
(...skipping 28 matching lines...) Expand all
8677 } 8548 }
8678 return new List.from(sources); 8549 return new List.from(sources);
8679 } 8550 }
8680 } 8551 }
8681 class Source_ContentReceiver_10 implements Source_ContentReceiver { 8552 class Source_ContentReceiver_10 implements Source_ContentReceiver {
8682 final ParseDartTask ParseDartTask_this; 8553 final ParseDartTask ParseDartTask_this;
8683 RecordingErrorListener errorListener; 8554 RecordingErrorListener errorListener;
8684 List<Token> token; 8555 List<Token> token;
8685 Source_ContentReceiver_10(this.ParseDartTask_this, this.errorListener, this.to ken); 8556 Source_ContentReceiver_10(this.ParseDartTask_this, this.errorListener, this.to ken);
8686 void accept(CharBuffer contents, int modificationTime2) { 8557 void accept(CharBuffer contents, int modificationTime2) {
8687 ParseDartTask_this._modificationTime = modificationTime2; 8558 ParseDartTask_this.modificationTime = modificationTime2;
8688 CharBufferScanner scanner = new CharBufferScanner(ParseDartTask_this._source , contents, errorListener); 8559 CharBufferScanner scanner = new CharBufferScanner(ParseDartTask_this.source, contents, errorListener);
8689 token[0] = scanner.tokenize(); 8560 token[0] = scanner.tokenize();
8690 ParseDartTask_this._lineInfo = new LineInfo(scanner.lineStarts); 8561 ParseDartTask_this.lineInfo = new LineInfo(scanner.lineStarts);
8691 } 8562 }
8692 void accept2(String contents, int modificationTime2) { 8563 void accept2(String contents, int modificationTime2) {
8693 ParseDartTask_this._modificationTime = modificationTime2; 8564 ParseDartTask_this.modificationTime = modificationTime2;
8694 StringScanner scanner = new StringScanner(ParseDartTask_this._source, conten ts, errorListener); 8565 StringScanner scanner = new StringScanner(ParseDartTask_this.source, content s, errorListener);
8695 token[0] = scanner.tokenize(); 8566 token[0] = scanner.tokenize();
8696 ParseDartTask_this._lineInfo = new LineInfo(scanner.lineStarts); 8567 ParseDartTask_this.lineInfo = new LineInfo(scanner.lineStarts);
8697 } 8568 }
8698 } 8569 }
8699 /** 8570 /**
8700 * Instances of the class `ParseHtmlTask` parse a specific source as an HTML fil e. 8571 * Instances of the class `ParseHtmlTask` parse a specific source as an HTML fil e.
8701 */ 8572 */
8702 class ParseHtmlTask extends AnalysisTask { 8573 class ParseHtmlTask extends AnalysisTask {
8703 8574
8704 /** 8575 /**
8705 * The source to be parsed. 8576 * The source to be parsed.
8706 */ 8577 */
8707 Source _source; 8578 Source source;
8708 8579
8709 /** 8580 /**
8710 * The time at which the contents of the source were last modified. 8581 * The time at which the contents of the source were last modified.
8711 */ 8582 */
8712 int _modificationTime = -1; 8583 int modificationTime = -1;
8713 8584
8714 /** 8585 /**
8715 * The line information that was produced. 8586 * The line information that was produced.
8716 */ 8587 */
8717 LineInfo _lineInfo; 8588 LineInfo lineInfo;
8718 8589
8719 /** 8590 /**
8720 * The HTML unit that was produced by parsing the source. 8591 * The HTML unit that was produced by parsing the source.
8721 */ 8592 */
8722 HtmlUnit _unit; 8593 HtmlUnit htmlUnit;
8723 8594
8724 /** 8595 /**
8725 * An array containing the sources of the libraries that are referenced within the HTML. 8596 * An array containing the sources of the libraries that are referenced within the HTML.
8726 */ 8597 */
8727 List<Source> _referencedLibraries = Source.EMPTY_ARRAY; 8598 List<Source> referencedLibraries = Source.EMPTY_ARRAY;
8728 8599
8729 /** 8600 /**
8730 * The name of the 'src' attribute in a HTML tag. 8601 * The name of the 'src' attribute in a HTML tag.
8731 */ 8602 */
8732 static String _ATTRIBUTE_SRC = "src"; 8603 static String _ATTRIBUTE_SRC = "src";
8733 8604
8734 /** 8605 /**
8735 * The name of the 'type' attribute in a HTML tag. 8606 * The name of the 'type' attribute in a HTML tag.
8736 */ 8607 */
8737 static String _ATTRIBUTE_TYPE = "type"; 8608 static String _ATTRIBUTE_TYPE = "type";
8738 8609
8739 /** 8610 /**
8740 * The name of the 'script' tag in an HTML file. 8611 * The name of the 'script' tag in an HTML file.
8741 */ 8612 */
8742 static String _TAG_SCRIPT = "script"; 8613 static String _TAG_SCRIPT = "script";
8743 8614
8744 /** 8615 /**
8745 * The value of the 'type' attribute of a 'script' tag that indicates that the script is written 8616 * The value of the 'type' attribute of a 'script' tag that indicates that the script is written
8746 * in Dart. 8617 * in Dart.
8747 */ 8618 */
8748 static String _TYPE_DART = "application/dart"; 8619 static String _TYPE_DART = "application/dart";
8749 8620
8750 /** 8621 /**
8751 * Initialize a newly created task to perform analysis within the given contex t. 8622 * Initialize a newly created task to perform analysis within the given contex t.
8752 * 8623 *
8753 * @param context the context in which the task is to be performed 8624 * @param context the context in which the task is to be performed
8754 * @param source the source to be parsed 8625 * @param source the source to be parsed
8755 */ 8626 */
8756 ParseHtmlTask(InternalAnalysisContext context, Source source) : super(context) { 8627 ParseHtmlTask(InternalAnalysisContext context, Source source) : super(context) {
8757 this._source = source; 8628 this.source = source;
8758 } 8629 }
8759 accept(AnalysisTaskVisitor visitor) => visitor.visitParseHtmlTask(this); 8630 accept(AnalysisTaskVisitor visitor) => visitor.visitParseHtmlTask(this);
8760 8631 String get taskDescription => "parse as html ${source.fullName}";
8761 /**
8762 * Return the HTML unit that was produced by parsing the source.
8763 *
8764 * @return the HTML unit that was produced by parsing the source
8765 */
8766 HtmlUnit get htmlUnit => _unit;
8767
8768 /**
8769 * Return the line information that was produced, or `null` if the task has no t yet been
8770 * performed or if an exception occurred.
8771 *
8772 * @return the line information that was produced
8773 */
8774 LineInfo get lineInfo => _lineInfo;
8775
8776 /**
8777 * Return the time at which the contents of the source that was parsed were la st modified, or a
8778 * negative value if the task has not yet been performed or if an exception oc curred.
8779 *
8780 * @return the time at which the contents of the source that was parsed were l ast modified
8781 */
8782 int get modificationTime => _modificationTime;
8783
8784 /**
8785 * Return an array containing the sources of the libraries that are referenced within the HTML.
8786 *
8787 * @return the sources of the libraries that are referenced within the HTML
8788 */
8789 List<Source> get referencedLibraries => _referencedLibraries;
8790
8791 /**
8792 * Return the source that was or is to be parsed.
8793 *
8794 * @return the source was or is to be parsed
8795 */
8796 Source get source => _source;
8797 String get taskDescription => "parse as html ${_source.fullName}";
8798 void internalPerform() { 8632 void internalPerform() {
8799 HtmlScanner scanner = new HtmlScanner(_source); 8633 HtmlScanner scanner = new HtmlScanner(source);
8800 try { 8634 try {
8801 _source.getContents(scanner); 8635 source.getContents(scanner);
8802 } catch (exception) { 8636 } catch (exception) {
8803 throw new AnalysisException.con3(exception); 8637 throw new AnalysisException.con3(exception);
8804 } 8638 }
8805 HtmlScanResult scannerResult = scanner.result; 8639 HtmlScanResult scannerResult = scanner.result;
8806 _modificationTime = scannerResult.modificationTime; 8640 modificationTime = scannerResult.modificationTime;
8807 _lineInfo = new LineInfo(scannerResult.lineStarts); 8641 lineInfo = new LineInfo(scannerResult.lineStarts);
8808 HtmlParseResult result = new HtmlParser(_source).parse(scannerResult); 8642 HtmlParseResult result = new HtmlParser(source).parse(scannerResult);
8809 _unit = result.htmlUnit; 8643 htmlUnit = result.htmlUnit;
8810 _referencedLibraries = librarySources; 8644 referencedLibraries = librarySources;
8811 } 8645 }
8812 8646
8813 /** 8647 /**
8814 * Return the sources of libraries that are referenced in the specified HTML f ile. 8648 * Return the sources of libraries that are referenced in the specified HTML f ile.
8815 * 8649 *
8816 * @return the sources of libraries that are referenced in the HTML file 8650 * @return the sources of libraries that are referenced in the HTML file
8817 */ 8651 */
8818 List<Source> get librarySources { 8652 List<Source> get librarySources {
8819 List<Source> libraries = new List<Source>(); 8653 List<Source> libraries = new List<Source>();
8820 _unit.accept(new RecursiveXmlVisitor_11(this, libraries)); 8654 htmlUnit.accept(new RecursiveXmlVisitor_11(this, libraries));
8821 if (libraries.isEmpty) { 8655 if (libraries.isEmpty) {
8822 return Source.EMPTY_ARRAY; 8656 return Source.EMPTY_ARRAY;
8823 } 8657 }
8824 return new List.from(libraries); 8658 return new List.from(libraries);
8825 } 8659 }
8826 } 8660 }
8827 class RecursiveXmlVisitor_11 extends RecursiveXmlVisitor<Object> { 8661 class RecursiveXmlVisitor_11 extends RecursiveXmlVisitor<Object> {
8828 final ParseHtmlTask ParseHtmlTask_this; 8662 final ParseHtmlTask ParseHtmlTask_this;
8829 List<Source> libraries; 8663 List<Source> libraries;
8830 RecursiveXmlVisitor_11(this.ParseHtmlTask_this, this.libraries) : super(); 8664 RecursiveXmlVisitor_11(this.ParseHtmlTask_this, this.libraries) : super();
8831 Object visitXmlTagNode(XmlTagNode node) { 8665 Object visitXmlTagNode(XmlTagNode node) {
8832 if (javaStringEqualsIgnoreCase(node.tag.lexeme, ParseHtmlTask._TAG_SCRIPT)) { 8666 if (javaStringEqualsIgnoreCase(node.tag.lexeme, ParseHtmlTask._TAG_SCRIPT)) {
8833 bool isDartScript = false; 8667 bool isDartScript = false;
8834 XmlAttributeNode scriptAttribute = null; 8668 XmlAttributeNode scriptAttribute = null;
8835 for (XmlAttributeNode attribute in node.attributes) { 8669 for (XmlAttributeNode attribute in node.attributes) {
8836 if (javaStringEqualsIgnoreCase(attribute.name.lexeme, ParseHtmlTask._ATT RIBUTE_SRC)) { 8670 if (javaStringEqualsIgnoreCase(attribute.name.lexeme, ParseHtmlTask._ATT RIBUTE_SRC)) {
8837 scriptAttribute = attribute; 8671 scriptAttribute = attribute;
8838 } else if (javaStringEqualsIgnoreCase(attribute.name.lexeme, ParseHtmlTa sk._ATTRIBUTE_TYPE)) { 8672 } else if (javaStringEqualsIgnoreCase(attribute.name.lexeme, ParseHtmlTa sk._ATTRIBUTE_TYPE)) {
8839 if (javaStringEqualsIgnoreCase(attribute.text, ParseHtmlTask._TYPE_DAR T)) { 8673 if (javaStringEqualsIgnoreCase(attribute.text, ParseHtmlTask._TYPE_DAR T)) {
8840 isDartScript = true; 8674 isDartScript = true;
8841 } 8675 }
8842 } 8676 }
8843 } 8677 }
8844 if (isDartScript && scriptAttribute != null) { 8678 if (isDartScript && scriptAttribute != null) {
8845 try { 8679 try {
8846 Uri uri = new Uri(path: scriptAttribute.text); 8680 Uri uri = new Uri(path: scriptAttribute.text);
8847 String fileName = uri.path; 8681 String fileName = uri.path;
8848 Source librarySource = ParseHtmlTask_this.context.sourceFactory.resolv eUri(ParseHtmlTask_this._source, fileName); 8682 Source librarySource = ParseHtmlTask_this.context.sourceFactory.resolv eUri(ParseHtmlTask_this.source, fileName);
8849 if (librarySource.exists()) { 8683 if (librarySource.exists()) {
8850 libraries.add(librarySource); 8684 libraries.add(librarySource);
8851 } 8685 }
8852 } catch (exception) { 8686 } catch (exception) {
8853 AnalysisEngine.instance.logger.logInformation2("Invalid URL ('${script Attribute.text}') in script tag in '${ParseHtmlTask_this._source.fullName}'", ex ception); 8687 AnalysisEngine.instance.logger.logInformation2("Invalid URL ('${script Attribute.text}') in script tag in '${ParseHtmlTask_this.source.fullName}'", exc eption);
8854 } 8688 }
8855 } 8689 }
8856 } 8690 }
8857 return super.visitXmlTagNode(node); 8691 return super.visitXmlTagNode(node);
8858 } 8692 }
8859 } 8693 }
8860 /** 8694 /**
8861 * Instances of the class `ResolveDartLibraryTask` parse a specific Dart library . 8695 * Instances of the class `ResolveDartLibraryTask` parse a specific Dart library .
8862 */ 8696 */
8863 class ResolveDartLibraryTask extends AnalysisTask { 8697 class ResolveDartLibraryTask extends AnalysisTask {
8864 8698
8865 /** 8699 /**
8866 * The source representing the file whose compilation unit is to be returned. 8700 * The source representing the file whose compilation unit is to be returned.
8867 */ 8701 */
8868 Source _unitSource; 8702 Source unitSource;
8869 8703
8870 /** 8704 /**
8871 * The source representing the library to be resolved. 8705 * The source representing the library to be resolved.
8872 */ 8706 */
8873 Source _librarySource; 8707 Source librarySource;
8874 8708
8875 /** 8709 /**
8876 * The library resolver holding information about the libraries that were reso lved. 8710 * The library resolver holding information about the libraries that were reso lved.
8877 */ 8711 */
8878 LibraryResolver _resolver; 8712 LibraryResolver libraryResolver;
8879 8713
8880 /** 8714 /**
8881 * Initialize a newly created task to perform analysis within the given contex t. 8715 * Initialize a newly created task to perform analysis within the given contex t.
8882 * 8716 *
8883 * @param context the context in which the task is to be performed 8717 * @param context the context in which the task is to be performed
8884 * @param unitSource the source representing the file whose compilation unit i s to be returned 8718 * @param unitSource the source representing the file whose compilation unit i s to be returned
8885 * @param librarySource the source representing the library to be resolved 8719 * @param librarySource the source representing the library to be resolved
8886 */ 8720 */
8887 ResolveDartLibraryTask(InternalAnalysisContext context, Source unitSource, Sou rce librarySource) : super(context) { 8721 ResolveDartLibraryTask(InternalAnalysisContext context, Source unitSource, Sou rce librarySource) : super(context) {
8888 this._unitSource = unitSource; 8722 this.unitSource = unitSource;
8889 this._librarySource = librarySource; 8723 this.librarySource = librarySource;
8890 } 8724 }
8891 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartLibraryTask(thi s); 8725 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartLibraryTask(thi s);
8892 8726 String get taskDescription => "resolve library ${librarySource.fullName}";
8893 /**
8894 * Return the library resolver holding information about the libraries that we re resolved.
8895 *
8896 * @return the library resolver holding information about the libraries that w ere resolved
8897 */
8898 LibraryResolver get libraryResolver => _resolver;
8899
8900 /**
8901 * Return the source representing the library to be resolved.
8902 *
8903 * @return the source representing the library to be resolved
8904 */
8905 Source get librarySource => _librarySource;
8906
8907 /**
8908 * Return the source representing the file whose compilation unit is to be ret urned.
8909 *
8910 * @return the source representing the file whose compilation unit is to be re turned
8911 */
8912 Source get unitSource => _unitSource;
8913 String get taskDescription => "resolve library ${_librarySource.fullName}";
8914 void internalPerform() { 8727 void internalPerform() {
8915 _resolver = new LibraryResolver(context); 8728 libraryResolver = new LibraryResolver(context);
8916 _resolver.resolveLibrary(_librarySource, true); 8729 libraryResolver.resolveLibrary(librarySource, true);
8917 } 8730 }
8918 } 8731 }
8919 /** 8732 /**
8920 * Instances of the class `ResolveDartUnitTask` resolve a single Dart file based on a existing 8733 * Instances of the class `ResolveDartUnitTask` resolve a single Dart file based on a existing
8921 * element model. 8734 * element model.
8922 */ 8735 */
8923 class ResolveDartUnitTask extends AnalysisTask { 8736 class ResolveDartUnitTask extends AnalysisTask {
8924 8737
8925 /** 8738 /**
8926 * The source that is to be resolved. 8739 * The source that is to be resolved.
8927 */ 8740 */
8928 Source _source; 8741 Source source;
8929 8742
8930 /** 8743 /**
8931 * The element model for the library containing the source. 8744 * The element model for the library containing the source.
8932 */ 8745 */
8933 LibraryElement _libraryElement; 8746 LibraryElement _libraryElement;
8934 8747
8935 /** 8748 /**
8936 * The time at which the contents of the source were last modified. 8749 * The time at which the contents of the source were last modified.
8937 */ 8750 */
8938 int _modificationTime = -1; 8751 int modificationTime = -1;
8939 8752
8940 /** 8753 /**
8941 * The compilation unit that was resolved by this task. 8754 * The compilation unit that was resolved by this task.
8942 */ 8755 */
8943 CompilationUnit _resolvedUnit; 8756 CompilationUnit resolvedUnit;
8944 8757
8945 /** 8758 /**
8946 * Initialize a newly created task to perform analysis within the given contex t. 8759 * Initialize a newly created task to perform analysis within the given contex t.
8947 * 8760 *
8948 * @param context the context in which the task is to be performed 8761 * @param context the context in which the task is to be performed
8949 * @param source the source to be parsed 8762 * @param source the source to be parsed
8950 * @param libraryElement the element model for the library containing the sour ce 8763 * @param libraryElement the element model for the library containing the sour ce
8951 */ 8764 */
8952 ResolveDartUnitTask(InternalAnalysisContext context, Source source, LibraryEle ment libraryElement) : super(context) { 8765 ResolveDartUnitTask(InternalAnalysisContext context, Source source, LibraryEle ment libraryElement) : super(context) {
8953 this._source = source; 8766 this.source = source;
8954 this._libraryElement = libraryElement; 8767 this._libraryElement = libraryElement;
8955 } 8768 }
8956 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartUnitTask(this); 8769 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveDartUnitTask(this);
8957 8770
8958 /** 8771 /**
8959 * Return the source for the library containing the source that is to be resol ved. 8772 * Return the source for the library containing the source that is to be resol ved.
8960 * 8773 *
8961 * @return the source for the library containing the source that is to be reso lved 8774 * @return the source for the library containing the source that is to be reso lved
8962 */ 8775 */
8963 Source get librarySource => _libraryElement.source; 8776 Source get librarySource => _libraryElement.source;
8964
8965 /**
8966 * Return the time at which the contents of the source that was parsed were la st modified, or a
8967 * negative value if the task has not yet been performed or if an exception oc curred.
8968 *
8969 * @return the time at which the contents of the source that was parsed were l ast modified
8970 */
8971 int get modificationTime => _modificationTime;
8972
8973 /**
8974 * Return the compilation unit that was resolved by this task.
8975 *
8976 * @return the compilation unit that was resolved by this task
8977 */
8978 CompilationUnit get resolvedUnit => _resolvedUnit;
8979
8980 /**
8981 * Return the source that is to be resolved.
8982 *
8983 * @return the source to be resolved
8984 */
8985 Source get source => _source;
8986 String get taskDescription => "resolve unit ${_libraryElement.source.fullName} "; 8777 String get taskDescription => "resolve unit ${_libraryElement.source.fullName} ";
8987 void internalPerform() { 8778 void internalPerform() {
8988 Source coreLibrarySource = _libraryElement.context.sourceFactory.forUri(Dart Sdk.DART_CORE); 8779 Source coreLibrarySource = _libraryElement.context.sourceFactory.forUri(Dart Sdk.DART_CORE);
8989 LibraryElement coreElement = context.computeLibraryElement(coreLibrarySource ); 8780 LibraryElement coreElement = context.computeLibraryElement(coreLibrarySource );
8990 TypeProvider typeProvider = new TypeProviderImpl(coreElement); 8781 TypeProvider typeProvider = new TypeProviderImpl(coreElement);
8991 ResolvableCompilationUnit resolvableUnit = context.computeResolvableCompilat ionUnit(_source); 8782 ResolvableCompilationUnit resolvableUnit = context.computeResolvableCompilat ionUnit(source);
8992 _modificationTime = resolvableUnit.modificationTime; 8783 modificationTime = resolvableUnit.modificationTime;
8993 CompilationUnit unit = resolvableUnit.compilationUnit; 8784 CompilationUnit unit = resolvableUnit.compilationUnit;
8994 if (unit == null) { 8785 if (unit == null) {
8995 throw new AnalysisException.con1("Internal error: computeResolvableCompila tionUnit returned a value without a parsed Dart unit"); 8786 throw new AnalysisException.con1("Internal error: computeResolvableCompila tionUnit returned a value without a parsed Dart unit");
8996 } 8787 }
8997 new DeclarationResolver().resolve(unit, find(_libraryElement, _source)); 8788 new DeclarationResolver().resolve(unit, find(_libraryElement, source));
8998 RecordingErrorListener errorListener = new RecordingErrorListener(); 8789 RecordingErrorListener errorListener = new RecordingErrorListener();
8999 TypeResolverVisitor typeResolverVisitor = new TypeResolverVisitor.con2(_libr aryElement, _source, typeProvider, errorListener); 8790 TypeResolverVisitor typeResolverVisitor = new TypeResolverVisitor.con2(_libr aryElement, source, typeProvider, errorListener);
9000 unit.accept(typeResolverVisitor); 8791 unit.accept(typeResolverVisitor);
9001 InheritanceManager inheritanceManager = new InheritanceManager(_libraryEleme nt); 8792 InheritanceManager inheritanceManager = new InheritanceManager(_libraryEleme nt);
9002 ResolverVisitor resolverVisitor = new ResolverVisitor.con2(_libraryElement, _source, typeProvider, inheritanceManager, errorListener); 8793 ResolverVisitor resolverVisitor = new ResolverVisitor.con2(_libraryElement, source, typeProvider, inheritanceManager, errorListener);
9003 unit.accept(resolverVisitor); 8794 unit.accept(resolverVisitor);
9004 for (ProxyConditionalAnalysisError conditionalCode in resolverVisitor.proxyC onditionalAnalysisErrors) { 8795 for (ProxyConditionalAnalysisError conditionalCode in resolverVisitor.proxyC onditionalAnalysisErrors) {
9005 if (conditionalCode.shouldIncludeErrorCode()) { 8796 if (conditionalCode.shouldIncludeErrorCode()) {
9006 resolverVisitor.reportError(conditionalCode.analysisError); 8797 resolverVisitor.reportError(conditionalCode.analysisError);
9007 } 8798 }
9008 } 8799 }
9009 ErrorReporter errorReporter = new ErrorReporter(errorListener, _source); 8800 ErrorReporter errorReporter = new ErrorReporter(errorListener, source);
9010 ErrorVerifier errorVerifier = new ErrorVerifier(errorReporter, _libraryEleme nt, typeProvider, inheritanceManager); 8801 ErrorVerifier errorVerifier = new ErrorVerifier(errorReporter, _libraryEleme nt, typeProvider, inheritanceManager);
9011 unit.accept(errorVerifier); 8802 unit.accept(errorVerifier);
9012 ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter, type Provider); 8803 ConstantVerifier constantVerifier = new ConstantVerifier(errorReporter, type Provider);
9013 unit.accept(constantVerifier); 8804 unit.accept(constantVerifier);
9014 unit.resolutionErrors = errorListener.errors; 8805 unit.resolutionErrors = errorListener.errors;
9015 _resolvedUnit = unit; 8806 resolvedUnit = unit;
9016 } 8807 }
9017 8808
9018 /** 8809 /**
9019 * Search the compilation units that are part of the given library and return the element 8810 * Search the compilation units that are part of the given library and return the element
9020 * representing the compilation unit with the given source. Return `null` if t here is no 8811 * representing the compilation unit with the given source. Return `null` if t here is no
9021 * such compilation unit. 8812 * such compilation unit.
9022 * 8813 *
9023 * @param libraryElement the element representing the library being searched t hrough 8814 * @param libraryElement the element representing the library being searched t hrough
9024 * @param unitSource the source for the compilation unit whose element is to b e returned 8815 * @param unitSource the source for the compilation unit whose element is to b e returned
9025 * @return the element representing the compilation unit 8816 * @return the element representing the compilation unit
(...skipping 12 matching lines...) Expand all
9038 } 8829 }
9039 } 8830 }
9040 /** 8831 /**
9041 * Instances of the class `ResolveHtmlTask` resolve a specific source as an HTML file. 8832 * Instances of the class `ResolveHtmlTask` resolve a specific source as an HTML file.
9042 */ 8833 */
9043 class ResolveHtmlTask extends AnalysisTask { 8834 class ResolveHtmlTask extends AnalysisTask {
9044 8835
9045 /** 8836 /**
9046 * The source to be resolved. 8837 * The source to be resolved.
9047 */ 8838 */
9048 Source _source; 8839 Source source;
9049 8840
9050 /** 8841 /**
9051 * The time at which the contents of the source were last modified. 8842 * The time at which the contents of the source were last modified.
9052 */ 8843 */
9053 int _modificationTime = -1; 8844 int modificationTime = -1;
9054 8845
9055 /** 8846 /**
9056 * The element produced by resolving the source. 8847 * The element produced by resolving the source.
9057 */ 8848 */
9058 HtmlElement _element = null; 8849 HtmlElement element = null;
9059 8850
9060 /** 8851 /**
9061 * The resolution errors that were discovered while resolving the source. 8852 * The resolution errors that were discovered while resolving the source.
9062 */ 8853 */
9063 List<AnalysisError> _resolutionErrors = AnalysisError.NO_ERRORS; 8854 List<AnalysisError> resolutionErrors = AnalysisError.NO_ERRORS;
9064 8855
9065 /** 8856 /**
9066 * Initialize a newly created task to perform analysis within the given contex t. 8857 * Initialize a newly created task to perform analysis within the given contex t.
9067 * 8858 *
9068 * @param context the context in which the task is to be performed 8859 * @param context the context in which the task is to be performed
9069 * @param source the source to be resolved 8860 * @param source the source to be resolved
9070 */ 8861 */
9071 ResolveHtmlTask(InternalAnalysisContext context, Source source) : super(contex t) { 8862 ResolveHtmlTask(InternalAnalysisContext context, Source source) : super(contex t) {
9072 this._source = source; 8863 this.source = source;
9073 } 8864 }
9074 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveHtmlTask(this); 8865 accept(AnalysisTaskVisitor visitor) => visitor.visitResolveHtmlTask(this);
9075 HtmlElement get element => _element; 8866 String get taskDescription => "resolve as html ${source.fullName}";
9076
9077 /**
9078 * Return the time at which the contents of the source that was parsed were la st modified, or a
9079 * negative value if the task has not yet been performed or if an exception oc curred.
9080 *
9081 * @return the time at which the contents of the source that was parsed were l ast modified
9082 */
9083 int get modificationTime => _modificationTime;
9084 List<AnalysisError> get resolutionErrors => _resolutionErrors;
9085
9086 /**
9087 * Return the source that was or is to be resolved.
9088 *
9089 * @return the source was or is to be resolved
9090 */
9091 Source get source => _source;
9092 String get taskDescription => "resolve as html ${_source.fullName}";
9093 void internalPerform() { 8867 void internalPerform() {
9094 ResolvableHtmlUnit resolvableHtmlUnit = context.computeResolvableHtmlUnit(_s ource); 8868 ResolvableHtmlUnit resolvableHtmlUnit = context.computeResolvableHtmlUnit(so urce);
9095 HtmlUnit unit = resolvableHtmlUnit.compilationUnit; 8869 HtmlUnit unit = resolvableHtmlUnit.compilationUnit;
9096 if (unit == null) { 8870 if (unit == null) {
9097 throw new AnalysisException.con1("Internal error: computeResolvableHtmlUni t returned a value without a parsed HTML unit"); 8871 throw new AnalysisException.con1("Internal error: computeResolvableHtmlUni t returned a value without a parsed HTML unit");
9098 } 8872 }
9099 _modificationTime = resolvableHtmlUnit.modificationTime; 8873 modificationTime = resolvableHtmlUnit.modificationTime;
9100 HtmlUnitBuilder builder = new HtmlUnitBuilder(context); 8874 HtmlUnitBuilder builder = new HtmlUnitBuilder(context);
9101 _element = builder.buildHtmlElement2(_source, _modificationTime, unit); 8875 element = builder.buildHtmlElement2(source, modificationTime, unit);
9102 _resolutionErrors = builder.errorListener.getErrors2(_source); 8876 resolutionErrors = builder.errorListener.getErrors2(source);
9103 } 8877 }
9104 } 8878 }
9105 /** 8879 /**
9106 * The interface `Logger` defines the behavior of objects that can be used to re ceive 8880 * The interface `Logger` defines the behavior of objects that can be used to re ceive
9107 * information about errors within the analysis engine. Implementations usually write this 8881 * information about errors within the analysis engine. Implementations usually write this
9108 * information to a file, but can also record the information for later use (suc h as during testing) 8882 * information to a file, but can also record the information for later use (suc h as during testing)
9109 * or even ignore the information. 8883 * or even ignore the information.
9110 * 8884 *
9111 * @coverage dart.engine.utilities 8885 * @coverage dart.engine.utilities
9112 */ 8886 */
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
9159 } 8933 }
9160 void logError2(String message, Exception exception) { 8934 void logError2(String message, Exception exception) {
9161 } 8935 }
9162 void logError3(Exception exception) { 8936 void logError3(Exception exception) {
9163 } 8937 }
9164 void logInformation(String message) { 8938 void logInformation(String message) {
9165 } 8939 }
9166 void logInformation2(String message, Exception exception) { 8940 void logInformation2(String message, Exception exception) {
9167 } 8941 }
9168 } 8942 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698