Skip to content

Commit ddd139e

Browse files
committed
fix(ts): fix end comma in constructor
1 parent e87a90c commit ddd139e

3 files changed

Lines changed: 14 additions & 3 deletions

File tree

chapi-ast-typescript/src/main/antlr/TypeScriptParser.g4

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ iteratorDefinition
680680
;
681681

682682
formalParameterList
683-
: formalParameterArg (',' formalParameterArg)* (',' lastFormalParameterArg)?
683+
: formalParameterArg (',' formalParameterArg)* (',' lastFormalParameterArg)? ','?
684684
;
685685

686686
formalParameterArg

chapi-ast-typescript/src/test/kotlin/chapi/ast/typescriptast/TypeScriptAnalyserTest.kt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package chapi.ast.typescriptast
22

33
import chapi.domain.core.DataStructType
44
import org.junit.jupiter.api.Assertions.assertEquals
5+
import org.junit.jupiter.api.Disabled
56
import org.junit.jupiter.api.Test
67
import java.io.File
78

@@ -69,7 +70,7 @@ class TypeScriptAnalyserTest {
6970
}
7071

7172
@Test
72-
@Ignore
73+
// @Disabled
7374
fun someBug() {
7475
val dir = File("/Users/phodal/bug-ui-system")
7576
dir.walkTopDown().forEach {

chapi-ast-typescript/src/test/kotlin/chapi/ast/typescriptast/TypeScriptBugTest.kt renamed to chapi-ast-typescript/src/test/kotlin/chapi/ast/typescriptast/TypeScriptRegressionTest.kt

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ package chapi.ast.typescriptast
22

33
import org.junit.jupiter.api.Test
44

5-
class TypeScriptBugTest {
5+
class TypeScriptRegressionTest {
66

77
@Test
88
internal fun backend_arrow_function() {
@@ -37,4 +37,14 @@ import {EMPTY, Observable, of} from 'rxjs';
3737
}"""
3838
TypeScriptAnalyser().analysis(code, "index.tsx")
3939
}
40+
41+
@Test
42+
fun end_with_dot() {
43+
val code = """export class SomeComponent implements OnInit, ControlValueAccessor {
44+
constructor(
45+
private fb: FormBuilder,
46+
) { }
47+
} """
48+
TypeScriptAnalyser().analysis(code, "index.tsx")
49+
}
4050
}

0 commit comments

Comments
 (0)