Skip to content

Commit e8e58a0

Browse files
committed
fix optimiser
1 parent 7befcc8 commit e8e58a0

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

source/backends/uxn.d

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,10 @@ class BackendUXN : CompilerBackend {
653653
}
654654

655655
override void CompileFuncAddr(FuncAddrNode node) {
656+
foreach (name, word ; words) {
657+
writeln(name);
658+
}
659+
656660
if (node.func !in words) {
657661
Error(node.error, "Function '%s' doesn't exist", node.func);
658662
}

source/codeRemover.d

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,30 @@ class CodeRemover {
4141
}
4242

4343
if (funcStack.canFind(node.name)) {
44-
return;
44+
continue;
4545
}
4646

4747
funcStack ~= node.name;
4848
FindFunctions(functions[node.name]);
4949
funcStack = funcStack[0 .. $ - 1];
5050
break;
5151
}
52+
case NodeType.FuncAddr: {
53+
auto node = cast(FuncAddrNode) inode;
54+
55+
if (node.func !in functions) {
56+
continue;
57+
}
58+
59+
if (funcStack.canFind(node.func)) {
60+
continue;
61+
}
62+
63+
funcStack ~= node.func;
64+
FindFunctions(functions[node.func]);
65+
funcStack = funcStack[0 .. $ - 1];
66+
break;
67+
}
5268
case NodeType.If: {
5369
auto node = cast(IfNode) inode;
5470

0 commit comments

Comments
 (0)