bug: closure doesn't recognize "base" keyword Topic is solved

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
User avatar
vvhitevvizard
Posts: 454
Joined: 25 Nov 2018, 10:15
Location: Russia

bug: closure doesn't recognize "base" keyword

12 Jan 2019, 10:57

Code: Select all

class class1 extends class1.class2{
	method1(){
		msgbox("1|" base.__Class) ;ok
		closure1()

		closure1(){
			msgbox("2|" this.base.__Class) ;ok
			msgbox("3|" base.__Class) ;error
		}
	}
class class2{
}}
class1.method1()
keyword base works within methods and fails within closures. this, this.base, this.base.base, etc works as expected everywhere.
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: bug: closure doesn't recognize "base" keyword

12 Jan 2019, 11:40

It is only stated to work within methods, in the documentation.
User avatar
vvhitevvizard
Posts: 454
Joined: 25 Nov 2018, 10:15
Location: Russia

Re: bug: closure doesn't recognize "base" keyword

12 Jan 2019, 13:33

I see. At least its documented. :D
Btw, for class mreq extends req, calls base.Init() and this.base.Init() work different. Within req.Init(), this.__Class=mreq with 1st variant and this.__Class=req with 2nd one. Is it intended to be so?
Last edited by vvhitevvizard on 12 Jan 2019, 13:40, edited 1 time in total.
User avatar
vvhitevvizard
Posts: 454
Joined: 25 Nov 2018, 10:15
Location: Russia

Re: bug: closure doesn't recognize "base" keyword

12 Jan 2019, 13:39

Helgef, roger that! thank u for ur quick response =)
_3D_
Posts: 277
Joined: 29 Jan 2014, 14:40

Re: bug: closure doesn't recognize "base" keyword

25 Feb 2019, 06:21

As closure cant be member of a given class then base is not accessed inside closure without this.
In other words closure not "see" class members and to do this it need this.
AHKv2.0 alpha forever.

Return to “Ask for Help (v2)”

Who is online

Users browsing this forum: Albireo, Nerafius and 15 guests