Skip to content
This repository was archived by the owner on Feb 22, 2018. It is now read-only.

Commit a66b2c1

Browse files
jbdeboertravis@travis-ci.org
authored andcommitted
fix(symbol_inspector): Do not return private symbols
1 parent 8c05db6 commit a66b2c1

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

lib/tools/symbol_inspector/symbol_inspector.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ Iterable<Symbol> _getUsedSymbols(DeclarationMirror decl, seenDecls, path, onlyTy
2525
seenDecls[decl.qualifiedName] = true;
2626

2727
if (decl.isPrivate) return [];
28+
2829
path = "$path -> $decl";
2930

3031
var used = [];
@@ -97,6 +98,11 @@ getSymbolsFromLibrary(String libraryName) {
9798
if (SHOULD_PRINT_SYMBOL_TREE) print(printPrefix + unwrapSymbol(lib.qualifiedName));
9899
printPrefix += " ";
99100
lib.declarations.forEach((symbol, decl) {
101+
if (decl.isPrivate) return;
102+
103+
// Work-around for dartbug.com/18271
104+
if (decl is TypedefMirror && unwrapSymbol(symbol).startsWith('_')) return;
105+
100106
if (SHOULD_PRINT_SYMBOL_TREE) print(printPrefix + unwrapSymbol(symbol));
101107
names.add(new QualifiedSymbol(symbol, decl.qualifiedName, lib.qualifiedName));
102108
used[decl.qualifiedName] = _getUsedSymbols(decl, {}, "", false);

test/tools/symbol_inspector/simple_library.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ class A {
1515
static StaticFieldType staticField = null;
1616
}
1717

18+
class _PrivateClass {} // Should not be exported.
19+
typedef _PrivateTypedef(int a); // Also should not be exported.
20+
1821
typedef TypedefReturnType TypedefType(TypedefParam a);
1922

2023
class ConsParamType {}

0 commit comments

Comments
 (0)