aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/ast.c
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-09-13 13:17:28 +0900
committernsfisis <nsfisis@gmail.com>2025-09-13 13:17:28 +0900
commita7c9c3407582f0d8d66539cf90e86fe3100787c5 (patch)
treeb8b4132ee0c116fae50f45107f3ae89a9a1911a6 /src/ast.c
parent8de7fa9da5fd8015f4fcc826b9270061b7b89478 (diff)
downloadducc-a7c9c3407582f0d8d66539cf90e86fe3100787c5.tar.gz
ducc-a7c9c3407582f0d8d66539cf90e86fe3100787c5.tar.zst
ducc-a7c9c3407582f0d8d66539cf90e86fe3100787c5.zip
feat: implement cast expression
Diffstat (limited to 'src/ast.c')
-rw-r--r--src/ast.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/ast.c b/src/ast.c
index 84fe38e..d698543 100644
--- a/src/ast.c
+++ b/src/ast.c
@@ -282,6 +282,13 @@ AstNode* ast_new_member_access_expr(AstNode* obj, const char* name) {
return e;
}
+AstNode* ast_new_cast_expr(AstNode* operand, Type* result_ty) {
+ AstNode* e = ast_new(AstNodeKind_cast_expr);
+ e->node_operand = operand;
+ e->ty = result_ty;
+ return e;
+}
+
int type_sizeof_struct(Type* ty) {
int next_offset = 0;
int struct_align = 0;