File tree 3 files changed +12
-10
lines changed
3 files changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ let handle_debugger loc (payload : Ast_payload.t) =
72
72
Location. raise_errorf ~loc " %%debugger extension doesn't accept arguments"
73
73
74
74
let handle_raw ~kind loc payload =
75
- let is_function = ref false in
75
+ let is_function = ref None in
76
76
match Ast_payload. raw_as_string_exp_exn ~kind ~is_function payload with
77
77
| None -> (
78
78
match kind with
@@ -93,9 +93,11 @@ let handle_raw ~kind loc payload =
93
93
~pval_type: (Typ. arrow Nolabel (Typ. any () ) (Typ. any () ))
94
94
[exp];
95
95
pexp_attributes =
96
- (if ! is_function then
97
- Ast_attributes. internal_expansive :: exp.pexp_attributes
98
- else exp.pexp_attributes);
96
+ (match ! is_function with
97
+ | None -> exp.pexp_attributes
98
+ | Some arity ->
99
+ Printf. eprintf " XXX raw arity:%d\n " arity;
100
+ Ast_attributes. internal_expansive :: exp.pexp_attributes);
99
101
}
100
102
101
103
let handle_raw_structure loc payload =
Original file line number Diff line number Diff line change @@ -138,11 +138,11 @@ let raw_as_string_exp_exn ~(kind : Js_raw_info.raw_kind) ?is_function (x : t) :
138
138
Location. raise_errorf ~loc
139
139
" Syntax error: a valid JS regex literal expected" );
140
140
(match is_function with
141
- | Some is_function -> (
142
- match Classify_function. classify_exp prog with
143
- | Js_function {arity = _ ; _} -> is_function := true
144
- | _ -> () )
145
- | None -> () );
141
+ | Some is_function -> (
142
+ match Classify_function. classify_exp prog with
143
+ | Js_function {arity; _} -> is_function := Some arity
144
+ | _ -> () )
145
+ | None -> () );
146
146
errors
147
147
| Raw_program -> snd (Parser_flow. parse_program false None str));
148
148
Some {e with pexp_desc = Pexp_constant (Pconst_string (str, None ))}
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ val is_single_ident : t -> Longident.t option
47
47
48
48
val raw_as_string_exp_exn :
49
49
kind :Js_raw_info .raw_kind ->
50
- ?is_function : bool ref ->
50
+ ?is_function : int option ref ->
51
51
t ->
52
52
Parsetree .expression option
53
53
(* * Convert %raw into expression *)
You can’t perform that action at this time.
0 commit comments