Skip to content

Commit

Permalink
feat: only count function body vars
Browse files Browse the repository at this point in the history
  • Loading branch information
meixg committed Apr 29, 2019
1 parent 1c6e70d commit 06fe03e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1764,7 +1764,8 @@ export function emitFile(
|| (node.kind === ts.SyntaxKind.MethodDeclaration && !ts.isClassDeclaration(node.parent))
) {
const wrappedNode = createWrappedNode(node, {typeChecker});
const identifiers = wrappedNode.getDescendantsOfKind(ts.SyntaxKind.Identifier);
const body = wrappedNode.getBody();
const identifiers = body.getKind() === ts.SyntaxKind.Identifier ? [body as tsMorph.Identifier] : body.getDescendantsOfKind(ts.SyntaxKind.Identifier);
const inheritedVariables: tsMorph.Identifier[] = [];
const nodeStart = node.getStart();
const nodeEnd = node.getEnd();
Expand Down
5 changes: 5 additions & 0 deletions test/features/inheritedVariables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ let f = function () {
}

let obj = {
/**
* aaa
*
* @ssr
*/
a: function () {
return '123' + b;
},
Expand Down

0 comments on commit 06fe03e

Please sign in to comment.