mirror of
https://github.com/dart-lang/sdk
synced 2024-11-02 12:24:24 +00:00
Always send errors/lines with parsed/resolved units.
R=brianwilkerson@google.com BUG= Review URL: https://codereview.chromium.org//1141953002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@45812 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
parent
f058a6ad33
commit
a9d194d049
2 changed files with 20 additions and 6 deletions
|
@ -228,28 +228,34 @@ class DartWorkManager implements WorkManager {
|
|||
}
|
||||
// Update notice.
|
||||
if (_isDartSource(target)) {
|
||||
bool hasErrorResult = false;
|
||||
bool shouldSetErrors = false;
|
||||
outputs.forEach((ResultDescriptor descriptor, value) {
|
||||
if (descriptor == PARSED_UNIT && value != null) {
|
||||
context.getNotice(target).parsedDartUnit = value;
|
||||
shouldSetErrors = true;
|
||||
}
|
||||
if (_isErrorResult(descriptor)) {
|
||||
shouldSetErrors = true;
|
||||
}
|
||||
hasErrorResult = hasErrorResult || _isErrorResult(descriptor);
|
||||
});
|
||||
if (hasErrorResult) {
|
||||
if (shouldSetErrors) {
|
||||
AnalysisErrorInfo info = getErrors(target);
|
||||
context.getNotice(target).setErrors(info.errors, info.lineInfo);
|
||||
}
|
||||
}
|
||||
if (target is LibrarySpecificUnit) {
|
||||
Source source = target.source;
|
||||
bool hasErrorResult = false;
|
||||
bool shouldSetErrors = false;
|
||||
outputs.forEach((ResultDescriptor descriptor, value) {
|
||||
if (descriptor == RESOLVED_UNIT && value != null) {
|
||||
context.getNotice(source).resolvedDartUnit = value;
|
||||
shouldSetErrors = true;
|
||||
}
|
||||
if (_isErrorResult(descriptor)) {
|
||||
shouldSetErrors = true;
|
||||
}
|
||||
hasErrorResult = hasErrorResult || _isErrorResult(descriptor);
|
||||
});
|
||||
if (hasErrorResult) {
|
||||
if (shouldSetErrors) {
|
||||
AnalysisErrorInfo info = getErrors(source);
|
||||
context.getNotice(source).setErrors(info.errors, info.lineInfo);
|
||||
}
|
||||
|
|
|
@ -361,20 +361,28 @@ class DartWorkManagerTest {
|
|||
}
|
||||
|
||||
void test_resultsComputed_parsedUnit() {
|
||||
when(context.getLibrariesContaining(source1)).thenReturn([]);
|
||||
LineInfo lineInfo = new LineInfo([0]);
|
||||
entry1.setValue(LINE_INFO, lineInfo, []);
|
||||
CompilationUnit unit = AstFactory.compilationUnit();
|
||||
manager.resultsComputed(source1, {PARSED_UNIT: unit});
|
||||
ChangeNoticeImpl notice = context.getNotice(source1);
|
||||
expect(notice.parsedDartUnit, unit);
|
||||
expect(notice.resolvedDartUnit, isNull);
|
||||
expect(notice.lineInfo, lineInfo);
|
||||
}
|
||||
|
||||
void test_resultsComputed_resolvedUnit() {
|
||||
when(context.getLibrariesContaining(source2)).thenReturn([]);
|
||||
LineInfo lineInfo = new LineInfo([0]);
|
||||
entry2.setValue(LINE_INFO, lineInfo, []);
|
||||
CompilationUnit unit = AstFactory.compilationUnit();
|
||||
manager.resultsComputed(
|
||||
new LibrarySpecificUnit(source1, source2), {RESOLVED_UNIT: unit});
|
||||
ChangeNoticeImpl notice = context.getNotice(source2);
|
||||
expect(notice.parsedDartUnit, isNull);
|
||||
expect(notice.resolvedDartUnit, unit);
|
||||
expect(notice.lineInfo, lineInfo);
|
||||
}
|
||||
|
||||
void test_resultsComputed_sourceKind_isLibrary() {
|
||||
|
|
Loading…
Reference in a new issue