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

[docs] haxe.macro.ExprDef EReturn(Expr) should be EReturn(Null<Expr>) #278

Open
NQNStudios opened this issue Jan 4, 2021 · 3 comments
Open

Comments

@NQNStudios
Copy link

In the macro API documentation here, the EReturn ExprDef is stated as having an Expr parameter, but it accepts null, and with a null parameter it becomes a plain return; statement. In other cases of ExprDef, where behavior is different when passing a null parameter, the documentation shows the parameter typed as Null so it should be for EReturn as well. I checked the ExprDef source and found that in the code the type is correct as of two years ago, so the documentation must be out of date.

@kLabz
Copy link
Contributor

kLabz commented Jan 4, 2021

Hmm. Null<Expr> has indeed been removed in development branch, but expr is still optional EReturn(?e:Expr). Maybe some dox issue?

@NQNStudios
Copy link
Author

The API doc pages all say that they're generated for 4.1.3, and looking at the 4.1.3 source for ExprDef I see that EReturn is different from the other types with optional params.

EReturn(?e:Null<Expr>);
vs.
ESwitch(e:Expr, cases:Array<Case>, edef:Null<Expr>);
EIf(econd:Expr, eif:Expr, eelse:Null<Expr>);

As of 4.1.3, EReturn's param is declared with both ? and Null<>. Maybe that caused the problem. On development, it changed to just ? but EIf and ESwitch are still using Null<>. Maybe dox hides ? declarations?

@RealyUniqueName
Copy link
Member

The same thing happened to column parameter in https://api.haxe.org/haxe/StackItem.html#FilePos
This is indeed a dox' issue.

@RealyUniqueName RealyUniqueName transferred this issue from HaxeFoundation/haxe Jan 7, 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

3 participants