Skip to content

Commit

Permalink
Verbose variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
christophercurrie committed May 13, 2019
1 parent 67b1e95 commit d1e4455
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions src/ExportMap.js
Expand Up @@ -514,19 +514,27 @@ ExportMap.parse = function (path, content, context) {

// This doesn't declare anything, but changes what's being exported.
if (n.type === 'TSExportAssignment') {
const md = ast.body.find(
(b) => b.type === 'TSModuleDeclaration' && b.id.name === n.expression.name
const moduleDecl = ast.body.find((bodyNode) =>
bodyNode.type === 'TSModuleDeclaration' && bodyNode.id.name === n.expression.name
)
if (md && md.body && md.body.body) {
md.body.body.forEach((b) => {
log(moduleDecl)
log(moduleDecl.body)
if (moduleDecl && moduleDecl.body && moduleDecl.body.body) {
moduleDecl.body.body.forEach((moduleBlockNode) => {
// Export-assignment exports all members in the namespace, explicitly exported or not.
const s = b.type === 'ExportNamedDeclaration' ? b.declaration : b
if (s.type === 'VariableDeclaration') {
s.declarations.forEach((d) =>
recursivePatternCapture(d.id,
id => m.namespace.set(id.name, captureDoc(source, docStyleParsers, d, n))))
const exportedDecl = moduleBlockNode.type === 'ExportNamedDeclaration' ?
moduleBlockNode.declaration :
moduleBlockNode

if (exportedDecl.type === 'VariableDeclaration') {
exportedDecl.declarations.forEach((decl) =>
recursivePatternCapture(decl.id,(id) => m.namespace.set(
id.name, captureDoc(source, docStyleParsers, decl, exportedDecl, moduleBlockNode))
)
)
} else {
m.namespace.set(s.id.name, captureDoc(source, docStyleParsers, b))
m.namespace.set(exportedDecl.id.name,
captureDoc(source, docStyleParsers, moduleBlockNode))
}
})
}
Expand Down

0 comments on commit d1e4455

Please sign in to comment.