@@ -38978,6 +38978,10 @@ type app_pattern = {
3897838978 args : Parsetree.expression list
3897938979}
3898038980
38981+ let sane_property_name_check loc s =
38982+ if String.contains s '#'then
38983+ Location.raise_errorf ~loc
38984+ "property name (%s) can not contain speical character #" s
3898138985(* match fn as *)
3898238986let view_as_app (fn : exp) s : app_pattern option =
3898338987 match fn.pexp_desc with
@@ -39012,7 +39016,7 @@ let app_exp_mapper
3901239016 | Some {op; loc} ->
3901339017 Location.raise_errorf ~loc "%s expect f%sproperty arg0 arg2 form" op op
3901439018 | None ->
39015- match view_as_app e infix_ops with
39019+ ( match view_as_app e infix_ops with
3901639020 | Some { op = "|."; args = [obj_arg; fn];loc} ->
3901739021 (*
3901839022 a |. f
@@ -39083,9 +39087,14 @@ let app_exp_mapper
3908339087 Bs_ast_invariant.warn_discarded_unused_attributes attrs ;
3908439088 {e with pexp_desc = Ast_util.method_apply loc self obj name (check_and_discard args)}
3908539089 |
39086- {pexp_desc = Pexp_ident {txt = Lident name;_ } ; _}
39090+ {pexp_desc =
39091+ (Pexp_ident {txt = Lident name;_ }
39092+ | Pexp_constant (Const_string(name,None)))
39093+ ;
39094+ pexp_loc}
3908739095 (* f##paint *)
3908839096 ->
39097+ sane_property_name_check pexp_loc name ;
3908939098 { e with pexp_desc =
3909039099 Ast_util.js_property loc (self.expr self obj) name
3909139100 }
@@ -39107,8 +39116,15 @@ let app_exp_mapper
3910739116 *)
3910839117 | Some {op = "#="; loc; args = [obj; arg]} ->
3910939118 begin match view_as_app obj ["##"] with
39110- | Some { args = [obj; {pexp_desc = Pexp_ident {txt = Lident name}}]}
39119+ | Some { args = [obj; {
39120+ pexp_desc =
39121+ Pexp_ident {txt = Lident name}
39122+ | Pexp_constant (Const_string (name, None)); pexp_loc
39123+ }
39124+ ]
39125+ }
3911139126 ->
39127+ sane_property_name_check pexp_loc name;
3911239128 Exp.constraint_ ~loc
3911339129 { e with
3911439130 pexp_desc =
@@ -39135,7 +39151,7 @@ let app_exp_mapper
3913539151 {e with pexp_desc = Ast_util.uncurry_fn_apply e.pexp_loc self fn (check_and_discard args) ;
3913639152 pexp_attributes }
3913739153 else {e with pexp_attributes } (* BS_NATIVE branch*)
39138-
39154+ )
3913939155end
3914039156module Ast_exp_extension : sig
3914139157#1 "ast_exp_extension.mli"
0 commit comments