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

Commit

Permalink
fix(symbol_inspector): Do not return private symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
jbdeboer authored and [email protected] committed Apr 18, 2014
1 parent 8c05db6 commit a66b2c1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions lib/tools/symbol_inspector/symbol_inspector.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Iterable<Symbol> _getUsedSymbols(DeclarationMirror decl, seenDecls, path, onlyTy
seenDecls[decl.qualifiedName] = true;

if (decl.isPrivate) return [];

path = "$path -> $decl";

var used = [];
Expand Down Expand Up @@ -97,6 +98,11 @@ getSymbolsFromLibrary(String libraryName) {
if (SHOULD_PRINT_SYMBOL_TREE) print(printPrefix + unwrapSymbol(lib.qualifiedName));
printPrefix += " ";
lib.declarations.forEach((symbol, decl) {
if (decl.isPrivate) return;

// Work-around for dartbug.com/18271
if (decl is TypedefMirror && unwrapSymbol(symbol).startsWith('_')) return;

if (SHOULD_PRINT_SYMBOL_TREE) print(printPrefix + unwrapSymbol(symbol));
names.add(new QualifiedSymbol(symbol, decl.qualifiedName, lib.qualifiedName));
used[decl.qualifiedName] = _getUsedSymbols(decl, {}, "", false);
Expand Down
3 changes: 3 additions & 0 deletions test/tools/symbol_inspector/simple_library.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ class A {
static StaticFieldType staticField = null;
}

class _PrivateClass {} // Should not be exported.
typedef _PrivateTypedef(int a); // Also should not be exported.

typedef TypedefReturnType TypedefType(TypedefParam a);

class ConsParamType {}
Expand Down

0 comments on commit a66b2c1

Please sign in to comment.