aboutsummaryrefslogtreecommitdiff
path: root/src/runner/runner.h
blob: 16103ccdaaf0f12faf816287ae9e7b71d6eca21f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#pragma once

#include "compiler/ast-tree.h"
#include <ffi.h>

void runnerVariableSetValue(AstTreeVariable *variable, AstTree *value,
                            AstTreeScope *scope);
void runnerVariableSetValueWihtoutConstCheck(AstTreeVariable *variable,
                                             AstTree *value,
                                             AstTreeScope *scope);
AstTree *runnerVariableGetValue(AstTreeVariable *variable);

bool runAstTree(AstTreeRoots roots);

AstTree *runAstTreeFunction(AstTree *tree, AstTree **arguments,
                            size_t arguments_size, AstTreeScope *scope,
                            bool isComptime);

AstTree *runAstTreeBuiltin(AstTree *tree, AstTreeScope *scope,
                           AstTree **arguments);

AstTree *runAstTreeCFunction(AstTree *tree, AstTree **arguments,
                             size_t arguments_size);

AstTree *runExpression(AstTree *expr, AstTreeScope *scope, bool *shouldRet,
                       bool isLeft, bool isComptime, u32 *breakCount,
                       bool *shouldContinue, bool needOwnership);

AstTree *getForVariable(AstTree *expr, AstTreeScope *scope, bool *shouldRet,
                        bool isLeft, bool isComptime, u32 *breakCount,
                        bool *shouldContinue, bool isLazy, bool needOwnership);

bool discontinue(bool shouldRet, u32 breakCount);

AstTree *toRawValue(AstTree *value, AstTreeScope *scope);

AstTree *castTo(AstTree *value, AstTree *to);

ffi_type *toFFIType(AstTree *type);
void deleteFFIType(ffi_type *type);