@@ -38978,6 +38978,10 @@ type app_pattern = {
38978
38978
args : Parsetree.expression list
38979
38979
}
38980
38980
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
38981
38985
(* match fn as *)
38982
38986
let view_as_app (fn : exp) s : app_pattern option =
38983
38987
match fn.pexp_desc with
@@ -39012,7 +39016,7 @@ let app_exp_mapper
39012
39016
| Some {op; loc} ->
39013
39017
Location.raise_errorf ~loc "%s expect f%sproperty arg0 arg2 form" op op
39014
39018
| None ->
39015
- match view_as_app e infix_ops with
39019
+ ( match view_as_app e infix_ops with
39016
39020
| Some { op = "|."; args = [obj_arg; fn];loc} ->
39017
39021
(*
39018
39022
a |. f
@@ -39083,9 +39087,14 @@ let app_exp_mapper
39083
39087
Bs_ast_invariant.warn_discarded_unused_attributes attrs ;
39084
39088
{e with pexp_desc = Ast_util.method_apply loc self obj name (check_and_discard args)}
39085
39089
|
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}
39087
39095
(* f##paint *)
39088
39096
->
39097
+ sane_property_name_check pexp_loc name ;
39089
39098
{ e with pexp_desc =
39090
39099
Ast_util.js_property loc (self.expr self obj) name
39091
39100
}
@@ -39107,8 +39116,15 @@ let app_exp_mapper
39107
39116
*)
39108
39117
| Some {op = "#="; loc; args = [obj; arg]} ->
39109
39118
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
+ }
39111
39126
->
39127
+ sane_property_name_check pexp_loc name;
39112
39128
Exp.constraint_ ~loc
39113
39129
{ e with
39114
39130
pexp_desc =
@@ -39135,7 +39151,7 @@ let app_exp_mapper
39135
39151
{e with pexp_desc = Ast_util.uncurry_fn_apply e.pexp_loc self fn (check_and_discard args) ;
39136
39152
pexp_attributes }
39137
39153
else {e with pexp_attributes } (* BS_NATIVE branch*)
39138
-
39154
+ )
39139
39155
end
39140
39156
module Ast_exp_extension : sig
39141
39157
#1 "ast_exp_extension.mli"
0 commit comments