Fixed parenthesis being discarded from compiled calculations in cases where they should not be

This commit is contained in:
Stefan Zermatten
2021-02-02 15:13:49 +02:00
parent a6df4df534
commit 69c72e0987

View File

@@ -8,13 +8,12 @@ export default class ParenthesisNode extends ParseNode {
resolve(fn, scope, context){
let content = this.content[fn](scope, context);
if (
content.constructor.name === 'IfNode' ||
content.constructor.name === 'OperatorNode' ||
content.constructor.name === 'RollNode'
content.constructor.name === 'ConstantNode' ||
content.constructor.name === 'ErrorNode'
){
return new ParenthesisNode({content, previousNodes: [this]});
} else {
return content;
} else {
return new ParenthesisNode({content});
}
}
toString(){