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

Discuss the future of the AutoHotkey language
User avatar
vvhitevvizard
Posts: 211
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: 3418
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: 211
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: 211
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 =)

Return to “AutoHotkey v2 Development”

Who is online

Users browsing this forum: No registered users and 4 guests