diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2017-03-22 14:17:29 +0000 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2017-03-22 14:17:29 +0000 |
commit | f12ccd62ecf08774ce599a2e15d9042500d2760a (patch) | |
tree | 12012ae296025441c3329e23a7290732cf33c36c /c_compiler/src/bindings.cpp | |
parent | 190b7a0e5d45367230795ac0bdf6fc2f248ba9e1 (diff) | |
download | Compiler-f12ccd62ecf08774ce599a2e15d9042500d2760a.tar.gz Compiler-f12ccd62ecf08774ce599a2e15d9042500d2760a.zip |
Adding test and break working
Diffstat (limited to 'c_compiler/src/bindings.cpp')
-rw-r--r-- | c_compiler/src/bindings.cpp | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/c_compiler/src/bindings.cpp b/c_compiler/src/bindings.cpp index a76429c..944ce56 100644 --- a/c_compiler/src/bindings.cpp +++ b/c_compiler/src/bindings.cpp @@ -1,12 +1,10 @@ #include "bindings.hpp" -#include <iostream> - // VariableStackBindings definition VariableStackBindings::VariableStackBindings() - : stack_counter_(0), expression_stack_(16) + : break_label_(""), continue_label_(""), stack_counter_(0), expression_stack_(16) {} void VariableStackBindings::insertBinding(std::string id, TypePtr type, int stack_position) @@ -33,11 +31,33 @@ void VariableStackBindings::nextExpressionStackPosition() expression_stack_ += 4; } -void VariableStackBindings::setExpressionStackPosition(const int& stack_counter) +void VariableStackBindings::setExpressionStackPosition(const int &stack_counter) { expression_stack_ = stack_counter; } +std::string VariableStackBindings::breakLabel() +{ + return break_label_; +} + +std::string VariableStackBindings::breakLabel(const std::string &label) +{ + break_label_ = label; + return break_label_; +} + +std::string VariableStackBindings::continueLabel() +{ + return continue_label_; +} + +std::string VariableStackBindings::continueLabel(const std::string &label) +{ + continue_label_ = label; + return continue_label_; +} + int VariableStackBindings::currentStackPosition() const { return stack_counter_; |