mirror of
https://github.com/DarkPlacesEngine/gmqcc.git
synced 2025-01-31 03:50:36 +00:00
Testing CALLs in test-ast
This commit is contained in:
parent
904196e9bb
commit
bcd8138e43
2 changed files with 15 additions and 0 deletions
|
@ -47,6 +47,17 @@ do { \
|
|||
#define BIN(op, a, b) \
|
||||
(ast_expression*)ast_binary_new(ctx, INSTR_##op, (ast_expression*)(a), (ast_expression*)(b))
|
||||
|
||||
#define CALL(what) \
|
||||
do { \
|
||||
ast_call *call = ast_call_new(ctx, (ast_expression*)what); \
|
||||
|
||||
#define CALLPARAM(x) \
|
||||
assert(ast_call_params_add(call, (ast_expression*)x));
|
||||
|
||||
#define ENDCALL() \
|
||||
STATE(call); \
|
||||
} while(0)
|
||||
|
||||
#define WHILE(cond) \
|
||||
do { \
|
||||
ast_expression *wh_cond = (ast_expression*)(cond); \
|
||||
|
|
|
@ -63,6 +63,10 @@ FUNCTION(main, TYPE_VOID);
|
|||
STATE(ASSIGN(STORE_F, vi, BIN(ADD_F, vi, f1)));
|
||||
ENDWHILE();
|
||||
|
||||
CALL(print)
|
||||
CALLPARAM(sHello)
|
||||
ENDCALL();
|
||||
|
||||
ENDFUNCTION(main);
|
||||
|
||||
ir = ir_builder_new("ast_test");
|
||||
|
|
Loading…
Reference in a new issue