1 |
|
|
#include "gwion_util.h" |
2 |
|
|
#include "gwion_ast.h" |
3 |
|
|
#include "gwion_env.h" |
4 |
|
|
#include "vm.h" |
5 |
|
|
#include "instr.h" |
6 |
|
|
#include "object.h" |
7 |
|
|
#include "gwion.h" |
8 |
|
|
#include "operator.h" |
9 |
|
|
|
10 |
|
48 |
ANN void func_operator(const Func_Def fdef, struct Op_Import *opi) { |
11 |
|
48 |
opi->op =fdef->base->xid; |
12 |
|
48 |
const m_str str = s_name(fdef->base->xid); |
13 |
|
96 |
const uint is_unary = GET_FLAG(fdef->base, unary) + |
14 |
✓✓✓✓
|
48 |
(!strcmp(str, "@conditionnal") || !strcmp(str, "@unconditionnal")); |
15 |
|
48 |
const Arg_List args = fdef->base->args; |
16 |
✓✓ |
90 |
opi->lhs = is_unary ? NULL : |
17 |
✓✓ |
42 |
args ? args->var_decl->value->type : NULL; |
18 |
✓✓ |
48 |
if(strcmp(str, "@implicit")) |
19 |
✓✓ |
94 |
opi->rhs = args ? is_unary ? args->var_decl->value->type : |
20 |
✓✓✓✓
|
94 |
(args->next ? args->next->var_decl->value->type : NULL) : NULL; |
21 |
|
|
else |
22 |
|
4 |
opi->rhs = fdef->base->ret_type; |
23 |
|
48 |
} |