aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2019-02-15 09:55:04 +0100
committerGitHub <[email protected]>2019-02-15 09:55:04 +0100
commit741109889b96e92c2edc38f4068e27ac5cd53fb8 (patch)
tree801ea328f8d382792d80a925c65e29ca4a488e73
parentacf97f8bcb4846bdc5935770b22ce1cb84a90a15 (diff)
parent5c4e24725e1f4b2db89b8f58423a0ba29132faf9 (diff)
downloadotp-741109889b96e92c2edc38f4068e27ac5cd53fb8.tar.gz
otp-741109889b96e92c2edc38f4068e27ac5cd53fb8.tar.bz2
otp-741109889b96e92c2edc38f4068e27ac5cd53fb8.zip
Merge pull request #2141 from bjorng/bjorn/compiler/left-assoc-performance/ERL-851/OTP-15577
Make dialyzer faster for left-associative andalso/orelse expressions
-rw-r--r--lib/compiler/src/v3_core.erl6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/compiler/src/v3_core.erl b/lib/compiler/src/v3_core.erl
index 27131bc3ab..66e578b776 100644
--- a/lib/compiler/src/v3_core.erl
+++ b/lib/compiler/src/v3_core.erl
@@ -766,14 +766,16 @@ expr({op,_,'++',{lc,Llc,E,Qs0},More}, St0) ->
{Qs,St2} = preprocess_quals(Llc, Qs0, St1),
{Y,Yps,St} = lc_tq(Llc, E, Qs, Mc, St2),
{Y,Mps++Yps,St};
-expr({op,L,'andalso',E1,E2}, St0) ->
+expr({op,_,'andalso',_,_}=E0, St0) ->
+ {op,L,'andalso',E1,E2} = right_assoc(E0, 'andalso', St0),
Anno = lineno_anno(L, St0),
{#c_var{name=V0},St} = new_var(Anno, St0),
V = {var,L,V0},
False = {atom,L,false},
E = make_bool_switch(L, E1, V, E2, False, St0),
expr(E, St);
-expr({op,L,'orelse',E1,E2}, St0) ->
+expr({op,_,'orelse',_,_}=E0, St0) ->
+ {op,L,'orelse',E1,E2} = right_assoc(E0, 'orelse', St0),
Anno = lineno_anno(L, St0),
{#c_var{name=V0},St} = new_var(Anno, St0),
V = {var,L,V0},