From 274bb4e197efa2d4b025a6346d583e7c6a07795c Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Wed, 8 Mar 2023 11:12:26 +0300 Subject: [PATCH] Call both resolve_const and resolve_fun from resolve_var --- src/aeso_ast_to_fcode.erl | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/aeso_ast_to_fcode.erl b/src/aeso_ast_to_fcode.erl index 43b8dd6..c83d01a 100644 --- a/src/aeso_ast_to_fcode.erl +++ b/src/aeso_ast_to_fcode.erl @@ -1728,13 +1728,21 @@ bind_var(Env = #{ vars := Vars }, X) -> Env#{ vars := [X | Vars] }. resolve_var(#{ vars := Vars } = Env, [X]) -> case lists:member(X, Vars) of true -> {var, X}; - false -> resolve_const(Env, [X]) + false -> + case resolve_const(Env, [X]) of + false -> resolve_fun(Env, [X]); + Const -> Const + end end; -resolve_var(Env, Q) -> resolve_const(Env, Q). +resolve_var(Env, Q) -> + case resolve_const(Env, Q) of + false -> resolve_fun(Env, Q); + Const -> Const + end. -resolve_const(#{ consts := Consts } = Env, Q) -> +resolve_const(#{ consts := Consts }, Q) -> case maps:get(Q, Consts, not_found) of - not_found -> resolve_fun(Env, Q); + not_found -> false; Val -> Val end.