mirror of
https://github.com/irmen/prog8.git
synced 2025-01-11 13:29:45 +00:00
fix regression bug that left variables uninitialized
This commit is contained in:
parent
0a5b30e21c
commit
19fe58dbac
@ -28,14 +28,14 @@ internal class VarConstantValueTypeAdjuster(private val program: Program, privat
|
||||
errors.err(x.message, x.position)
|
||||
}
|
||||
|
||||
// move a vardecl to the scope of the defining subroutine and put a regular assignment in its place here (if it has a value)
|
||||
if(decl.type== VarDeclType.VAR && decl.datatype in NumericDatatypes) {
|
||||
// move vardecl to the containing subroutine and add initialization assignment in its place if needed
|
||||
if(decl.type == VarDeclType.VAR && decl.datatype in NumericDatatypes) {
|
||||
val subroutine = decl.definingSubroutine() as? INameScope
|
||||
if(subroutine!=null) {
|
||||
if(subroutine!=null && subroutine!==parent) {
|
||||
val declValue = decl.value
|
||||
decl.value = null
|
||||
decl.allowInitializeWithZero = false
|
||||
return if(declValue==null) {
|
||||
return if (declValue == null) {
|
||||
listOf(
|
||||
IAstModification.Remove(decl, parent as INameScope),
|
||||
IAstModification.InsertFirst(decl, subroutine)
|
||||
|
@ -492,7 +492,7 @@ galaxy {
|
||||
ubyte current_planet = planet.number
|
||||
ubyte px = planet.x
|
||||
ubyte py = planet.y
|
||||
uword current_name = planet.name
|
||||
uword current_name = &planet.name
|
||||
ubyte pn = 0
|
||||
uword scaling = 8
|
||||
if local
|
||||
|
Loading…
x
Reference in New Issue
Block a user