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

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

Issue 685993004: Clean up logging uses (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/analyzer/lib/src/generated/element.dart ('k') | pkg/analyzer/lib/src/generated/html.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine; 8 library engine;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 * @return the context that owns the partition that contains the source 104 * @return the context that owns the partition that contains the source
105 */ 105 */
106 InternalAnalysisContext getContextFor(Source source) { 106 InternalAnalysisContext getContextFor(Source source) {
107 int count = _partitions.length; 107 int count = _partitions.length;
108 for (int i = 0; i < count; i++) { 108 for (int i = 0; i < count; i++) {
109 if (_partitions[i].contains(source)) { 109 if (_partitions[i].contains(source)) {
110 return _partitions[i].context; 110 return _partitions[i].context;
111 } 111 }
112 } 112 }
113 // 113 //
114 // We should never get to this point because the last partition should alway s be a universal 114 // We should never get to this point because the last partition should
115 // partition, except in the case of the SDK context, in which case the sourc e should always be 115 // always be a universal partition, except in the case of the SDK context,
116 // part of the SDK. 116 // in which case the source should always be part of the SDK.
117 // 117 //
118 AnalysisEngine.instance.logger.logInformation2("Could not find context for $ {source.fullName}", new JavaException()); 118 AnalysisEngine.instance.logger.logInformation(
119 "Could not find context for ${source.fullName}",
120 new CaughtException(new AnalysisException(), null));
119 return null; 121 return null;
120 } 122 }
121 123
122 /** 124 /**
123 * Return information about each of the partitions in this cache. 125 * Return information about each of the partitions in this cache.
124 * 126 *
125 * @return information about each of the partitions in this cache 127 * @return information about each of the partitions in this cache
126 */ 128 */
127 List<AnalysisContextStatistics_PartitionData> get partitionData { 129 List<AnalysisContextStatistics_PartitionData> get partitionData {
128 int count = _partitions.length; 130 int count = _partitions.length;
(...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 for (Source librarySource in libraries) { 1153 for (Source librarySource in libraries) {
1152 ListUtilities.addAll(errors, _getDartResolutionData(source, libraryS ource, dartEntry, DartEntry.RESOLUTION_ERRORS)); 1154 ListUtilities.addAll(errors, _getDartResolutionData(source, libraryS ource, dartEntry, DartEntry.RESOLUTION_ERRORS));
1153 dartEntry = _getReadableDartEntry(source); 1155 dartEntry = _getReadableDartEntry(source);
1154 ListUtilities.addAll(errors, _getDartVerificationData(source, librar ySource, dartEntry, DartEntry.VERIFICATION_ERRORS)); 1156 ListUtilities.addAll(errors, _getDartVerificationData(source, librar ySource, dartEntry, DartEntry.VERIFICATION_ERRORS));
1155 if (enableHints) { 1157 if (enableHints) {
1156 dartEntry = _getReadableDartEntry(source); 1158 dartEntry = _getReadableDartEntry(source);
1157 ListUtilities.addAll(errors, _getDartHintData(source, librarySourc e, dartEntry, DartEntry.HINTS)); 1159 ListUtilities.addAll(errors, _getDartHintData(source, librarySourc e, dartEntry, DartEntry.HINTS));
1158 } 1160 }
1159 } 1161 }
1160 } 1162 }
1161 } on ObsoleteSourceAnalysisException catch (exception) { 1163 } on ObsoleteSourceAnalysisException catch (exception, stackTrace) {
1162 AnalysisEngine.instance.logger.logInformation2("Could not compute errors ", exception); 1164 AnalysisEngine.instance.logger.logInformation(
1165 "Could not compute errors",
1166 new CaughtException(exception, stackTrace));
1163 } 1167 }
1164 if (errors.isEmpty) { 1168 if (errors.isEmpty) {
1165 return AnalysisError.NO_ERRORS; 1169 return AnalysisError.NO_ERRORS;
1166 } 1170 }
1167 return errors; 1171 return errors;
1168 } else if (sourceEntry is HtmlEntry) { 1172 } else if (sourceEntry is HtmlEntry) {
1169 HtmlEntry htmlEntry = sourceEntry; 1173 HtmlEntry htmlEntry = sourceEntry;
1170 try { 1174 try {
1171 return _getHtmlResolutionData2(source, htmlEntry, HtmlEntry.RESOLUTION_E RRORS); 1175 return _getHtmlResolutionData2(source, htmlEntry, HtmlEntry.RESOLUTION_E RRORS);
1172 } on ObsoleteSourceAnalysisException catch (exception) { 1176 } on ObsoleteSourceAnalysisException catch (exception, stackTrace) {
1173 AnalysisEngine.instance.logger.logInformation2("Could not compute errors ", exception); 1177 AnalysisEngine.instance.logger.logInformation(
1178 "Could not compute errors",
1179 new CaughtException(exception, stackTrace));
1174 } 1180 }
1175 } 1181 }
1176 return AnalysisError.NO_ERRORS; 1182 return AnalysisError.NO_ERRORS;
1177 } 1183 }
1178 1184
1179 @override 1185 @override
1180 List<Source> computeExportedLibraries(Source source) => _getDartParseData2(sou rce, DartEntry.EXPORTED_LIBRARIES, Source.EMPTY_ARRAY); 1186 List<Source> computeExportedLibraries(Source source) => _getDartParseData2(sou rce, DartEntry.EXPORTED_LIBRARIES, Source.EMPTY_ARRAY);
1181 1187
1182 @override 1188 @override
1183 HtmlElement computeHtmlElement(Source source) => _getHtmlResolutionData(source , HtmlEntry.ELEMENT, null); 1189 HtmlElement computeHtmlElement(Source source) => _getHtmlResolutionData(source , HtmlEntry.ELEMENT, null);
(...skipping 21 matching lines...) Expand all
1205 1211
1206 @override 1212 @override
1207 LineInfo computeLineInfo(Source source) { 1213 LineInfo computeLineInfo(Source source) {
1208 SourceEntry sourceEntry = _getReadableSourceEntry(source); 1214 SourceEntry sourceEntry = _getReadableSourceEntry(source);
1209 try { 1215 try {
1210 if (sourceEntry is HtmlEntry) { 1216 if (sourceEntry is HtmlEntry) {
1211 return _getHtmlParseData(source, SourceEntry.LINE_INFO, null); 1217 return _getHtmlParseData(source, SourceEntry.LINE_INFO, null);
1212 } else if (sourceEntry is DartEntry) { 1218 } else if (sourceEntry is DartEntry) {
1213 return _getDartScanData2(source, SourceEntry.LINE_INFO, null); 1219 return _getDartScanData2(source, SourceEntry.LINE_INFO, null);
1214 } 1220 }
1215 } on ObsoleteSourceAnalysisException catch (exception) { 1221 } on ObsoleteSourceAnalysisException catch (exception, stackTrace) {
1216 AnalysisEngine.instance.logger.logInformation2("Could not compute ${Source Entry.LINE_INFO}", exception); 1222 AnalysisEngine.instance.logger.logInformation(
1223 "Could not compute ${SourceEntry.LINE_INFO}",
1224 new CaughtException(exception, stackTrace));
1217 } 1225 }
1218 return null; 1226 return null;
1219 } 1227 }
1220 1228
1221 @override 1229 @override
1222 CompilationUnit computeResolvableCompilationUnit(Source source) { 1230 CompilationUnit computeResolvableCompilationUnit(Source source) {
1223 DartEntry dartEntry = _getReadableDartEntry(source); 1231 DartEntry dartEntry = _getReadableDartEntry(source);
1224 if (dartEntry == null) { 1232 if (dartEntry == null) {
1225 throw new AnalysisException("computeResolvableCompilationUnit for non-Dart : ${source.fullName}"); 1233 throw new AnalysisException("computeResolvableCompilationUnit for non-Dart : ${source.fullName}");
1226 } 1234 }
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1522 return null; 1530 return null;
1523 } 1531 }
1524 Namespace namespace = null; 1532 Namespace namespace = null;
1525 if (identical(dartEntry.getValue(DartEntry.ELEMENT), library)) { 1533 if (identical(dartEntry.getValue(DartEntry.ELEMENT), library)) {
1526 namespace = dartEntry.getValue(DartEntry.PUBLIC_NAMESPACE); 1534 namespace = dartEntry.getValue(DartEntry.PUBLIC_NAMESPACE);
1527 } 1535 }
1528 if (namespace == null) { 1536 if (namespace == null) {
1529 NamespaceBuilder builder = new NamespaceBuilder(); 1537 NamespaceBuilder builder = new NamespaceBuilder();
1530 namespace = builder.createPublicNamespaceForLibrary(library); 1538 namespace = builder.createPublicNamespaceForLibrary(library);
1531 if (dartEntry == null) { 1539 if (dartEntry == null) {
1532 AnalysisEngine.instance.logger.logError2("Could not compute the public n amespace for ${library.source.fullName}", new CaughtException(new AnalysisExcept ion("A Dart file became a non-Dart file: ${source.fullName}"), null)); 1540 AnalysisEngine.instance.logger.logError(
1541 "Could not compute the public namespace for ${library.source.fullNam e}",
1542 new CaughtException(
1543 new AnalysisException("A Dart file became a non-Dart file: ${sou rce.fullName}"),
1544 null));
1533 return null; 1545 return null;
1534 } 1546 }
1535 if (identical(dartEntry.getValue(DartEntry.ELEMENT), library)) { 1547 if (identical(dartEntry.getValue(DartEntry.ELEMENT), library)) {
1536 dartEntry.setValue(DartEntry.PUBLIC_NAMESPACE, namespace); 1548 dartEntry.setValue(DartEntry.PUBLIC_NAMESPACE, namespace);
1537 } 1549 }
1538 } 1550 }
1539 return namespace; 1551 return namespace;
1540 } 1552 }
1541 1553
1542 @override 1554 @override
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
1763 return new AnalysisResult(_getChangeNotices(true), getEnd - getStart, null , -1); 1775 return new AnalysisResult(_getChangeNotices(true), getEnd - getStart, null , -1);
1764 } 1776 }
1765 String taskDescription = task.toString(); 1777 String taskDescription = task.toString();
1766 _notifyAboutToPerformTask(taskDescription); 1778 _notifyAboutToPerformTask(taskDescription);
1767 if (_TRACE_PERFORM_TASK) { 1779 if (_TRACE_PERFORM_TASK) {
1768 print(taskDescription); 1780 print(taskDescription);
1769 } 1781 }
1770 int performStart = JavaSystem.currentTimeMillis(); 1782 int performStart = JavaSystem.currentTimeMillis();
1771 try { 1783 try {
1772 task.perform(_resultRecorder); 1784 task.perform(_resultRecorder);
1773 } on ObsoleteSourceAnalysisException catch (exception) { 1785 } on ObsoleteSourceAnalysisException catch (exception, stackTrace) {
1774 AnalysisEngine.instance.logger.logInformation2("Could not perform analysis task: $taskDescription", exception); 1786 AnalysisEngine.instance.logger.logInformation(
1775 } on AnalysisException catch (exception) { 1787 "Could not perform analysis task: $taskDescription",
1788 new CaughtException(exception, stackTrace));
1789 } on AnalysisException catch (exception, stackTrace) {
1776 if (exception.cause is! JavaIOException) { 1790 if (exception.cause is! JavaIOException) {
1777 AnalysisEngine.instance.logger.logError2("Internal error while performin g the task: $task", exception); 1791 AnalysisEngine.instance.logger.logError(
1792 "Internal error while performing the task: $task",
1793 new CaughtException(exception, stackTrace));
1778 } 1794 }
1779 } 1795 }
1780 int performEnd = JavaSystem.currentTimeMillis(); 1796 int performEnd = JavaSystem.currentTimeMillis();
1781 List<ChangeNotice> notices = _getChangeNotices(false); 1797 List<ChangeNotice> notices = _getChangeNotices(false);
1782 int noticeCount = notices.length; 1798 int noticeCount = notices.length;
1783 for (int i = 0; i < noticeCount; i++) { 1799 for (int i = 0; i < noticeCount; i++) {
1784 ChangeNotice notice = notices[i]; 1800 ChangeNotice notice = notices[i];
1785 Source source = notice.source; 1801 Source source = notice.source;
1786 // TODO(brianwilkerson) Figure out whether the compilation unit is always resolved, or whether 1802 // TODO(brianwilkerson) Figure out whether the compilation unit is always resolved, or whether
1787 // we need to decide whether to invoke the "parsed" or "resolved" method. This might be better 1803 // we need to decide whether to invoke the "parsed" or "resolved" method. This might be better
(...skipping 756 matching lines...) Expand 10 before | Expand all | Expand 10 after
2544 * @param librarySource the source for the library containing the compilation unit 2560 * @param librarySource the source for the library containing the compilation unit
2545 * @param libraryEntry the entry for the library 2561 * @param libraryEntry the entry for the library
2546 * @return task data representing the created task 2562 * @return task data representing the created task
2547 */ 2563 */
2548 AnalysisContextImpl_TaskData _createGenerateDartErrorsTask(Source unitSource, DartEntry unitEntry, Source librarySource, DartEntry libraryEntry) { 2564 AnalysisContextImpl_TaskData _createGenerateDartErrorsTask(Source unitSource, DartEntry unitEntry, Source librarySource, DartEntry libraryEntry) {
2549 if (unitEntry.getStateInLibrary(DartEntry.RESOLVED_UNIT, librarySource) != C acheState.VALID || libraryEntry.getState(DartEntry.ELEMENT) != CacheState.VALID) { 2565 if (unitEntry.getStateInLibrary(DartEntry.RESOLVED_UNIT, librarySource) != C acheState.VALID || libraryEntry.getState(DartEntry.ELEMENT) != CacheState.VALID) {
2550 return _createResolveDartLibraryTask(librarySource, libraryEntry); 2566 return _createResolveDartLibraryTask(librarySource, libraryEntry);
2551 } 2567 }
2552 CompilationUnit unit = unitEntry.getValueInLibrary(DartEntry.RESOLVED_UNIT, librarySource); 2568 CompilationUnit unit = unitEntry.getValueInLibrary(DartEntry.RESOLVED_UNIT, librarySource);
2553 if (unit == null) { 2569 if (unit == null) {
2554 CaughtException exception = new CaughtException(new AnalysisException("Ent ry has VALID state for RESOLVED_UNIT but null value for ${unitSource.fullName} i n ${librarySource.fullName}"), null); 2570 CaughtException exception = new CaughtException(
2555 AnalysisEngine.instance.logger.logInformation2(exception.toString(), excep tion); 2571 new AnalysisException("Entry has VALID state for RESOLVED_UNIT but nul l value for ${unitSource.fullName} in ${librarySource.fullName}"),
2572 null);
2573 AnalysisEngine.instance.logger.logInformation(exception.toString(), except ion);
2556 unitEntry.recordResolutionError(exception); 2574 unitEntry.recordResolutionError(exception);
2557 return new AnalysisContextImpl_TaskData(null, false); 2575 return new AnalysisContextImpl_TaskData(null, false);
2558 } 2576 }
2559 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.ELEMENT); 2577 LibraryElement libraryElement = libraryEntry.getValue(DartEntry.ELEMENT);
2560 unitEntry.setStateInLibrary(DartEntry.VERIFICATION_ERRORS, librarySource, Ca cheState.IN_PROCESS); 2578 unitEntry.setStateInLibrary(DartEntry.VERIFICATION_ERRORS, librarySource, Ca cheState.IN_PROCESS);
2561 return new AnalysisContextImpl_TaskData(new GenerateDartErrorsTask(this, uni tSource, unit, libraryElement), false); 2579 return new AnalysisContextImpl_TaskData(new GenerateDartErrorsTask(this, uni tSource, unit, libraryElement), false);
2562 } 2580 }
2563 2581
2564 /** 2582 /**
2565 * Create a [GenerateDartHintsTask] for the given source, marking the hints as being 2583 * Create a [GenerateDartHintsTask] for the given source, marking the hints as being
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
2712 try { 2730 try {
2713 AnalysisContextImpl_CycleBuilder builder = new AnalysisContextImpl_CycleBu ilder(this); 2731 AnalysisContextImpl_CycleBuilder builder = new AnalysisContextImpl_CycleBu ilder(this);
2714 builder.computeCycleContaining(source); 2732 builder.computeCycleContaining(source);
2715 AnalysisContextImpl_TaskData taskData = builder.taskData; 2733 AnalysisContextImpl_TaskData taskData = builder.taskData;
2716 if (taskData != null) { 2734 if (taskData != null) {
2717 return taskData; 2735 return taskData;
2718 } 2736 }
2719 return new AnalysisContextImpl_TaskData(new ResolveDartLibraryCycleTask(th is, source, source, builder.librariesInCycle), false); 2737 return new AnalysisContextImpl_TaskData(new ResolveDartLibraryCycleTask(th is, source, source, builder.librariesInCycle), false);
2720 } on AnalysisException catch (exception, stackTrace) { 2738 } on AnalysisException catch (exception, stackTrace) {
2721 dartEntry.recordResolutionError(new CaughtException(exception, stackTrace) ); 2739 dartEntry.recordResolutionError(new CaughtException(exception, stackTrace) );
2722 AnalysisEngine.instance.logger.logError2("Internal error trying to create a ResolveDartLibraryTask", new CaughtException(exception, stackTrace)); 2740 AnalysisEngine.instance.logger.logError(
2741 "Internal error trying to create a ResolveDartLibraryTask",
2742 new CaughtException(exception, stackTrace));
2723 } 2743 }
2724 return new AnalysisContextImpl_TaskData(null, false); 2744 return new AnalysisContextImpl_TaskData(null, false);
2725 } 2745 }
2726 2746
2727 /** 2747 /**
2728 * Create a [ResolveHtmlTask] for the given source, marking the resolved unit as being 2748 * Create a [ResolveHtmlTask] for the given source, marking the resolved unit as being
2729 * in-process. 2749 * in-process.
2730 * 2750 *
2731 * @param source the source whose content is to be resolved 2751 * @param source the source whose content is to be resolved
2732 * @param htmlEntry the entry for the source 2752 * @param htmlEntry the entry for the source
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
2870 * @return the requested data about the given source 2890 * @return the requested data about the given source
2871 * @throws AnalysisException if data could not be returned because the source could not be parsed 2891 * @throws AnalysisException if data could not be returned because the source could not be parsed
2872 */ 2892 */
2873 Object _getDartParseData2(Source source, DataDescriptor descriptor, Object def aultValue) { 2893 Object _getDartParseData2(Source source, DataDescriptor descriptor, Object def aultValue) {
2874 DartEntry dartEntry = _getReadableDartEntry(source); 2894 DartEntry dartEntry = _getReadableDartEntry(source);
2875 if (dartEntry == null) { 2895 if (dartEntry == null) {
2876 return defaultValue; 2896 return defaultValue;
2877 } 2897 }
2878 try { 2898 try {
2879 return _getDartParseData(source, dartEntry, descriptor); 2899 return _getDartParseData(source, dartEntry, descriptor);
2880 } on ObsoleteSourceAnalysisException catch (exception) { 2900 } on ObsoleteSourceAnalysisException catch (exception, stackTrace) {
2881 AnalysisEngine.instance.logger.logInformation2("Could not compute $descrip tor", exception); 2901 AnalysisEngine.instance.logger.logInformation(
2902 "Could not compute $descriptor",
2903 new CaughtException(exception, stackTrace));
2882 return defaultValue; 2904 return defaultValue;
2883 } 2905 }
2884 } 2906 }
2885 2907
2886 /** 2908 /**
2887 * Given a source for a Dart file and the library that contains it, return the data represented by 2909 * Given a source for a Dart file and the library that contains it, return the data represented by
2888 * the given descriptor that is associated with that source. This method assum es that the data can 2910 * the given descriptor that is associated with that source. This method assum es that the data can
2889 * be produced by resolving the source in the context of the library if it is not already cached. 2911 * be produced by resolving the source in the context of the library if it is not already cached.
2890 * 2912 *
2891 * <b>Note:</b> This method cannot be used in an async environment. 2913 * <b>Note:</b> This method cannot be used in an async environment.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2924 * @throws AnalysisException if data could not be returned because the source could not be 2946 * @throws AnalysisException if data could not be returned because the source could not be
2925 * resolved 2947 * resolved
2926 */ 2948 */
2927 Object _getDartResolutionData2(Source unitSource, Source librarySource, DataDe scriptor descriptor, Object defaultValue) { 2949 Object _getDartResolutionData2(Source unitSource, Source librarySource, DataDe scriptor descriptor, Object defaultValue) {
2928 DartEntry dartEntry = _getReadableDartEntry(unitSource); 2950 DartEntry dartEntry = _getReadableDartEntry(unitSource);
2929 if (dartEntry == null) { 2951 if (dartEntry == null) {
2930 return defaultValue; 2952 return defaultValue;
2931 } 2953 }
2932 try { 2954 try {
2933 return _getDartResolutionData(unitSource, librarySource, dartEntry, descri ptor); 2955 return _getDartResolutionData(unitSource, librarySource, dartEntry, descri ptor);
2934 } on ObsoleteSourceAnalysisException catch (exception) { 2956 } on ObsoleteSourceAnalysisException catch (exception, stackTrace) {
2935 AnalysisEngine.instance.logger.logInformation2("Could not compute $descrip tor", exception); 2957 AnalysisEngine.instance.logger.logInformation(
2958 "Could not compute $descriptor",
2959 new CaughtException(exception, stackTrace));
2936 return defaultValue; 2960 return defaultValue;
2937 } 2961 }
2938 } 2962 }
2939 2963
2940 /** 2964 /**
2941 * Given a source for a Dart file, return the data represented by the given de scriptor that is 2965 * Given a source for a Dart file, return the data represented by the given de scriptor that is
2942 * associated with that source. This method assumes that the data can be produ ced by scanning the 2966 * associated with that source. This method assumes that the data can be produ ced by scanning the
2943 * source if it is not already cached. 2967 * source if it is not already cached.
2944 * 2968 *
2945 * <b>Note:</b> This method cannot be used in an async environment. 2969 * <b>Note:</b> This method cannot be used in an async environment.
(...skipping 23 matching lines...) Expand all
2969 * @return the requested data about the given source 2993 * @return the requested data about the given source
2970 * @throws AnalysisException if data could not be returned because the source could not be scanned 2994 * @throws AnalysisException if data could not be returned because the source could not be scanned
2971 */ 2995 */
2972 Object _getDartScanData2(Source source, DataDescriptor descriptor, Object defa ultValue) { 2996 Object _getDartScanData2(Source source, DataDescriptor descriptor, Object defa ultValue) {
2973 DartEntry dartEntry = _getReadableDartEntry(source); 2997 DartEntry dartEntry = _getReadableDartEntry(source);
2974 if (dartEntry == null) { 2998 if (dartEntry == null) {
2975 return defaultValue; 2999 return defaultValue;
2976 } 3000 }
2977 try { 3001 try {
2978 return _getDartScanData(source, dartEntry, descriptor); 3002 return _getDartScanData(source, dartEntry, descriptor);
2979 } on ObsoleteSourceAnalysisException catch (exception) { 3003 } on ObsoleteSourceAnalysisException catch (exception, stackTrace) {
2980 AnalysisEngine.instance.logger.logInformation2("Could not compute $descrip tor", exception); 3004 AnalysisEngine.instance.logger.logInformation(
3005 "Could not compute $descriptor",
3006 new CaughtException(exception, stackTrace));
2981 return defaultValue; 3007 return defaultValue;
2982 } 3008 }
2983 } 3009 }
2984 3010
2985 /** 3011 /**
2986 * Given a source for a Dart file and the library that contains it, return the data represented by 3012 * Given a source for a Dart file and the library that contains it, return the data represented by
2987 * the given descriptor that is associated with that source. This method assum es that the data can 3013 * the given descriptor that is associated with that source. This method assum es that the data can
2988 * be produced by verifying the source within the given library if it is not a lready cached. 3014 * be produced by verifying the source within the given library if it is not a lready cached.
2989 * 3015 *
2990 * <b>Note:</b> This method cannot be used in an async environment. 3016 * <b>Note:</b> This method cannot be used in an async environment.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
3043 * @throws AnalysisException if data could not be returned because the source could not be 3069 * @throws AnalysisException if data could not be returned because the source could not be
3044 * resolved 3070 * resolved
3045 */ 3071 */
3046 Object _getHtmlResolutionData(Source source, DataDescriptor descriptor, Object defaultValue) { 3072 Object _getHtmlResolutionData(Source source, DataDescriptor descriptor, Object defaultValue) {
3047 HtmlEntry htmlEntry = _getReadableHtmlEntry(source); 3073 HtmlEntry htmlEntry = _getReadableHtmlEntry(source);
3048 if (htmlEntry == null) { 3074 if (htmlEntry == null) {
3049 return defaultValue; 3075 return defaultValue;
3050 } 3076 }
3051 try { 3077 try {
3052 return _getHtmlResolutionData2(source, htmlEntry, descriptor); 3078 return _getHtmlResolutionData2(source, htmlEntry, descriptor);
3053 } on ObsoleteSourceAnalysisException catch (exception) { 3079 } on ObsoleteSourceAnalysisException catch (exception, stackTrace) {
3054 AnalysisEngine.instance.logger.logInformation2("Could not compute $descrip tor", exception); 3080 AnalysisEngine.instance.logger.logInformation(
3081 "Could not compute $descriptor",
3082 new CaughtException(exception, stackTrace));
3055 return defaultValue; 3083 return defaultValue;
3056 } 3084 }
3057 } 3085 }
3058 3086
3059 /** 3087 /**
3060 * Given a source for an HTML file, return the data represented by the given d escriptor that is 3088 * Given a source for an HTML file, return the data represented by the given d escriptor that is
3061 * associated with that source. This method assumes that the data can be produ ced by resolving the 3089 * associated with that source. This method assumes that the data can be produ ced by resolving the
3062 * source if it is not already cached. 3090 * source if it is not already cached.
3063 * 3091 *
3064 * <b>Note:</b> This method cannot be used in an async environment. 3092 * <b>Note:</b> This method cannot be used in an async environment.
(...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after
3690 /** 3718 /**
3691 * Log the given debugging information. 3719 * Log the given debugging information.
3692 * 3720 *
3693 * @param message the message to be added to the log 3721 * @param message the message to be added to the log
3694 */ 3722 */
3695 void _logInformation(String message) { 3723 void _logInformation(String message) {
3696 AnalysisEngine.instance.logger.logInformation(message); 3724 AnalysisEngine.instance.logger.logInformation(message);
3697 } 3725 }
3698 3726
3699 /** 3727 /**
3700 * Log the given debugging information.
3701 *
3702 * @param message the message to be added to the log
3703 * @param exception the exception to be included in the log entry
3704 */
3705 void _logInformation2(String message, Exception exception) {
3706 if (exception == null) {
3707 AnalysisEngine.instance.logger.logInformation(message);
3708 } else {
3709 AnalysisEngine.instance.logger.logInformation2(message, exception);
3710 }
3711 }
3712
3713 /**
3714 * Notify all of the analysis listeners that a task is about to be performed. 3728 * Notify all of the analysis listeners that a task is about to be performed.
3715 * 3729 *
3716 * @param taskDescription a human readable description of the task that is abo ut to be performed 3730 * @param taskDescription a human readable description of the task that is abo ut to be performed
3717 */ 3731 */
3718 void _notifyAboutToPerformTask(String taskDescription) { 3732 void _notifyAboutToPerformTask(String taskDescription) {
3719 int count = _listeners.length; 3733 int count = _listeners.length;
3720 for (int i = 0; i < count; i++) { 3734 for (int i = 0; i < count; i++) {
3721 _listeners[i].aboutToPerformTask(this, taskDescription); 3735 _listeners[i].aboutToPerformTask(this, taskDescription);
3722 } 3736 }
3723 } 3737 }
(...skipping 2242 matching lines...) Expand 10 before | Expand all | Expand 10 after
5966 * 5980 *
5967 * @param visitor the visitor used to visit this task after it has completed 5981 * @param visitor the visitor used to visit this task after it has completed
5968 * @return the value returned by the visitor 5982 * @return the value returned by the visitor
5969 * @throws AnalysisException if the visitor throws the exception 5983 * @throws AnalysisException if the visitor throws the exception
5970 */ 5984 */
5971 Object perform(AnalysisTaskVisitor visitor) { 5985 Object perform(AnalysisTaskVisitor visitor) {
5972 try { 5986 try {
5973 _safelyPerform(); 5987 _safelyPerform();
5974 } on AnalysisException catch (exception, stackTrace) { 5988 } on AnalysisException catch (exception, stackTrace) {
5975 _thrownException = new CaughtException(exception, stackTrace); 5989 _thrownException = new CaughtException(exception, stackTrace);
5976 AnalysisEngine.instance.logger.logInformation2("Task failed: $taskDescript ion", new CaughtException(exception, stackTrace)); 5990 AnalysisEngine.instance.logger.logInformation(
5991 "Task failed: $taskDescription",
5992 new CaughtException(exception, stackTrace));
5977 } 5993 }
5978 return accept(visitor); 5994 return accept(visitor);
5979 } 5995 }
5980 5996
5981 @override 5997 @override
5982 String toString() => taskDescription; 5998 String toString() => taskDescription;
5983 5999
5984 /** 6000 /**
5985 * Return a textual description of this task. 6001 * Return a textual description of this task.
5986 * 6002 *
(...skipping 1468 matching lines...) Expand 10 before | Expand all | Expand 10 after
7455 * Set the errors that changed as a result of the analysis to the given errors and set the line 7471 * Set the errors that changed as a result of the analysis to the given errors and set the line
7456 * information to the given line information. 7472 * information to the given line information.
7457 * 7473 *
7458 * @param errors the errors that changed as a result of the analysis 7474 * @param errors the errors that changed as a result of the analysis
7459 * @param lineInfo the line information associated with the source 7475 * @param lineInfo the line information associated with the source
7460 */ 7476 */
7461 void setErrors(List<AnalysisError> errors, LineInfo lineInfo) { 7477 void setErrors(List<AnalysisError> errors, LineInfo lineInfo) {
7462 this._errors = errors; 7478 this._errors = errors;
7463 this._lineInfo = lineInfo; 7479 this._lineInfo = lineInfo;
7464 if (lineInfo == null) { 7480 if (lineInfo == null) {
7465 AnalysisEngine.instance.logger.logInformation2("No line info: $source", ne w JavaException()); 7481 AnalysisEngine.instance.logger.logInformation(
7482 "No line info: $source",
7483 new CaughtException(new AnalysisException(), null));
7466 } 7484 }
7467 } 7485 }
7468 7486
7469 @override 7487 @override
7470 String toString() => "Changes for ${source.fullName}"; 7488 String toString() => "Changes for ${source.fullName}";
7471 } 7489 }
7472 7490
7473 /** 7491 /**
7474 * Instances of the class `ChangeSet` indicate which sources have been added, ch anged, 7492 * Instances of the class `ChangeSet` indicate which sources have been added, ch anged,
7475 * removed, or deleted. In the case of a changed source, there are multiple ways of indicating the 7493 * removed, or deleted. In the case of a changed source, there are multiple ways of indicating the
(...skipping 6067 matching lines...) Expand 10 before | Expand all | Expand 10 after
13543 _index++; 13561 _index++;
13544 if (_index >= _manager._workQueues[_queueIndex].length) { 13562 if (_index >= _manager._workQueues[_queueIndex].length) {
13545 _index = 0; 13563 _index = 0;
13546 _queueIndex++; 13564 _queueIndex++;
13547 while (_queueIndex < _manager._workQueues.length && _manager._workQueues[_ queueIndex].isEmpty) { 13565 while (_queueIndex < _manager._workQueues.length && _manager._workQueues[_ queueIndex].isEmpty) {
13548 _queueIndex++; 13566 _queueIndex++;
13549 } 13567 }
13550 } 13568 }
13551 } 13569 }
13552 } 13570 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/element.dart ('k') | pkg/analyzer/lib/src/generated/html.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698