Browse Source

Use parentheses when an arrow function's argument has a default value. (#12248)

Otherwise, printing `macro (a = 1) -> a` results in "?a = 1 -> a", which isn't valid Haxe.
player-03 2 months ago
parent
commit
c53362a358
1 changed files with 1 additions and 1 deletions
  1. 1 1
      std/haxe/macro/Printer.hx

+ 1 - 1
std/haxe/macro/Printer.hx

@@ -212,7 +212,7 @@ class Printer {
 
 	public function printFunction(func:Function, ?kind:FunctionKind) {
 		var skipParentheses = switch func.args {
-			case [{type: null}]: kind == FArrow;
+			case [{type: null, value: null}]: kind == FArrow;
 			case _: false;
 		}
 		return (func.params == null ? "" : func.params.length > 0 ? "<" + func.params.map(printTypeParamDecl).join(", ") + ">" : "")