Created
May 30, 2014 00:43
-
-
Save okeuday/5b111960e2904eed244d to your computer and use it in GitHub Desktop.
Why is test1 shorter?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test1(A) -> | |
if | |
A =:= true -> | |
ok; | |
A =:= false -> | |
error | |
end. | |
test2(A) -> | |
case A of | |
true -> | |
ok; | |
false -> | |
error | |
end. | |
{function, test1, 1, 2}. | |
{label,1}. | |
{line,[{location,"test.erl",3}]}. | |
{func_info,{atom,test},{atom,test1},1}. | |
{label,2}. | |
{select_val,{x,0},{f,5},{list,[{atom,true},{f,3},{atom,false},{f,4}]}}. | |
{label,3}. | |
{move,{atom,ok},{x,0}}. | |
return. | |
{label,4}. | |
{move,{atom,error},{x,0}}. | |
return. | |
{label,5}. | |
{line,[{location,"test.erl",4}]}. | |
if_end. | |
{function, test2, 1, 7}. | |
{label,6}. | |
{line,[{location,"test.erl",10}]}. | |
{func_info,{atom,test},{atom,test2},1}. | |
{label,7}. | |
{test,is_atom,{f,10},[{x,0}]}. | |
{select_val,{x,0},{f,10},{list,[{atom,true},{f,8},{atom,false},{f,9}]}}. | |
{label,8}. | |
{move,{atom,ok},{x,0}}. | |
return. | |
{label,9}. | |
{move,{atom,error},{x,0}}. | |
return. | |
{label,10}. | |
{line,[{location,"test.erl",11}]}. | |
{case_end,{x,0}}. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
erlc +dcg test.erl
{function, test1, 1, 2}.
{label,1}.
{line,[{location,"test.erl",3}]}.
{func_info,{atom,test},{atom,test1},1}.
{label,2}.
{test,is_eq_exact,{f,6},[{x,0},{atom,true}]}.
{move,{atom,ok},{x,0}}.
return.
{label,6}.
{test,is_eq_exact,{f,5},[{x,0},{atom,false}]}.
{move,{atom,error},{x,0}}.
return.
{label,5}.
{move,{atom,if_clause},{x,0}}.
{line,[{location,"test.erl",4}]}.
{call_ext_only,1,{extfunc,erlang,error,1}}.
{label,4}.
{label,3}.
if_end.
{function, test2, 1, 8}.
{label,7}.
{line,[{location,"test.erl",10}]}.
{func_info,{atom,test},{atom,test2},1}.
{label,8}.
{test,is_atom,{f,11},[{x,0}]}.
{select_val,{x,0},{f,11},{list,[{atom,true},{f,13},{atom,false},{f,12}]}}.
{label,13}.
{move,{atom,ok},{x,0}}.
return.
{label,12}.
{move,{atom,error},{x,0}}.
return.
{label,11}.
{test_heap,3,1}.
{put_tuple,2,{x,1}}.
{put,{atom,case_clause}}.
{put,{x,0}}.
{move,{x,1},{x,0}}.
{line,[{location,"test.erl",11}]}.
{call_ext_only,1,{extfunc,erlang,error,1}}.
{label,10}.
{label,9}.
if_end.