Skip to content

Commit

Permalink
fix(ts): fix of keywordS
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Nov 15, 2022
1 parent d16dac7 commit 04bf39b
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions chapi-ast-typescript/src/main/antlr/TypeScriptParser.g4
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,7 @@ keyword
| Namespace
| Number
| Boolean
| Of
;

getter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,7 @@ class TypeScriptFullIdentListener(node: TSIdentify) : TypeScriptAstListener() {
}

private fun parseStatement(context: TypeScriptParser.SourceElementContext) {
val stmtChild = context.statement().getChild(0)
val stmtChild = context.statement()?.getChild(0) ?: return
when (val childType = stmtChild::class.java.simpleName) {
"ReturnStatementContext" -> {
val returnStmt = stmtChild as TypeScriptParser.ReturnStatementContext
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
package chapi.ast.typescriptast

import chapi.domain.core.DataStructType
import org.junit.jupiter.api.Assertions.*
import org.junit.jupiter.api.Disabled
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Test
import java.io.File

internal class TypeScriptAnalyserTest {
@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ function test() {
alert("test");
}
exports.test = test;
"""

TypeScriptAnalyser().analysis(code, "index.tsx")
}

@Test
fun backend_arrow_function2() {
val code = """
import {EMPTY, Observable, of} from 'rxjs';
"""

TypeScriptAnalyser().analysis(code, "index.tsx")
Expand Down

0 comments on commit 04bf39b

Please sign in to comment.