|
@@ -2252,6 +2252,11 @@ module ClassInitializer = struct
|
|
|
let e = if ctx.com.display.dms_display && ctx.com.display.dms_error_policy <> EPCollect then
|
|
|
e
|
|
|
else begin
|
|
|
+ let e = Optimizer.reduce_loop ctx (maybe_run_analyzer e) in
|
|
|
+ let e = (match Optimizer.make_constant_expression ctx e with
|
|
|
+ | Some e -> e
|
|
|
+ | None -> e
|
|
|
+ ) in
|
|
|
let rec check_this e = match e.eexpr with
|
|
|
| TConst TThis ->
|
|
|
display_error ctx "Cannot access this or other member field in variable initialization" e.epos;
|
|
@@ -2262,13 +2267,8 @@ module ClassInitializer = struct
|
|
|
| _ ->
|
|
|
Type.iter check_this e
|
|
|
in
|
|
|
- try
|
|
|
- check_this e;
|
|
|
- match Optimizer.make_constant_expression ctx (maybe_run_analyzer e) with
|
|
|
- | Some e -> e
|
|
|
- | None -> e
|
|
|
- with Exit ->
|
|
|
- e
|
|
|
+ (try check_this e with Exit -> ());
|
|
|
+ e
|
|
|
end in
|
|
|
e
|
|
|
| Var v when v.v_read = AccInline ->
|