From fbc6438f24609a2553ac7e5741bfd469e14f8ff7 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Fri, 25 Nov 2016 14:22:38 +0200 Subject: [PATCH] Evaluate parenthesized expression as the contained expression's value --- source/programcompiler.cpp | 5 +++++ source/programcompiler.h | 1 + 2 files changed, 6 insertions(+) diff --git a/source/programcompiler.cpp b/source/programcompiler.cpp index fd756de0..a68c8b96 100644 --- a/source/programcompiler.cpp +++ b/source/programcompiler.cpp @@ -944,6 +944,11 @@ void ProgramCompiler::ExpressionEvaluator::visit(Literal &literal) result_valid = true; } +void ProgramCompiler::ExpressionEvaluator::visit(ParenthesizedExpression &parexp) +{ + parexp.expression->visit(*this); +} + void ProgramCompiler::ExpressionEvaluator::visit(VariableReference &var) { if(!var.declaration) diff --git a/source/programcompiler.h b/source/programcompiler.h index 2a31a962..8d7d1ad1 100644 --- a/source/programcompiler.h +++ b/source/programcompiler.h @@ -168,6 +168,7 @@ private: ExpressionEvaluator(const ValueMap &); virtual void visit(ProgramSyntax::Literal &); + virtual void visit(ProgramSyntax::ParenthesizedExpression &); virtual void visit(ProgramSyntax::VariableReference &); virtual void visit(ProgramSyntax::UnaryExpression &); virtual void visit(ProgramSyntax::BinaryExpression &); -- 2.45.2