From cdc2cc9495ba17f97928955be2d642b42ac815cb Mon Sep 17 00:00:00 2001 From: Andre Murbach Maidl Date: Fri, 3 Nov 2017 11:00:44 -0200 Subject: [PATCH] marking a variable as assigned only if it was declared --- titan-compiler/checker.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/titan-compiler/checker.lua b/titan-compiler/checker.lua index c19f1c2..c1a1682 100644 --- a/titan-compiler/checker.lua +++ b/titan-compiler/checker.lua @@ -278,9 +278,9 @@ function checkstat(node, st, errors) st:with_block(checkfor, node, st, errors) elseif tag == "Stat_Assign" then checkexp(node.var, st, errors) - -- mark this variable as assigned to - if node.var._tag == "Var_Name" then - node.var._decl._assigned = true + -- mark this declared variable as assigned to + if node.var._tag == "Var_Name" and node.var._decl then + node.var._decl._assigned = true end checkexp(node.exp, st, errors, node.var._type) node.exp = trycoerce(node.exp, node.var._type)