Skip to content

Commit

Permalink
fix(ts): fix end comma in constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
phodal committed Nov 15, 2022
1 parent e87a90c commit ddd139e
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
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 @@ -680,7 +680,7 @@ iteratorDefinition
;

formalParameterList
: formalParameterArg (',' formalParameterArg)* (',' lastFormalParameterArg)?
: formalParameterArg (',' formalParameterArg)* (',' lastFormalParameterArg)? ','?
;

formalParameterArg
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package chapi.ast.typescriptast

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

Expand Down Expand Up @@ -69,7 +70,7 @@ class TypeScriptAnalyserTest {
}

@Test
@Ignore
// @Disabled
fun someBug() {
val dir = File("/Users/phodal/bug-ui-system")
dir.walkTopDown().forEach {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package chapi.ast.typescriptast

import org.junit.jupiter.api.Test

class TypeScriptBugTest {
class TypeScriptRegressionTest {

@Test
internal fun backend_arrow_function() {
Expand Down Expand Up @@ -37,4 +37,14 @@ import {EMPTY, Observable, of} from 'rxjs';
}"""
TypeScriptAnalyser().analysis(code, "index.tsx")
}

@Test
fun end_with_dot() {
val code = """export class SomeComponent implements OnInit, ControlValueAccessor {
constructor(
private fb: FormBuilder,
) { }
} """
TypeScriptAnalyser().analysis(code, "index.tsx")
}
}

0 comments on commit ddd139e

Please sign in to comment.