1 #include <ozulis/core/assert.hh>
2 #include <ozulis/ast/ast.hh>
11 typedef Node
* (*clone_f
)(const Node
* node
);
12 static clone_f cloneTable_g
[NB_ENTRIES
] = { 0 };
13 static bool init_g
= true;
15 static Node
* cloneRegisterAddress(const RegisterAddress
* node
)
17 RegisterAddress
* r
= new RegisterAddress
;
23 static Node
* cloneSymbol(const Symbol
* node
)
25 Symbol
* s
= new Symbol
;
28 s
->address
= clone(node
->address
);
29 s
->type
= node
->type
; /* type will not change */
33 static void cloneInit()
37 #define ADD_ENTRY(Type) \
39 cloneTable_g[Type::nodeTypeId()] = (clone_f)clone##Type; \
42 ADD_ENTRY(RegisterAddress
);
46 Node
* clone(const Node
* node
)
51 return (cloneTable_g
[node
->nodeType
])(node
);