dox icon indicating copy to clipboard operation
dox copied to clipboard

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

Open NQNStudios opened this issue 3 years ago • 3 comments

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<Expr> 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.

NQNStudios avatar Jan 04 '21 00:01 NQNStudios

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

kLabz avatar Jan 04 '21 05:01 kLabz

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?

NQNStudios avatar Jan 04 '21 14:01 NQNStudios

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

RealyUniqueName avatar Jan 07 '21 07:01 RealyUniqueName