summaryrefslogtreecommitdiff
path: root/scope.h
diff options
context:
space:
mode:
Diffstat (limited to 'scope.h')
-rw-r--r--scope.h37
1 files changed, 10 insertions, 27 deletions
diff --git a/scope.h b/scope.h
index da35044..8a3c80f 100644
--- a/scope.h
+++ b/scope.h
@@ -2,6 +2,7 @@
#define SCOPE_H
#include "ccc.h"
+#include "type.h"
struct storage_location {
enum {
@@ -23,34 +24,19 @@ struct storage_location {
};
};
-struct type_ref {
- const struct type_def* raw_type;
- unsigned char ptr_level;
-};
-
-struct type_key {
- char* name;
- unsigned char how_long;
- bool marked_unsigned;
- bool marked_signed;
-};
-
-struct type_def {
- struct type_key key;
- bool is_signed;
- bool is_floating;
- integral_t sz;
+struct type_alias {
+ const char* name;
+ struct type type;
};
struct var_def {
- const struct type_ref* type;
+ const struct type* type;
char* name;
struct storage_location loc;
- const struct type_def* resolved_type;
};
struct scope {
- struct type_def** types;
+ struct type_alias** types;
integral_t type_sz;
integral_t type_cap;
@@ -62,19 +48,16 @@ struct scope {
integral_t bp_offset;
};
-struct ast;
-
void scope_push(struct scope** p_scope);
void scope_pop(struct scope** p_scope);
void scope_destroy(struct scope* scope);
-void scope_install_default_types(struct ast* ast);
bool scope_get_type(
const struct scope* scope,
- const struct type_def** p_entry,
- const struct type_key* key);
-const struct type_def* scope_define_type(
+ const struct type_alias** p_entry,
+ const char* name);
+const struct type_alias* scope_define_type(
struct scope* scope,
- struct type_def type);
+ struct type_alias type);
bool scope_get_var(
const struct scope* scope,
struct var_def** p_entry,