From 28cc9a84971adeb1be8ab000352376aff560f6d5 Mon Sep 17 00:00:00 2001 From: Phodal Huang Date: Thu, 7 Jul 2022 18:15:30 +0800 Subject: [PATCH] fix: fix identifier issues for archguard/archguard#108 --- .../chapi/ast/typescriptast/TypeScriptFullIdentListener.kt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/chapi-ast-typescript/src/main/kotlin/chapi/ast/typescriptast/TypeScriptFullIdentListener.kt b/chapi-ast-typescript/src/main/kotlin/chapi/ast/typescriptast/TypeScriptFullIdentListener.kt index fd286efd..f12a2f8e 100644 --- a/chapi-ast-typescript/src/main/kotlin/chapi/ast/typescriptast/TypeScriptFullIdentListener.kt +++ b/chapi-ast-typescript/src/main/kotlin/chapi/ast/typescriptast/TypeScriptFullIdentListener.kt @@ -422,7 +422,10 @@ class TypeScriptFullIdentListener(node: TSIdentify) : TypeScriptAstListener() { // see also in arrow function declaration override fun enterFunctionDeclaration(ctx: TypeScriptParser.FunctionDeclarationContext?) { - val funcName = ctx!!.Identifier().text + if(ctx == null) return + if(ctx.Identifier() == null) return + + val funcName = ctx.Identifier().text val func = CodeFunction(FilePath = filePath) func.Name = funcName