diff options
author | Björn Gustavsson <[email protected]> | 2017-12-30 04:11:25 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2018-01-11 12:00:07 +0100 |
commit | 670ae523616961e4c4a2b3c230ec50a2438d477c (patch) | |
tree | 3eac01e5c25d6fbd80fd359334d3c56c630c0aea /lib/compiler/src | |
parent | ad72a944c03095c3505cb151c9a93d243fb698b6 (diff) | |
download | otp-670ae523616961e4c4a2b3c230ec50a2438d477c.tar.gz otp-670ae523616961e4c4a2b3c230ec50a2438d477c.tar.bz2 otp-670ae523616961e4c4a2b3c230ec50a2438d477c.zip |
sys_core_fold: Simplify usage of move_case_into_arg/2
Diffstat (limited to 'lib/compiler/src')
-rw-r--r-- | lib/compiler/src/sys_core_fold.erl | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/compiler/src/sys_core_fold.erl b/lib/compiler/src/sys_core_fold.erl index e28d48acf5..f78a22518e 100644 --- a/lib/compiler/src/sys_core_fold.erl +++ b/lib/compiler/src/sys_core_fold.erl @@ -379,10 +379,7 @@ expr(#c_case{}=Case0, Ctxt, Sub) -> Case = Case1#c_case{arg=Arg2,clauses=Cs2}, warn_no_clause_match(Case1, Case), Expr = eval_case(Case, Sub), - case move_case_into_arg(Case, Sub) of - impossible -> Expr; - Other -> Other - end; + move_case_into_arg(Expr, Sub); Other -> expr(Other, Ctxt, Sub) end; @@ -2815,7 +2812,7 @@ move_case_into_arg(#c_case{arg=#c_case{arg=OuterArg, Outer#c_case{arg=OuterArg, clauses=[OuterCa,OuterCb]}; false -> - impossible + Inner0 end; move_case_into_arg(#c_case{arg=#c_seq{arg=OuterArg,body=InnerArg}=Outer, clauses=InnerClauses}=Inner, _Sub) -> @@ -2831,8 +2828,8 @@ move_case_into_arg(#c_case{arg=#c_seq{arg=OuterArg,body=InnerArg}=Outer, %% Outer#c_seq{arg=OuterArg, body=Inner#c_case{arg=InnerArg,clauses=InnerClauses}}; -move_case_into_arg(_, _) -> - impossible. +move_case_into_arg(Expr, _) -> + Expr. is_any_var_used([#c_var{name=V}|Vs], Expr) -> case core_lib:is_var_used(V, Expr) of |