aboutsummaryrefslogtreecommitdiffstats
path: root/c_compiler/src/expression.cpp
diff options
context:
space:
mode:
authorYann Herklotz <ymherklotz@gmail.com>2017-03-24 23:43:45 +0000
committerYann Herklotz <ymherklotz@gmail.com>2017-03-24 23:43:45 +0000
commite027bef26e25af8e3998d06942872bdcb36ee551 (patch)
tree0e289d8a90a64cd8e0d935aa8c7de784ae677cc8 /c_compiler/src/expression.cpp
parentb8738b8d582cba01aa1e944426b0251c9c42ff37 (diff)
downloadCompiler-e027bef26e25af8e3998d06942872bdcb36ee551.tar.gz
Compiler-e027bef26e25af8e3998d06942872bdcb36ee551.zip
Fixing stuff
Diffstat (limited to 'c_compiler/src/expression.cpp')
-rw-r--r--c_compiler/src/expression.cpp30
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