File tree 1 file changed +17
-1
lines changed
1 file changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -12,9 +12,10 @@ class CodeRemover {
12
12
Node[][string ] functions;
13
13
string [] funcStack;
14
14
bool success = true ;
15
+ string [] specialFuncs;
15
16
16
17
this () {
17
- usedFunctions = [
18
+ specialFuncs = [
18
19
" __x86_64_program_init" ,
19
20
" __x86_64_program_exit" ,
20
21
" __rm86_program_init" ,
@@ -23,12 +24,15 @@ class CodeRemover {
23
24
" __arm64_program_exit" ,
24
25
" uxn_program_init" ,
25
26
" uxn_program_end" ,
27
+ " __uxn_program_init" ,
28
+ " __uxn_program_end" ,
26
29
" __x86_64_exception" ,
27
30
" __rm86_exception" ,
28
31
" __uxn_exception" ,
29
32
" __arm64_exception" ,
30
33
" __lua_exception" ,
31
34
];
35
+ usedFunctions = specialFuncs;
32
36
}
33
37
34
38
final void Error (Char, A... )(ErrorInfo error, in Char[] fmt, A args) {
@@ -101,6 +105,18 @@ class CodeRemover {
101
105
FindFunctions(node.nodes);
102
106
break ;
103
107
}
108
+ case NodeType.FuncDef: {
109
+ auto node = cast (FuncDefNode) inode;
110
+
111
+ if (! specialFuncs.canFind(node.name)) {
112
+ continue ;
113
+ }
114
+
115
+ funcStack ~= node.name;
116
+ FindFunctions(functions[node.name]);
117
+ funcStack = funcStack[0 .. $ - 1 ];
118
+ break ;
119
+ }
104
120
default : break ;
105
121
}
106
122
}
You can’t perform that action at this time.
0 commit comments