[v2.0.2] Keyword as method name prompts error Topic is solved

Report problems with documented functionality
User avatar
thqby
Posts: 397
Joined: 16 Apr 2021, 11:18
Contact:

[v2.0.2] Keyword as method name prompts error

Post by thqby » 28 Jan 2023, 04:14

Code: Select all

class cls {
	try := 34  ; valid
	try() {      ; Not a valid method, class or property definition.

	}
}

User avatar
V2User
Posts: 195
Joined: 30 Apr 2021, 04:04

Re: [v2.0.2] Keyword as method name prompts error

Post by V2User » 28 Jan 2023, 05:09

Maybe such "keyword strings" will only throw only in places where potential conflicts with real keywords may happen.

User avatar
V2User
Posts: 195
Joined: 30 Apr 2021, 04:04

Re: [v2.0.2] Keyword as method name prompts error

Post by V2User » 30 Jan 2023, 01:09

Currently this code below is the only valid use:

Code: Select all

c:={}
c.DefineProp('try',{call:(ths)=>OutputDebug(3)})
c.try()
Perhaps a keyword at the first place of a line and followed by () should be reserved for future use.

User avatar
thqby
Posts: 397
Joined: 16 Apr 2021, 11:18
Contact:

Re: [v2.0.2] Keyword as method name prompts error

Post by thqby » 30 Jan 2023, 04:20

https://github.com/AutoHotkey/AutoHotkey/blob/v2.0/source/script.cpp#L1437

I think this can be changed to if (is_control_flow && (g->CurrentFunc || !g_script.mClassObjectCount)).

lexikos
Posts: 9553
Joined: 30 Sep 2013, 04:07
Contact:

Re: [v2.0.2] Keyword as method name prompts error  Topic is solved

Post by lexikos » 19 Jun 2023, 05:55

Fixed by v2.0.3 (using exactly the code thqby suggested - thanks).

Post Reply

Return to “Bug Reports”