frontend: implement function compilation
This commit is contained in:
@@ -107,6 +107,17 @@ int main(int argc, const char **argv)
|
||||
printf("----\n");
|
||||
|
||||
bshell_scriptblock_clear_text(block);
|
||||
switch (node->n_type) {
|
||||
case BSHELL_AST_FUNC: {
|
||||
bshell_function *func = NULL;
|
||||
bshell_compile_function(node, &func);
|
||||
print_function(func);
|
||||
bshell_runtime_define_function(rt, func);
|
||||
bshell_function_unref(func);
|
||||
break;
|
||||
}
|
||||
|
||||
default: {
|
||||
bshell_compile(node, block);
|
||||
print_scriptblock(block, 0);
|
||||
|
||||
@@ -114,7 +125,15 @@ int main(int argc, const char **argv)
|
||||
if (result.v_type != NULL) {
|
||||
format_value_default(&result, fx_stdout);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
bshell_ast_node_destroy(node);
|
||||
}
|
||||
|
||||
bshell_runtime_destroy(rt);
|
||||
bshell_scriptblock_unref(block);
|
||||
|
||||
bshell_parse_ctx_cleanup(&parse);
|
||||
bshell_lex_ctx_cleanup(&lex);
|
||||
@@ -129,5 +148,7 @@ int main(int argc, const char **argv)
|
||||
bshell_file_close(file);
|
||||
}
|
||||
|
||||
bshell_cleanup_all_verbs();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user