diff options
Diffstat (limited to 'c_compiler/src/expression.cpp')
-rw-r--r-- | c_compiler/src/expression.cpp | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/c_compiler/src/expression.cpp b/c_compiler/src/expression.cpp index 4c00c94..98afad6 100644 --- a/c_compiler/src/expression.cpp +++ b/c_compiler/src/expression.cpp @@ -28,8 +28,11 @@ void Expression::countArguments(unsigned &argument_count) const (void)argument_count; } -void Expression::expressionDepth(unsigned &) const -{} +void Expression::expressionDepth(unsigned &depth_count) const +{ + if(next_expression_ != nullptr) + next_expression_->expressionDepth(depth_count); +} std::string Expression::id() const { @@ -131,6 +134,15 @@ void PostfixArrayElement::stackPosition(VariableStackBindings bindings) const } +void PostfixArrayElement::expressionDepth(unsigned &depth_count) const +{ + if(nextExpression() != nullptr) + nextExpression()->expressionDepth(depth_count); + + if(index_expression_ != nullptr) + index_expression_->expressionDepth(depth_count); +} + // PostfixFunctionCall @@ -186,6 +198,12 @@ void PostfixFunctionCall::setPostfixExpression(Expression *postfix_expression) postfix_expression_ = expression_ptr; } +void PostfixFunctionCall::expressionDepth(unsigned &depth_count) const +{ + if(argument_expression_list_ != nullptr) + argument_expression_list_->expressionDepth(depth_count); +} + // Post increment and decrement definition @@ -301,6 +319,14 @@ VariableStackBindings CastExpression::printAsm(VariableStackBindings bindings, u return bindings; } +void CastExpression::expressionDepth(unsigned &depth_count) const +{ + if(nextExpression() != nullptr) + nextExpression()->expressionDepth(depth_count); + + expression_->expressionDepth(depth_count); +} + // Additive Expression definition |