Skip to content

Commit 4640f34

Browse files
committed
fix(ts): fix function error issues
1 parent b86d867 commit 4640f34

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

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

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,6 @@ singleExpression
905905
| singleExpression ('.' | '?''.') identifierName # PropertyAccessExpression
906906
| New (Dot Target| singleExpression ) # NewExpression
907907
// find arguments first, then found the call expression
908-
// | singleExpression typeArguments? arguments # ArgumentsExpression
909908
| '(' expressionSequence ')' # ParenthesizedExpression
910909

911910
// TODO:
@@ -914,17 +913,22 @@ singleExpression
914913

915914
| This # ThisExpression
916915
| Super # SuperExpression
917-
| identifierName # IdentifierExpression
916+
| typeArguments? identifierName # IdentifierExpression
918917
| literal # LiteralExpression
919918
| arrayLiteral # ArrayLiteralExpression
920919
| objectLiteral # ObjectLiteralExpression
921920
| templateStringLiteral # TemplateStringExpression
921+
| singleExpression As asExpression # CastAsExpression
922922

923+
// TODO: careful use those
924+
| singleExpression typeArguments? arguments # ArgumentsExpression
923925
| htmlElements # HtmlElementExpression
924926
;
925927

926928

927-
929+
asExpression
930+
: singleExpression
931+
;
928932

929933
functionExpression
930934
: Function '*'? Identifier? '(' formalParameterList? ')' typeAnnotation? '{' functionBody '}'

0 commit comments

Comments
 (0)