From a97d25b78f49e2d6f79f3c15196000f21ab15538 Mon Sep 17 00:00:00 2001 From: Ian Harrigan Date: Mon, 2 Sep 2024 10:25:50 +0200 Subject: [PATCH] cant name variables "new" --- haxe/ui/macros/ComponentMacros.hx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/haxe/ui/macros/ComponentMacros.hx b/haxe/ui/macros/ComponentMacros.hx index fa5b7386a..c8b8fe9d1 100644 --- a/haxe/ui/macros/ComponentMacros.hx +++ b/haxe/ui/macros/ComponentMacros.hx @@ -253,6 +253,9 @@ class ComponentMacros { for (id in buildData.namedComponents.keys()) { var safeId:String = StringUtil.capitalizeHyphens(id); + if (safeId == "new") { + Context.error("'new' is a reserved word and cannot be used to name variables / components (" + resourcePath + ")", Context.currentPos()); + } var varDescription = buildData.namedComponents.get(id); var cls:String = varDescription.type; if (!builder.hasVar(safeId)) { @@ -773,6 +776,9 @@ class ComponentMacros { for (namedComponent in namedComponents.keys()) { var details = namedComponents.get(namedComponent); var safeId:String = StringUtil.capitalizeHyphens(namedComponent); + if (safeId == "new") { + Context.error("'new' is a reserved word and cannot be used to name variables / components", Context.currentPos()); + } if (usedVars.indexOf(safeId) == -1) { continue; }