Skip to content

Commit 5adbb95

Browse files
committed
add Blz functions without side effects and use sets
1 parent a9a3932 commit 5adbb95

File tree

2 files changed

+138
-118
lines changed

2 files changed

+138
-118
lines changed
Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
package de.peeeq.wurstscript.translation.imoptimizer;
22

3+
import io.vavr.collection.HashSet;
4+
import io.vavr.collection.Set;
5+
36
public class RestrictedCompressedNames {
4-
static String names[] = {"div", "val", "var", "mod", "use", "new", "for", "in", "it", "to",
7+
static Set<String> names = HashSet.of("div", "val", "var", "mod", "use", "new", "for", "in", "it", "to",
58
"Sin", "Cos", "Tan", "Pow", "I2R", "R2I", "I2S", "R2S", "S2I", "S2R",
69
"And", "Or", "Not", "or", "and", "not", "if", "set", "loop", "endif",
710
"endfunction", "endloop", "globals", "endglobals", "local", "call", "debug",
8-
"main", "config", "alias"};
11+
"main", "config", "alias");
912

10-
public static boolean contains(String s) {
11-
for (String name : names) {
12-
if (name.equals(s)) {
13-
return true;
14-
}
15-
}
16-
return false;
13+
public static boolean contains(String name) {
14+
return names.contains(name);
1715
}
1816
}

0 commit comments

Comments
 (0)