Update on typescript 3.9 #1

This commit is contained in:
sanex3339
2020-05-18 11:05:36 +03:00
parent ca71bf017c
commit 308aea0e3c
8 changed files with 94 additions and 152 deletions
@@ -16,17 +16,18 @@ export class FunctionExpressionCalleeDataExtractor extends AbstractCalleeDataExt
* @param {Identifier} callee
* @returns {ICalleeData}
*/
public extract (blockScopeBody: ESTree.Node[], callee: ESTree.Identifier): ICalleeData | null {
public extract (blockScopeBody: ESTree.Node[], callee: ESTree.Identifier | ESTree.FunctionExpression): ICalleeData | null {
let calleeName: string | null = null;
let calleeBlockStatement: ESTree.BlockStatement | null = null;
if (NodeGuards.isIdentifierNode(callee)) {
calleeName = callee.name;
calleeBlockStatement = this.getCalleeBlockStatement(
NodeStatementUtils.getParentNodeWithStatements(blockScopeBody[0]),
callee.name
);
}
if (NodeGuards.isFunctionExpressionNode(callee)) {
} else if (NodeGuards.isFunctionExpressionNode(callee)) {
calleeName = null;
calleeBlockStatement = callee.body;
}
@@ -36,7 +37,7 @@ export class FunctionExpressionCalleeDataExtractor extends AbstractCalleeDataExt
return {
callee: calleeBlockStatement,
name: callee.name ?? null
name: calleeName
};
}