Skip to content

Commit

Permalink
Rename #if_stmt.else to else_block to support Erlang/OTP 27.0-rc1
Browse files Browse the repository at this point in the history
  • Loading branch information
badlop authored and rvirding committed Feb 22, 2024
1 parent b750dea commit bb92f74
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/luerl_comp.hrl
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
gens, %Generators
body=[]}). %Loop body

-record(if_stmt, {l,tests=[],else}).
-record(if_stmt, {l,tests=[],else_block}).

-record(local_assign_stmt, {l,vars,exps}).

Expand Down
2 changes: 1 addition & 1 deletion src/luerl_comp_cg.erl
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ repeat_stmt(#repeat_stmt{body=B}, St0) ->
%% test-block. This means more nested calls but simpler emulator
%% code.

if_stmt(#if_stmt{tests=Ts,else=E}, St) ->
if_stmt(#if_stmt{tests=Ts,else_block=E}, St) ->
if_tests(Ts, E, St).

if_tests([{E,B}], #block{body=[]}, St0) ->
Expand Down
4 changes: 2 additions & 2 deletions src/luerl_comp_env.erl
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,10 @@ repeat_stmt(#repeat_stmt{body=B0}=R, St0) ->

%% if_stmt(If, State) -> {If,State}.

if_stmt(#if_stmt{tests=Ts0,else=E0}=I, St0) ->
if_stmt(#if_stmt{tests=Ts0,else_block=E0}=I, St0) ->
{Ts1,St1} = if_tests(Ts0, St0),
{E1,St2} = do_block(E0, St1),
{I#if_stmt{tests=Ts1,else=E1},St2}.
{I#if_stmt{tests=Ts1,else_block=E1},St2}.

if_tests([{E0,B0}|Ts0], St0) ->
{E1,St1} = exp(E0, St0),
Expand Down
2 changes: 1 addition & 1 deletion src/luerl_comp_lint.erl
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ while_stmt(#while_stmt{exp=Exp,body=Ss}, St0) ->
repeat_stmt(#repeat_stmt{body=Ss}, St) ->
block(Ss, St).

if_stmt(#if_stmt{tests=Ts,else=Else}, St0) ->
if_stmt(#if_stmt{tests=Ts,else_block=Else}, St0) ->
Fun = fun ({E,B}, S0) ->
S1 = exp(E, S0),
block(B, S1)
Expand Down
4 changes: 2 additions & 2 deletions src/luerl_comp_locf.erl
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,11 @@ repeat_stmt(#repeat_stmt{body=B0}=R, St0) ->
%% The block info includes anything from the test expressions even
%% though we keep them separate.

if_stmt(#if_stmt{tests=Ts0,else=E0}=If, St0) ->
if_stmt(#if_stmt{tests=Ts0,else_block=E0}=If, St0) ->
{Ts1,Tlocf,St1} = if_tests(Ts0, St0),
{E1,Elocf,St2} = do_block(E0, St1),
Locf = Tlocf or Elocf,
{If#if_stmt{tests=Ts1,else=E1},Locf,St2}.
{If#if_stmt{tests=Ts1,else_block=E1},Locf,St2}.

if_tests([{E0,B0}|Ts0], St0) ->
{E1,Elocf,St1} = exp(E0, St0),
Expand Down
2 changes: 1 addition & 1 deletion src/luerl_comp_normalise.erl
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ if_stmt(Line, Tests, Else, St0) ->
{Cts,St1} = if_tests(Line, Tests, St0),
{Ce,St2} = block(Line, Else, St1),
Anno = line_file_anno(Line, St2),
{#if_stmt{l=Anno,tests=Cts,else=Ce},St2}.
{#if_stmt{l=Anno,tests=Cts,else_block=Ce},St2}.

if_tests(L, Ts, St) ->
Test = fun ({T,B}, S0) ->
Expand Down
4 changes: 2 additions & 2 deletions src/luerl_comp_vars.erl
Original file line number Diff line number Diff line change
Expand Up @@ -186,12 +186,12 @@ repeat_stmt(#repeat_stmt{body=B0}=R, _, St0) ->
%% The block info includes anything from the test expressions even
%% though we keep them separate.

if_stmt(#if_stmt{tests=Ts0,else=E0}=If, Loc, St0) ->
if_stmt(#if_stmt{tests=Ts0,else_block=E0}=If, Loc, St0) ->
{Ts1,Tused,Tfused,St1} = if_tests(Ts0, Loc, St0),
{E1,Eused,Efused,St2} = do_block(E0, St1),
Used = union(Tused, Eused),
Fused = union(Tfused, Efused),
{If#if_stmt{tests=Ts1,else=E1},[],Used,Fused,St2}.
{If#if_stmt{tests=Ts1,else_block=E1},[],Used,Fused,St2}.

if_tests([{E0,B0}|Ts0], Loc, St0) ->
{E1,Eused,Efused,St1} = exp(E0, Loc, St0),
Expand Down

0 comments on commit bb92f74

Please sign in to comment.