Skip to content

Commit

Permalink
feat(typescript_indexer): reference modules in export statements (#3863)
Browse files Browse the repository at this point in the history
Fix a long-standing todo where module names in export statements are not
referenced to the modules they refer to. Same approach as referencing
modules in import statements.
  • Loading branch information
ayazhafiz authored and salguarnieri committed Jul 3, 2019
1 parent a2610fc commit f3eb65f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
9 changes: 7 additions & 2 deletions kythe/typescript/indexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -929,8 +929,13 @@ class Visitor {
}
}
if (decl.moduleSpecifier) {
this.todo(
decl.moduleSpecifier, `handle module specifier in ${decl.getText()}`);
const moduleSym = this.getSymbolAtLocation(decl.moduleSpecifier);
if (moduleSym) {
const kModule = this.newVName(
'module', this.getModulePathFromModuleReference(moduleSym));
this.emitEdge(
this.newAnchor(decl.moduleSpecifier), 'ref/imports', kModule);
}
}
}

Expand Down
1 change: 1 addition & 0 deletions kythe/typescript/testdata/export.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// Syntax 1: exporting a value from another module.
//- @"'./module'" ref/imports vname("module", _, _, "testdata/module", _)
export {value} from './module';

// Syntax 2: a bare "export" statement.
Expand Down

0 comments on commit f3eb65f

Please sign in to comment.