Skip to content

Commit

Permalink
Compiler: js-parser, support #privateName
Browse files Browse the repository at this point in the history
  • Loading branch information
hhugo committed Dec 13, 2023
1 parent 6c6bae7 commit 51b1ccf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions compiler/lib/js_output.ml
Original file line number Diff line number Diff line change
Expand Up @@ -886,8 +886,8 @@ struct
(* There MUST be a space between the yield and its
argument. A line return will not work *)))
| EPrivName i ->
PP.string f "#";
ident f i
PP.string f "#";
ident f i
| CoverCallExpressionAndAsyncArrowHead e
| CoverParenthesizedExpressionAndArrowParameterList e -> early_error e

Expand Down
10 changes: 5 additions & 5 deletions compiler/lib/js_parser.mly
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,8 @@ call_expr(x):
| T_SUPER a=arguments { ECall(vartok $startpos($1) T_SUPER,ANormal, a, p $symbolstartpos) }
| e=call_expr(x) a=access i=method_name
{ EDot (e,a,i) }
| e=call_expr(x) a=access T_POUND i=method_name
{ EDotPrivate (e,a,i) }

new_expr(x):
| e=member_expr(x) { e }
Expand All @@ -915,7 +917,9 @@ member_expr(x):
| e1=member_expr(x) T_PLING_PERIOD "[" e2=expr "]"
{ (EAccess (e1,ANullish, e2)) }
| e1=member_expr(x) ak=access i=field_name
{ (EDot(e1,ak,i)) }
{ (EDot(e1,ak,i)) }
| e1=member_expr(x) a=access T_POUND i=field_name
{ (EDotPrivate(e1,a,i)) }
| T_NEW e1=member_expr(d1) a=arguments
{ (ENew(e1, Some a)) }
| e=member_expr(x) t=template_literal
Expand All @@ -926,10 +930,6 @@ member_expr(x):
{ (EDot(vartok $startpos($1) T_SUPER,ak,i)) }
| T_NEW "." T_TARGET
{ (EDot(vartok $startpos($1) T_NEW,ANormal,Stdlib.Utf8_string.of_string_exn "target")) }
| e1=member_expr(x) "." T_POUND i=field_name
{ (EDotPrivate(e1,ANormal,i)) }
| e1=member_expr(x) T_PLING_PERIOD T_POUND i=field_name
{ (EDotPrivate(e1,ANullish,i)) }
primary_expr(x):
| e=primary_expr_no_braces
| e=x { e }
Expand Down

0 comments on commit 51b1ccf

Please sign in to comment.