stage1 使用切片表达字符串而非C字符串 提供属性系统
This commit is contained in:
1 parent
a64a96f9a4
commit
72ae6d6994
14 files changed
+685
-1256
No files matched your search
+7
-3
@@ -91,12 +91,15 @@ static int compile_spl(const char *src, const char *fname, const char *outpath,
|
||||
// memory leak
|
||||
return 0;
|
||||
}
|
||||
|
||||
spl_attr_t attr;
|
||||
spl_attr_init(&attr);
|
||||
spl_sema_t sema;
|
||||
spl_type_t type;
|
||||
spl_scope_t scope;
|
||||
spl_type_init(&type);
|
||||
spl_scope_init(&scope);
|
||||
spl_sema_init(&sema, &ast, &type, &scope);
|
||||
spl_sema_init(&sema, &ast, &type, &scope, &attr);
|
||||
sema.ast = *
|
||||
spl_sema_run(&sema);
|
||||
if (sema.error_count) {
|
||||
@@ -124,13 +127,13 @@ static int compile_spl(const char *src, const char *fname, const char *outpath,
|
||||
return 1;
|
||||
}
|
||||
if (dump == DUMP_IR) {
|
||||
spl_ir_dump(&ir_builder.ir, &type);
|
||||
spl_ir_dump(&ir_builder.ir, &type, &attr);
|
||||
// memory leak
|
||||
return 0;
|
||||
}
|
||||
|
||||
spl_ir2vm_t ir2vm;
|
||||
spl_ir2vm_init(&ir2vm, &a2ir.ir->ir, sema.type);
|
||||
spl_ir2vm_init(&ir2vm, &a2ir.ir->ir, &type, &attr);
|
||||
int rc = spl_ir2vm_run(&ir2vm);
|
||||
if (rc != 0) {
|
||||
printf("ir2vm error %d", rc);
|
||||
@@ -148,6 +151,7 @@ static int compile_spl(const char *src, const char *fname, const char *outpath,
|
||||
spl_ast2ir_drop(&a2ir);
|
||||
spl_sema_drop(&sema);
|
||||
spl_ast_drop(&ast);
|
||||
// memory leak
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user