Skip to content

Commit

Permalink
fix(ts): fix function decl error issues
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Nov 17, 2022
1 parent 9f721bd commit 19bd271
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion chapi-ast-typescript/src/main/antlr/TypeScriptParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ enumMember
// Function Declaration

functionDeclaration
: propertyMemberBase Function '*'? identifierName callSignature functionBody? SemiColon?
: propertyMemberBase? Function '*'? identifierName callSignature functionBody? SemiColon?
;

functionBody
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -839,6 +839,9 @@ function reload() {
val codeFile = TypeScriptAnalyser().analysis(code, "index.tsx")
val defaultStruct = codeFile.DataStructures[0]
assertEquals(1, defaultStruct.Functions.size)

println(Json.encodeToString(defaultStruct.Functions[0]))

assertEquals(1, defaultStruct.Functions[0].FunctionCalls.size)
assertEquals("storage->getSystemId", defaultStruct.Functions[0].FunctionCalls[0].FunctionName)
}
Expand Down

0 comments on commit 19bd271

Please sign in to comment.