thqby / ahk2_lib

MIT License
197 stars 26 forks source link

unsuccessful attempt to upgrade Native.ahk #55

Closed yg-i closed 2 months ago

yg-i commented 2 months ago

I tried upgrading Native.ahk from 344f2fe (committed on Sep 9, 2023) to the latest version b2c3d10 (committed on Sep 23, 2023, although the date on line 5 is still shown as @date 2023/09/09) and I'm running into the following error:

Error: Parameter #2 of Object.Prototype.DefineProp is invalid.

Specifically: Native

    ---- C:\@CS\ahk\Lib\Native\Native.ahk
    227: Else
    227: t := mems.%name%
▶   228: t.DefineProp(sub, me := this.Method(pbase, method, mit, minparams, maxparams, id))
    229: NumPut('ptr', pname, ObjPtr(me), 3 * A_PtrSize + 8)
    230: pmem += A_PtrSize - 3

Call stack:
C:\@CS\ahk\Lib\Native\Native.ahk (228) : [Object.Prototype.DefineProp] t.DefineProp(sub, me := this.Method(pbase, method, mit, minparams, maxparams, id))
C:\@CS\ahk\Lib\Native\Native.ahk (228) : [default_loader] t.DefineProp(sub, me := this.Method(pbase, method, mit, minparams, maxparams, id))
C:\@CS\ahk\Lib\Native\Native.ahk (178) : [DllCall] If !p := DllCall(module_load_addr, 'ptr', ObjPtr(loader || default_loader), 'ptr', ObjPtr(provider || Native), 'cdecl ptr')

The part of my code which includes Native.ahk is this:

#Include <Native\Native>
class JSON {
    static __New() {
        Native.LoadModule('.\' (A_PtrSize * 8) 'bit\ahk-json.dll', ['JSON'])
        this.DefineProp('true', {value: 1})
        this.DefineProp('false', {value: 0})
        this.DefineProp('null', {value: ''})
    }
    static parse(str) => Map() | Array()
    static stringify(obj, space := 0) => ''
}

I'm running the alpha, though (2.1 alpha 9), so maybe that might have been the reason.