Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Highlighting and diagnostics for illegal catch and catch-as clauses #22

Closed
lvalkov opened this issue Jun 28, 2021 · 0 comments
Closed

Comments

@lvalkov
Copy link
Contributor

lvalkov commented Jun 28, 2021

The keyword as isn't being highlighted as such (instead, the variable.other scope has been applied to it).

According to the documentation, following catch may be a class name or comma-separated list of class names, therefore, anything following catch that is not the keyword as should be treated as an identifier and, if feasible, checked whether it corresponds to an actual class defined in the script. (If not, an Error diagnostic should be emitted.)

Lastly, following as must be a plain variable name (which need not be on the same line). Currently, no Error diagnostic is being emitted for that case (see last catch clause in the sample code).

try
	MsgBox('try')
catch as ErrorException
	MsgBox('catch as ErrorException')
catch MyCustomError as Exc
	MsgBox('catch MyCustomExceptionClass as Exc')
catch OSError as ; A plain variable name must follow.
	MsgBox('catch OSError as')

class MyCustomError extends Error
{
	
}

TryCatch

Tested with AutoHotkey_L v2.0-a137-f6f65742.

thqby added a commit that referenced this issue Jul 3, 2021
@thqby thqby closed this as completed Jul 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants