diff options
| author | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-07-28 16:38:59 -0400 |
|---|---|---|
| committer | bculkin2442 <bjculkin@mix.wvu.edu> | 2016-07-28 16:38:59 -0400 |
| commit | d80f404865656b6d1a8faf41cecdd61343adcd0b (patch) | |
| tree | a00a33e6e6cf2c7e568919e628828da848231027 /dice-lang/src/main/java/bjc/dicelang/ast/ArithmeticCollapser.java | |
| parent | f62abec2577d3745475581a19eff71dbb8c0494e (diff) | |
Fixed an issue with instantiating lazy values.
Also, work on language impl. notes
Diffstat (limited to 'dice-lang/src/main/java/bjc/dicelang/ast/ArithmeticCollapser.java')
| -rw-r--r-- | dice-lang/src/main/java/bjc/dicelang/ast/ArithmeticCollapser.java | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/dice-lang/src/main/java/bjc/dicelang/ast/ArithmeticCollapser.java b/dice-lang/src/main/java/bjc/dicelang/ast/ArithmeticCollapser.java index 44904e5..7537005 100644 --- a/dice-lang/src/main/java/bjc/dicelang/ast/ArithmeticCollapser.java +++ b/dice-lang/src/main/java/bjc/dicelang/ast/ArithmeticCollapser.java @@ -43,8 +43,7 @@ final class ArithmeticCollapser implements IOperatorCollapser { currentState, accumulatedState) -> { // Force evaluation of accumulated state to prevent // certain bugs from occuring - // @TODO lets see if some of these bugs are fixed - // accumulatedState.merge((l, r) -> null); + //accumulatedState.merge((l, r) -> null); return reduceStates(accumulatedState, currentState); }; @@ -94,6 +93,18 @@ final class ArithmeticCollapser implements IOperatorCollapser { private IPair<IResult, ITree<IDiceASTNode>> doArithmeticCollapse( IResult accumulatedValue, ITree<IDiceASTNode> accumulatedTree, IResult currentValue) { + if (accumulatedValue.getType() == ResultType.DUMMY + || currentValue.getType() == ResultType.DUMMY) { + DummyResult result = new DummyResult( + "Found dummy result with either accumulated dummy (" + + ((DummyResult) accumulatedValue).getData() + + ") or current dummy (" + + ((DummyResult) currentValue).getData() + + ")."); + + return new Pair<>(result, accumulatedTree); + } + boolean currentIsInt = currentValue .getType() == ResultType.INTEGER; boolean accumulatedIsInt = accumulatedValue |
