OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library analyzer.src.context.context; | 5 library analyzer.src.context.context; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | 8 import 'dart:collection'; |
9 | 9 |
10 import 'package:analyzer/src/cancelable_future.dart'; | 10 import 'package:analyzer/src/cancelable_future.dart'; |
(...skipping 744 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 } catch (exception) { | 755 } catch (exception) { |
756 // If the location cannot be decoded for some reason then the underlying | 756 // If the location cannot be decoded for some reason then the underlying |
757 // cause should have been logged already and we can fall though to return | 757 // cause should have been logged already and we can fall though to return |
758 // null. | 758 // null. |
759 } | 759 } |
760 return null; | 760 return null; |
761 } | 761 } |
762 | 762 |
763 @override | 763 @override |
764 AnalysisErrorInfo getErrors(Source source) { | 764 AnalysisErrorInfo getErrors(Source source) { |
765 List<AnalysisError> errors = _getResult(source, DART_ERRORS); | 765 // TODO(brianwilkerson) Figure out how to implement this cleanly. The |
| 766 // problem is that _getResult doesn't know to go into the individual inputs |
| 767 // for the task to get their values for tasks that are just merging other |
| 768 // result values. Therefore, if some, but not all, of the error lists have |
| 769 // been computed, no errors will be returned by it. |
| 770 List<List<AnalysisError>> errorLists = <List<AnalysisError>>[]; |
| 771 errorLists.add(_getResult(source, BUILD_DIRECTIVES_ERRORS)); |
| 772 errorLists.add(_getResult(source, BUILD_LIBRARY_ERRORS)); |
| 773 errorLists.add(_getResult(source, PARSE_ERRORS)); |
| 774 errorLists.add(_getResult(source, SCAN_ERRORS)); |
| 775 for (Source library in getLibrariesContaining(source)) { |
| 776 LibrarySpecificUnit unit = new LibrarySpecificUnit(library, source); |
| 777 errorLists.add(_getResult(unit, BUILD_FUNCTION_TYPE_ALIASES_ERRORS)); |
| 778 errorLists.add(_getResult(unit, HINTS)); |
| 779 errorLists.add(_getResult(unit, RESOLVE_REFERENCES_ERRORS)); |
| 780 errorLists.add(_getResult(unit, RESOLVE_TYPE_NAMES_ERRORS)); |
| 781 errorLists.add(_getResult(unit, VERIFY_ERRORS)); |
| 782 } |
766 LineInfo lineInfo = _getResult(source, LINE_INFO); | 783 LineInfo lineInfo = _getResult(source, LINE_INFO); |
767 return new AnalysisErrorInfoImpl(errors, lineInfo); | 784 return new AnalysisErrorInfoImpl( |
| 785 AnalysisError.mergeLists(errorLists), lineInfo); |
768 } | 786 } |
769 | 787 |
770 @override | 788 @override |
771 HtmlElement getHtmlElement(Source source) { | 789 HtmlElement getHtmlElement(Source source) { |
772 // TODO(brianwilkerson) Implement this. | 790 // TODO(brianwilkerson) Implement this. |
773 // SourceEntry sourceEntry = getReadableSourceEntryOrNull(source); | 791 // SourceEntry sourceEntry = getReadableSourceEntryOrNull(source); |
774 // if (sourceEntry is HtmlEntry) { | 792 // if (sourceEntry is HtmlEntry) { |
775 // return sourceEntry.getValue(HtmlEntry.ELEMENT); | 793 // return sourceEntry.getValue(HtmlEntry.ELEMENT); |
776 // } | 794 // } |
777 return null; | 795 return null; |
(...skipping 1344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2122 PendingFuture pendingFuture = | 2140 PendingFuture pendingFuture = |
2123 new PendingFuture<T>(_context, target, computeValue); | 2141 new PendingFuture<T>(_context, target, computeValue); |
2124 if (!pendingFuture.evaluate(entry)) { | 2142 if (!pendingFuture.evaluate(entry)) { |
2125 _context._pendingFutureTargets | 2143 _context._pendingFutureTargets |
2126 .putIfAbsent(target, () => <PendingFuture>[]) | 2144 .putIfAbsent(target, () => <PendingFuture>[]) |
2127 .add(pendingFuture); | 2145 .add(pendingFuture); |
2128 } | 2146 } |
2129 return pendingFuture.future; | 2147 return pendingFuture.future; |
2130 } | 2148 } |
2131 } | 2149 } |
OLD | NEW |