SpacemanDMM icon indicating copy to clipboard operation
SpacemanDMM copied to clipboard

Adds warning on `var/static` when it's declared with a proc in a proc

Open EvilDragonfiend opened this issue 6 months ago • 0 comments

DMM should give us a warn when a static variable takes a value from a proc on var declaration

/proc/glob_foo()
    var/static/hello = another_foo()

This has a high chance to cause an issue, because hello in glob_foo() will be initialized in pre-runtime, while when another_foo() proc isn't ready to return a value properly, for example, it's a subsystem proc, the variable may not take a desired value.

This should be:

/proc/glob_foo()
    var/static/hello
    if(isnull(hello))
        hello = another_foo()

EvilDragonfiend avatar Aug 12 '24 08:08 EvilDragonfiend