This commit is contained in:
radrow 2022-07-03 16:01:50 +02:00
parent 0f5daafc29
commit ed934019db

View File

@ -654,17 +654,13 @@ expr_to_fcode(Env, _Type, {list, _, Es}) ->
nil, Es); nil, Es);
expr_to_fcode(Env, _Type, {app, _, {'..', _}, [A, B]}) -> expr_to_fcode(Env, _Type, {app, _, {'..', _}, [A, B]}) ->
AV = fresh_name(),
BV = fresh_name(),
WithA = fun(X) -> {'let', AV, expr_to_fcode(Env, A), X} end,
WithB = fun(X) -> {'let', BV, expr_to_fcode(Env, B), X} end,
St = fresh_name(), St = fresh_name(),
Init = {var, AV}, Init = expr_to_fcode(Env, A),
Loop = {loop, Init, St, make_if({op, '<', [{var, St}, {var, BV}]}, Loop = {loop, Init, St, make_if({op, '<', [{var, St}, expr_to_fcode(Env, B)]},
{continue, {op, '+', [{var, St}, {lit, {int, 1}}]}}, {continue, {op, '+', [{var, St}, {lit, {int, 1}}]}},
{break, nil} {break, nil}
)}, )},
WithA(WithB(Loop)); Loop;
expr_to_fcode(Env, _Type, {app, _, {'..', _}, [A, B]}) -> expr_to_fcode(Env, _Type, {app, _, {'..', _}, [A, B]}) ->
AV = fresh_name(), AV = fresh_name(),
BV = fresh_name(), BV = fresh_name(),