Fix hints and clean-up obsolete comment syntax (TBR)

Review-Url: https://codereview.chromium.org/2952233002 .
This commit is contained in:
Brian Wilkerson 2017-06-22 10:59:25 -07:00
parent 8b40507be3
commit ec8505fc79
8 changed files with 17 additions and 43 deletions

View file

@ -7,19 +7,19 @@
*
* The returned iterable is a lazily-evaluated view on the input iterables.
*/
Iterable/*<E>*/ concat/*<E>*/(Iterable<Iterable/*<E>*/ > iterables) =>
Iterable<E> concat<E>(Iterable<Iterable<E>> iterables) =>
iterables.expand((x) => x);
/**
* Returns the concatenation of the input [iterables] as a [List].
*/
List/*<E>*/ concatToList/*<E>*/(Iterable<Iterable/*<E>*/ > iterables) =>
List<E> concatToList<E>(Iterable<Iterable<E>> iterables) =>
concat(iterables).toList();
/**
* Returns the given [list] if it is not empty, or `null` otherwise.
*/
List/*<E>*/ nullIfEmpty/*<E>*/(List/*<E>*/ list) {
List<E> nullIfEmpty<E>(List<E> list) {
if (list == null) {
return null;
}

View file

@ -9,7 +9,6 @@ import 'package:analysis_server/plugin/analysis/analysis_domain.dart';
import 'package:analysis_server/src/analysis_server.dart';
import 'package:analysis_server/src/computer/computer_hover.dart';
import 'package:analysis_server/src/constants.dart';
import 'package:analysis_server/src/context_manager.dart';
import 'package:analysis_server/src/domain_abstract.dart';
import 'package:analysis_server/src/domains/analysis/navigation.dart';
import 'package:analysis_server/src/domains/analysis/navigation_dart.dart';
@ -453,16 +452,4 @@ class AnalysisDomainImpl implements AnalysisDomain {
}
}
}
void _subscribeForContext(engine.AnalysisContext context) {
for (ResultDescriptor descriptor in controllers.keys) {
context.onResultChanged(descriptor).listen((result) {
StreamController<engine.ResultChangedEvent> controller =
controllers[result.descriptor];
if (controller != null) {
controller.add(result);
}
});
}
}
}

View file

@ -136,22 +136,21 @@ bool mapEqual(Map mapA, Map mapB, bool valueEqual(a, b)) {
* Translate the input [map], applying [keyCallback] to all its keys, and
* [valueCallback] to all its values.
*/
Map/*<KR, VR>*/ mapMap/*<KP, VP, KR, VR>*/(Map/*<KP, VP>*/ map,
{dynamic/*=KR*/ keyCallback(/*<KP>*/ key),
dynamic/*=VR*/ valueCallback(/*<VP>*/ value)}) {
Map/*<KR, VR>*/ result = new HashMap/*<KR, VR>*/();
Map<KR, VR> mapMap<KP, VP, KR, VR>(Map<KP, VP> map,
{KR keyCallback(KP key), VR valueCallback(VP value)}) {
Map<KR, VR> result = new HashMap<KR, VR>();
map.forEach((key, value) {
Object/*=KR*/ resultKey;
Object/*=VR*/ resultValue;
KR resultKey;
VR resultValue;
if (keyCallback != null) {
resultKey = keyCallback(key);
} else {
resultKey = key as Object/*=KR*/;
resultKey = key as KR;
}
if (valueCallback != null) {
resultValue = valueCallback(value);
} else {
resultValue = value as Object/*=VR*/;
resultValue = value as VR;
}
result[resultKey] = resultValue;
});

View file

@ -2747,11 +2747,6 @@ class TestContextManagerCallbacks extends ContextManagerCallbacks {
currentContextSources.remove(path);
lastFlushedFiles = flushedFiles;
}
@override
void updateContextPackageUriResolver(AnalysisContext context) {
// Nothing to do.
}
}
/**

View file

@ -180,8 +180,7 @@ class MyAnnotation {
''');
}
@failingTest
test_OK_genericFunctionTypeInComments() async {
test_OK_genericFunctionType() async {
addFile(
projectPath + '/analysis_options.yaml',
'''
@ -204,14 +203,14 @@ class Super {}
typedef dynamic Func(String x, String y);
Function/*=F*/ allowInterop/*<F extends Function>*/(Function/*=F*/ f) => null;
F allowInterop<F extends Function>(F f) => null;
Func bar(Func f) {
return allowInterop(f);
}
''');
return _assertSorted('''
Function/*=F*/ allowInterop/*<F extends Function>*/(Function/*=F*/ f) => null;
F allowInterop<F extends Function>(F f) => null;
Func bar(Func f) {
return allowInterop(f);

View file

@ -130,7 +130,8 @@ class Iterator<E> {
abstract class Iterable<E> {
Iterator<E> get iterator;
bool get isEmpty;
Iterable/*<R>*/ map/*<R>*/(/*=R*/ f(E e));
Iterable<T> map<T>(T f(E e)) => null;
T fold<T>(T initialValue, T combine(T previousValue, E element));
}
class List<E> implements Iterable<E> {
@ -145,12 +146,6 @@ class List<E> implements Iterable<E> {
bool get isEmpty => false;
E get first => null;
E get last => null;
Iterable/*<R>*/ map/*<R>*/(/*=R*/ f(E e)) => null;
/*=R*/ fold/*<R>*/(/*=R*/ initialValue,
/*=R*/ combine(/*=R*/ previousValue, E element)) => null;
}
abstract class Map<K, V> extends Object {

View file

@ -564,8 +564,7 @@ abstract class DartCompletionContributorTest extends AbstractContextTest {
return cs;
}
Future/*<E>*/ performAnalysis/*<E>*/(
int times, Completer/*<E>*/ completer) async {
Future<E> performAnalysis<E>(int times, Completer<E> completer) async {
if (completer.isCompleted) {
return completer.future;
}

View file

@ -89,7 +89,7 @@ class StatsPage extends PageWriter {
* each kind.
*/
void _processEntries(List<LogEntry> entries) {
void increment/*<K>*/(Map<dynamic/*=K*/, int> map, dynamic/*=K*/ key) {
void increment<K>(Map<K, int> map, K key) {
map[key] = (map[key] ?? 0) + 1;
}