Skip to content

Static variables declaration #9

@PELock

Description

@PELock

There's a bug in Static variables declaration, they are deparsed back to Const values

Source script:

#include <Timers.au3>

$hWnd = GUICreate("random GUI")
GUISetState()
_Timer_SetTimer($hWnd, 300, "_MyTimerCallback")

Do
Until GUIGetMsg() = -3

Func _MyTimerCallback($hWnd, $Msg, $iIDTimer, $dwTime)
    Static $i = 1
    $i += 1
    If $i > 5 Then _Timer_KillTimer($hWnd, $iIDTimer)
    MsgBox(0, "Hey", "It worked.")
EndFunc

Deparsed script:

#include <Timers.au3>

$hWnd = GUICreate("random GUI")
GUISetState()
_Timer_SetTimer($hWnd, 300, "_MyTimerCallback")

Do
Until GUIGetMsg() = -3

Func _MyTimerCallback($hWnd, $Msg, $iIDTimer, $dwTime)
    Const $i = 1
    $i += 1
    If $i > 5 Then
        _Timer_KillTimer($hWnd, $iIDTimer)
    EndIf
    MsgBox(0, "Hey", "It worked.")
EndFunc

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions