aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ast.c
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2026-02-14 23:30:18 +0900
committernsfisis <nsfisis@gmail.com>2026-02-14 23:30:18 +0900
commitef0cb4dbdc1c036f70f94a905cbacae9be5abf5e (patch)
tree39e612997349dd66050fe5820fefc4da65457821 /src/ast.c
parent5a1789c2de30ec503e488ca77d664199a545a04a (diff)
downloadducc-ef0cb4dbdc1c036f70f94a905cbacae9be5abf5e.tar.gz
ducc-ef0cb4dbdc1c036f70f94a905cbacae9be5abf5e.tar.zst
ducc-ef0cb4dbdc1c036f70f94a905cbacae9be5abf5e.zip
refactor: shallow copy typedef-ed types to remove work-around
Diffstat (limited to 'src/ast.c')
-rw-r--r--src/ast.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/ast.c b/src/ast.c
index 89c8aea..790eb81 100644
--- a/src/ast.c
+++ b/src/ast.c
@@ -88,6 +88,12 @@ Type* type_new(TypeKind kind) {
return ty;
}
+Type* type_dup(Type* src) {
+ Type* ty = malloc(sizeof(Type));
+ memcpy(ty, src, sizeof(Type));
+ return ty;
+}
+
Type* type_new_ptr(Type* base) {
Type* ty = type_new(TypeKind_ptr);
ty->base = base;