Skip to content

Commit

Permalink
cant name variables "new"
Browse files Browse the repository at this point in the history
  • Loading branch information
ianharrigan committed Sep 2, 2024
1 parent 9219223 commit a97d25b
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions haxe/ui/macros/ComponentMacros.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit a97d25b

Please sign in to comment.