[BUG] Repaired types on some parameters.
[FEAT] Implemented struct, still testing. [FEAT] Implemented var, still testing.
This commit is contained in:
@@ -53,14 +53,14 @@ void scope_close_block() {
|
||||
while (local.variables.size() > size_before_block) local.variables.pop_back();
|
||||
}
|
||||
|
||||
const int scope_declare_variable(const std::string name, const int type, const int length) {
|
||||
const int scope_declare_variable(const std::string name, const uint32_t type, const uint32_t 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;
|
||||
} else {
|
||||
for (t_variable v : scope.variables) if (v.name == name) return -1;
|
||||
}
|
||||
const int address = scope.total_size;
|
||||
const uint32_t address = scope.total_size;
|
||||
const t_variable var {name, type, length, address};
|
||||
scope.variables.push_back(var);
|
||||
scope.total_size += types_get_length(type) + (length == 0 ? 1 : length);
|
||||
|
||||
Reference in New Issue
Block a user