Tests started. Enabling constant declaration

This commit is contained in:
2021-05-03 18:49:26 +02:00
parent 38e3bb1630
commit 36caa0b651
7 changed files with 85 additions and 67 deletions

View File

@@ -24,6 +24,10 @@ void scope_init() {
are_we_inside_local = false;
}
const bool scope_is_local() {
return are_we_inside_local;
}
void scope_open_local() {
are_we_inside_local = true;
}
@@ -49,7 +53,7 @@ void scope_close_block() {
while (local.variables.size() > size_before_block) local.variables.pop_back();
}
const uint32_t scope_declare_variable(const std::string name, const int type, const int length) {
const int scope_declare_variable(const std::string name, const int type, const int length) {
t_scope& scope = (are_we_inside_local ? local : global);
if (are_we_inside_local) {
for (int i = blocks.top(); i < scope.variables.size(); i++ ) if (scope.variables[i].name == name) return -1;
@@ -69,6 +73,7 @@ const bool scope_variable_exists(const std::string name) {
current_var = &v;
return true;
}
return false;
}
const uint32_t scope_get_variable_address() {