mirror of
https://github.com/badvision/lawless-legends.git
synced 2025-03-01 03:30:04 +00:00
Properly track use of variables before setting them. Also, fix context which was popping from the wrong end of its stack
This commit is contained in:
parent
dd89499e76
commit
f1fead66f1
@ -235,7 +235,7 @@ class A2PackPartitions
|
||||
finally {
|
||||
// Preserve context in the case of an exception
|
||||
if (!threw)
|
||||
currentContext.pop()
|
||||
currentContext.removeLast()
|
||||
}
|
||||
}
|
||||
|
||||
@ -5013,7 +5013,7 @@ end
|
||||
|
||||
def packScript(script)
|
||||
{
|
||||
//println " Script '$name'"
|
||||
//println " Script '${scriptNames[script]}'"
|
||||
withContext(scriptNames[script])
|
||||
{
|
||||
curScriptName = scriptNames[script]
|
||||
@ -5045,6 +5045,7 @@ end
|
||||
def buf = new StringWriter()
|
||||
out = new PrintWriter(buf)
|
||||
variables = [] as Set
|
||||
variables += scriptArgs[script]
|
||||
|
||||
// Process the code inside it
|
||||
assert proc.@type == "procedures_defreturn"
|
||||
@ -5682,6 +5683,8 @@ end
|
||||
def packVarGet(blk)
|
||||
{
|
||||
def name = "v_" + humanNameToSymbol(getSingle(blk.field, "VAR").text(), false)
|
||||
if (!variables.contains(name))
|
||||
printWarning(String.format("used before set: '%s'", name))
|
||||
variables << name
|
||||
out << name
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user