File tree Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Expand file tree Collapse file tree 3 files changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -468,12 +468,15 @@ let assume_zero_alloc attributes =
468
468
| Assume { property = Zero_alloc ; _ } -> true
469
469
| Check { property = Zero_alloc ; _ } -> false
470
470
471
- let assume_zero_alloc attributes =
472
- (* This function is used for "look-ahead" to find attributes
471
+ let get_assume_zero_alloc ~with_warnings attributes =
472
+ if with_warnings then
473
+ assume_zero_alloc attributes
474
+ else
475
+ (* This function is used for "look-ahead" to find attributes
473
476
that affect [Scoped_location] settings before translation
474
477
of expressions in that scope.
475
478
Warnings will be produced by [add_check_attribute]. *)
476
- Warnings. without_warnings (fun () -> assume_zero_alloc attributes)
479
+ Warnings. without_warnings (fun () -> assume_zero_alloc attributes)
477
480
478
481
let add_check_attribute expr loc attributes =
479
482
let to_string = function
Original file line number Diff line number Diff line change @@ -65,4 +65,4 @@ val add_function_attributes
65
65
-> Parsetree. attributes
66
66
-> Lambda. lambda
67
67
68
- val assume_zero_alloc : Parsetree .attributes -> bool
68
+ val get_assume_zero_alloc : with_warnings : bool -> Parsetree .attributes -> bool
Original file line number Diff line number Diff line change @@ -1363,7 +1363,9 @@ and transl_function ~in_new_scope ~scopes e alloc_mode param arg_mode arg_sort r
1363
1363
| (Texp_constraint _ | Texp_coerce _ | Texp_poly _ ) -> attrs)
1364
1364
e.exp_attributes e.exp_extra
1365
1365
in
1366
- let assume_zero_alloc = Translattribute. assume_zero_alloc attrs in
1366
+ let assume_zero_alloc =
1367
+ Translattribute. get_assume_zero_alloc ~with_warnings: false attrs
1368
+ in
1367
1369
let scopes =
1368
1370
if in_new_scope then begin
1369
1371
if assume_zero_alloc then set_assume_zero_alloc ~scopes
@@ -1407,7 +1409,9 @@ and transl_bound_exp ~scopes ~in_structure pat sort expr loc attrs =
1407
1409
let lam =
1408
1410
match pat_bound_idents pat with
1409
1411
| (id :: _ ) when should_introduce_scope ->
1410
- let assume_zero_alloc = Translattribute. assume_zero_alloc attrs in
1412
+ let assume_zero_alloc =
1413
+ Translattribute. get_assume_zero_alloc ~with_warnings: false attrs
1414
+ in
1411
1415
let scopes = enter_value_definition ~scopes ~assume_zero_alloc id in
1412
1416
transl_scoped_exp ~scopes sort expr
1413
1417
| _ -> transl_exp ~scopes sort expr
You can’t perform that action at this time.
0 commit comments