-
Notifications
You must be signed in to change notification settings - Fork 0
/
function.cpp
47 lines (39 loc) · 1.18 KB
/
function.cpp
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
41
42
43
44
45
46
47
// Copyright (c) 2009, Nicholas "Indy" Ray. All rights reserved.
// See the LICENSE file for usage, modification, and distribution terms.
#include "function.h"
compiler_type* create_compiler_type(dynamic_types type_ID)
{
compiler_type* type = new compiler_type();
type->ID = type_ID;
type->combined_type = NULL;
return type;
}
compiler_type* duplicate_compiler_type(compiler_type* src)
{
if(!src)
return NULL;
compiler_type* type = create_compiler_type(src->ID);
type->combined_type = duplicate_compiler_type(src->combined_type);
}
void destroy_compiler_type(compiler_type* type)
{
if(type->combined_type)
destroy_compiler_type(type->combined_type);
delete type;
}
compiler_variable* create_compiler_variable_own_type(compiler_type* type, symbol name)
{
compiler_variable* var = new compiler_variable();
var->type = type;
var->name = name;
return var;
}
compiler_variable* create_compiler_variable(compiler_type* type, symbol name)
{
return create_compiler_variable_own_type(duplicate_compiler_type(type), name);
}
void destroy_compiler_variable(compiler_variable* var)
{
destroy_compiler_type(var->type);
delete var;
}