Clean up some warnings in the server code base

Change-Id: I762fcc704fe0fa0547bbbc347eb248853d358121
Reviewed-on: https://dart-review.googlesource.com/67842
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
Brian Wilkerson 2018-08-01 21:09:45 +00:00 committed by commit-bot@chromium.org
parent e578b60899
commit 6a6e7abfc6
6 changed files with 17 additions and 6 deletions

View file

@ -105,6 +105,8 @@ class RunCommand extends Command {
benchmarks.firstWhere((b) => b.id == benchmarkId, orElse: () {
print("Benchmark '$benchmarkId' not found.");
exit(1);
// Never reached.
return null;
});
int actualIterations = repeatCount;

View file

@ -205,6 +205,7 @@ class _RenameUnitMemberValidator {
getElementQualifiedName(shadow));
result.addError(message, newLocation_fromElement(shadow));
}
return false;
});
}
}

View file

@ -26,7 +26,7 @@ Element findElementByNameOffset(Element root, int nameOffset) {
* Uses [processor] to visit all of the children of [element].
* If [processor] returns `true`, then children of a child are visited too.
*/
void visitChildren(Element element, ElementProcessor processor) {
void visitChildren(Element element, BoolElementProcessor processor) {
element.visitChildren(new _ElementVisitorAdapter(processor));
}
@ -34,7 +34,7 @@ void visitChildren(Element element, ElementProcessor processor) {
* Uses [processor] to visit all of the top-level elements of [library].
*/
void visitLibraryTopLevelElements(
LibraryElement library, ElementProcessor processor) {
LibraryElement library, VoidElementProcessor processor) {
library.visitChildren(new _TopLevelElementsVisitor(processor));
}
@ -42,7 +42,12 @@ void visitLibraryTopLevelElements(
* An [Element] processor function type.
* If `true` is returned, children of [element] will be visited.
*/
typedef bool ElementProcessor(Element element);
typedef bool BoolElementProcessor(Element element);
/**
* An [Element] processor function type.
*/
typedef void VoidElementProcessor(Element element);
/**
* A visitor that finds the deep-most [Element] that contains the [nameOffset].
@ -66,7 +71,7 @@ class _ElementByNameOffsetVisitor extends GeneralizingElementVisitor {
* A [GeneralizingElementVisitor] adapter for [ElementProcessor].
*/
class _ElementVisitorAdapter extends GeneralizingElementVisitor {
final ElementProcessor processor;
final BoolElementProcessor processor;
_ElementVisitorAdapter(this.processor);
@ -83,7 +88,7 @@ class _ElementVisitorAdapter extends GeneralizingElementVisitor {
* A [GeneralizingElementVisitor] for visiting top-level elements.
*/
class _TopLevelElementsVisitor extends GeneralizingElementVisitor {
final ElementProcessor processor;
final VoidElementProcessor processor;
_TopLevelElementsVisitor(this.processor);

View file

@ -19,6 +19,7 @@ List<Element> getChildren(Element parent, [String name]) {
if (name == null || element.displayName == name) {
children.add(element);
}
return false;
});
return children;
}

View file

@ -75,7 +75,7 @@ main() {
List<String> parameterRegexps: null,
}) {
int offset = text.indexOf(target);
return sendAnalysisGetHover(pathname, offset).then((result) {
return sendAnalysisGetHover(pathname, offset).then((result) async {
expect(result.hovers, hasLength(1));
HoverInformation info = result.hovers[0];
expect(info.offset, equals(offset));
@ -120,6 +120,7 @@ main() {
expect(info.staticType, matches(staticTypeRegexp));
}
}
return null;
});
}

View file

@ -1040,5 +1040,6 @@ abstract class _RecursiveMatcher extends Matcher {
MismatchDescriber simpleDescription(String description) =>
(Description mismatchDescription) {
mismatchDescription.add(description);
return mismatchDescription;
};
}