summaryrefslogtreecommitdiff
path: root/dice-lang/src/main/java/bjc/dicelang/ast/DiceASTUtils.java
diff options
context:
space:
mode:
Diffstat (limited to 'dice-lang/src/main/java/bjc/dicelang/ast/DiceASTUtils.java')
-rw-r--r--dice-lang/src/main/java/bjc/dicelang/ast/DiceASTUtils.java38
1 files changed, 19 insertions, 19 deletions
diff --git a/dice-lang/src/main/java/bjc/dicelang/ast/DiceASTUtils.java b/dice-lang/src/main/java/bjc/dicelang/ast/DiceASTUtils.java
index a70ee00..8d70af8 100644
--- a/dice-lang/src/main/java/bjc/dicelang/ast/DiceASTUtils.java
+++ b/dice-lang/src/main/java/bjc/dicelang/ast/DiceASTUtils.java
@@ -36,25 +36,6 @@ public class DiceASTUtils {
}
/**
- * Convert an AST tree to an integer, if possible.
- *
- * @param tree
- * The tree to convert
- * @return The tree as an integer
- *
- * @throws ClassCastException
- * if the head of the tree is not a literal (implements
- * {@link ILiteralDiceNode})
- * @throws UnsupportedOperationException
- * if the head of the tree is not optimizable
- */
- public static int toInt(ITree<IDiceASTNode> tree) {
- return tree.transformHead((node) -> {
- return ((ILiteralDiceNode) node).optimize();
- });
- }
-
- /**
* Convert an AST tree to a dice expression, if possible.
*
* @param tree
@@ -81,4 +62,23 @@ public class DiceASTUtils {
"This type of literal isn't convertable to an expression");
}
}
+
+ /**
+ * Convert an AST tree to an integer, if possible.
+ *
+ * @param tree
+ * The tree to convert
+ * @return The tree as an integer
+ *
+ * @throws ClassCastException
+ * if the head of the tree is not a literal (implements
+ * {@link ILiteralDiceNode})
+ * @throws UnsupportedOperationException
+ * if the head of the tree is not optimizable
+ */
+ public static int toInt(ITree<IDiceASTNode> tree) {
+ return tree.transformHead((node) -> {
+ return ((ILiteralDiceNode) node).optimize();
+ });
+ }
}