feat: trait 接口系统 — trait Show { fn method } + extend Trait Struct { }
This commit is contained in:
@@ -274,3 +274,11 @@ AstNode* ast_make_use_decl(void* alloc, const char* path, const char* item, Sour
|
||||
n->as.use_decl.item = item;
|
||||
return n;
|
||||
}
|
||||
|
||||
AstNode* ast_make_trait_decl(void* alloc, const char* name, AstNode** methods, size_t count, SourceLoc loc) {
|
||||
NEW(alloc, AST_TRAIT_DECL);
|
||||
n->as.trait_decl.name = name;
|
||||
n->as.trait_decl.methods = methods;
|
||||
n->as.trait_decl.method_count = count;
|
||||
return n;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user