diff options
| author | EVE <EVE@EVE-PC> | 2017-03-13 16:41:45 -0400 |
|---|---|---|
| committer | EVE <EVE@EVE-PC> | 2017-03-13 16:41:45 -0400 |
| commit | 01136c6796e21f023713e026674576d8e623462d (patch) | |
| tree | e77886fe0e0adaf3c0430fba9ce248ef83f74fe4 /dice-lang/src/bjc/dicelang/v1/ast/optimization/ArithmeticCollapser.java | |
| parent | 870d769cfc152171d27b2331a7c590d0b307ad48 (diff) | |
Formatting
Diffstat (limited to 'dice-lang/src/bjc/dicelang/v1/ast/optimization/ArithmeticCollapser.java')
| -rw-r--r-- | dice-lang/src/bjc/dicelang/v1/ast/optimization/ArithmeticCollapser.java | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/dice-lang/src/bjc/dicelang/v1/ast/optimization/ArithmeticCollapser.java b/dice-lang/src/bjc/dicelang/v1/ast/optimization/ArithmeticCollapser.java index 0d10a07..9fb0a5e 100644 --- a/dice-lang/src/bjc/dicelang/v1/ast/optimization/ArithmeticCollapser.java +++ b/dice-lang/src/bjc/dicelang/v1/ast/optimization/ArithmeticCollapser.java @@ -13,17 +13,15 @@ import bjc.utils.funcdata.IList; import bjc.utils.data.Tree; class ArithmeticCollapser { - private BinaryOperator<Integer> reducer; - private OperatorDiceNode type; + private BinaryOperator<Integer> reducer; + private OperatorDiceNode type; - public ArithmeticCollapser(BinaryOperator<Integer> reducr, - OperatorDiceNode typ) { + public ArithmeticCollapser(BinaryOperator<Integer> reducr, OperatorDiceNode typ) { reducer = reducr; this.type = typ; } - public ITree<IDiceASTNode> collapse( - IList<ITree<IDiceASTNode>> children) { + public ITree<IDiceASTNode> collapse(IList<ITree<IDiceASTNode>> children) { boolean allConstant = children.allMatch((subtree) -> { return subtree.transformHead((node) -> { if (node.getType() == DiceASTType.LITERAL) { @@ -40,10 +38,8 @@ class ArithmeticCollapser { int initState = DiceASTUtils.literalToInteger(children.first()); - return children.tail().reduceAux(initState, - (currentNode, state) -> { - return reducer.apply(state, - DiceASTUtils.literalToInteger(currentNode)); - }, (state) -> new Tree<>(new IntegerLiteralNode(state))); + return children.tail().reduceAux(initState, (currentNode, state) -> { + return reducer.apply(state, DiceASTUtils.literalToInteger(currentNode)); + }, (state) -> new Tree<>(new IntegerLiteralNode(state))); } } |
