aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler/src/beam_bool.erl
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2014-03-06 10:56:59 +0100
committerBjörn Gustavsson <[email protected]>2014-03-06 10:56:59 +0100
commitff107aa1a9b7a12f72a6b5a3ab00e0088b1c2bd9 (patch)
treefbb38c1cdd0d25b8e121beb049a183200cd2d147 /lib/compiler/src/beam_bool.erl
parentcb5942909249958cd70f6247c4493db5aa6b8a5a (diff)
parent6c8c99caba7cf5f77f7f5922a026c058a55138df (diff)
downloadotp-ff107aa1a9b7a12f72a6b5a3ab00e0088b1c2bd9.tar.gz
otp-ff107aa1a9b7a12f72a6b5a3ab00e0088b1c2bd9.tar.bz2
otp-ff107aa1a9b7a12f72a6b5a3ab00e0088b1c2bd9.zip
Merge branch 'nox/compiler/beam_bool-not_boolean_expr'
* nox/compiler/beam_bool-not_boolean_expr: Compile BIF calls and operator expressions to Core the same way Do not try to optimize non-boolean guards
Diffstat (limited to 'lib/compiler/src/beam_bool.erl')
-rw-r--r--lib/compiler/src/beam_bool.erl8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/compiler/src/beam_bool.erl b/lib/compiler/src/beam_bool.erl
index 81b6d78864..d01f9ee13d 100644
--- a/lib/compiler/src/beam_bool.erl
+++ b/lib/compiler/src/beam_bool.erl
@@ -531,7 +531,9 @@ bopt_cg({prot,Pre0,Tree}, Fail, Rs0, Acc, St0) ->
bopt_cg({atom,true}, _Fail, _Rs, Acc, St) ->
{Acc,St};
bopt_cg({atom,false}, Fail, _Rs, Acc, St) ->
- {[{jump,{f,Fail}}|Acc],St}.
+ {[{jump,{f,Fail}}|Acc],St};
+bopt_cg(_, _, _, _, _) ->
+ throw(not_boolean_expr).
bopt_cg_not({'and',As0}) ->
As = [bopt_cg_not(A) || A <- As0],
@@ -544,7 +546,9 @@ bopt_cg_not({'not',Arg}) ->
bopt_cg_not({test,Test,Fail,As}) ->
{inverted_test,Test,Fail,As};
bopt_cg_not({atom,Bool}) when is_boolean(Bool) ->
- {atom,not Bool}.
+ {atom,not Bool};
+bopt_cg_not(_) ->
+ throw(not_boolean_expr).
bopt_cg_not_not({'and',As}) ->
{'and',[bopt_cg_not_not(A) || A <- As]};