cleanup(testing): clean up public api spec

Change the old public api spec to check only the exported top-level symbols. This will make sure that Dart and JS do not diverge. The new public api spec verifies the TS api.

Closes #7447
This commit is contained in:
vsavkin
2016-03-11 09:00:18 -08:00
committed by Victor Savkin
parent c25b9fcf97
commit 201475e8d8
5 changed files with 120 additions and 1641 deletions

View File

@ -57,13 +57,11 @@ class ExportedSymbol {
addTo(List<String> names) {
var name = unwrapSymbol(symbol);
if (declaration is MethodMirror) {
names.add('$name()');
names.add(name);
} else if (declaration is ClassMirror) {
var classMirror = declaration as ClassMirror;
if (classMirror.isAbstract) name = '$name';
names.add(name);
classMirror.staticMembers.forEach(members('$name#', names));
classMirror.instanceMembers.forEach(members('$name.', names));
} else if (declaration is TypedefMirror) {
names.add(name);
} else if (declaration is VariableMirror) {
@ -76,15 +74,6 @@ class ExportedSymbol {
toString() => unwrapSymbol(symbol);
}
members(String prefix, List<String> names) {
return (Symbol symbol, MethodMirror method) {
var name = unwrapSymbol(symbol);
if (method.isOperator || method.isPrivate || IGNORE[name] == true) return;
var suffix = (method.isSetter || method.isGetter) ? '' : '()';
names.add('$prefix$name$suffix');
};
}
class LibraryInfo {
List<ExportedSymbol> names;
Map<Symbol, List<Symbol>> symbolsUsedForName;
@ -135,19 +124,6 @@ Iterable<Symbol> _getUsedSymbols(
}
});
}
if (decl is MethodMirror) {
MethodMirror mdecl = decl;
if (mdecl.parameters != null) mdecl.parameters.forEach((p) {
used.addAll(_getUsedSymbols(p.type, seenDecls, path, true));
});
used.addAll(_getUsedSymbols(mdecl.returnType, seenDecls, path, true));
}
if (decl is VariableMirror) {
VariableMirror vdecl = decl;
used.addAll(_getUsedSymbols(vdecl.type, seenDecls, path, true));
}
}
// Strip out type variables.