mirror of
https://github.com/irmen/prog8.git
synced 2024-11-27 03:50:27 +00:00
fix var prefix issues in asm gen of anonscopes
This commit is contained in:
parent
8cec032e7d
commit
ae90a957c6
@ -57,8 +57,8 @@ class AnonymousScopeVarsCleanup(val program: Program): IAstModifyingVisitor {
|
||||
|
||||
val scope = ident.definingScope() as? AnonymousScope ?: return ident
|
||||
val vardecl = ident.targetVarDecl(program.namespace)
|
||||
return if(vardecl!=null) {
|
||||
// prefix the variable name reference
|
||||
return if(vardecl!=null && vardecl.definingScope() == ident.definingScope()) {
|
||||
// prefix the variable name reference that is defined inside the anon scope
|
||||
ident.withPrefixedName(nameprefix(scope))
|
||||
} else {
|
||||
ident
|
||||
|
@ -840,7 +840,10 @@ internal class AsmGen2(val program: Program,
|
||||
}
|
||||
|
||||
private fun translate(stmt: RepeatLoop) {
|
||||
TODO("repeat $stmt")
|
||||
// TODO("repeat $stmt")
|
||||
out(";------ TODO REPEAT")
|
||||
translate(stmt.body)
|
||||
out(";------ TODO REPEAT END")
|
||||
}
|
||||
|
||||
private fun translate(stmt: WhenStatement) {
|
||||
|
@ -10,9 +10,29 @@ main {
|
||||
sub start() {
|
||||
|
||||
A=abc
|
||||
ubyte zzz
|
||||
|
||||
repeat {
|
||||
uword wvar
|
||||
Y=abc
|
||||
Y=zzz
|
||||
wvar=99
|
||||
} until 99
|
||||
|
||||
repeat {
|
||||
uword wvar
|
||||
Y=abc
|
||||
Y=zzz
|
||||
wvar=99
|
||||
} until 99
|
||||
|
||||
if A>0 {
|
||||
uword wvar
|
||||
Y=abc
|
||||
Y=zzz
|
||||
wvar=99
|
||||
}
|
||||
|
||||
if A>0
|
||||
Y=abc ; @todo gets prefixed with anon1_ but should not be because is found in other scope...
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user