Skip to content

Commit

Permalink
and/or tags: short-circuit-eval
Browse files Browse the repository at this point in the history
  • Loading branch information
mcmonkey4eva committed Aug 28, 2022
1 parent 5e09827 commit 1f3e75c
Showing 1 changed file with 4 additions and 4 deletions.
Expand Up @@ -1059,8 +1059,8 @@ else if (CoreUtilities.toLowerCase(object.element).contains(contLow)) {
// Returns whether both the element and the second element are true.
// You should never ever use this tag inside any 'if', 'while', etc. command.
// -->
tagProcessor.registerStaticTag(ElementTag.class, ElementTag.class, "and", (attribute, object, compare) -> {
return new ElementTag(object.element.equalsIgnoreCase("true") && compare.asString().equalsIgnoreCase("true"));
tagProcessor.registerStaticTag(ElementTag.class, "and", (attribute, object) -> { // Intentional don't register param to allow short-circuit-eval
return new ElementTag(object.asBoolean() && attribute.getParamElement().asBoolean());
});

// <--[tag]
Expand All @@ -1071,8 +1071,8 @@ else if (CoreUtilities.toLowerCase(object.element).contains(contLow)) {
// Returns whether either the element or the second element are true.
// You should never ever use this tag inside any 'if', 'while', etc. command.
// -->
tagProcessor.registerStaticTag(ElementTag.class, ElementTag.class, "or", (attribute, object, compare) -> {
return new ElementTag(object.element.equalsIgnoreCase("true") || compare.asString().equalsIgnoreCase("true"));
tagProcessor.registerStaticTag(ElementTag.class, "or", (attribute, object) -> { // Intentional don't register param to allow short-circuit-eval
return new ElementTag(object.asBoolean() || attribute.getParamElement().asBoolean());
});

// <--[tag]
Expand Down

0 comments on commit 1f3e75c

Please sign in to comment.