diff --git a/compilerAst/src/prog8/compiler/CallGraph.kt b/compilerAst/src/prog8/compiler/CallGraph.kt index d6ae73abd..60a25226b 100644 --- a/compilerAst/src/prog8/compiler/CallGraph.kt +++ b/compilerAst/src/prog8/compiler/CallGraph.kt @@ -56,9 +56,11 @@ class CallGraph(private val program: Program) : IAstVisitor { override fun visit(directive: Directive) { val thisModule = directive.definingModule if (directive.directive == "%import") { - val importedModule: Module = program.modules.single { it.name == directive.args[0].name } - imports[thisModule] = imports.getValue(thisModule) + importedModule - importedBy[importedModule] = importedBy.getValue(importedModule) + thisModule + val importedModule = program.modules.singleOrNull { it.name == directive.args[0].name } // the module may no longer exist at all due to optimizations + if(importedModule!=null) { + imports[thisModule] = imports.getValue(thisModule) + importedModule + importedBy[importedModule] = importedBy.getValue(importedModule) + thisModule + } } super.visit(directive) diff --git a/docs/source/todo.rst b/docs/source/todo.rst index 2ad90644e..db1751c16 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -3,6 +3,7 @@ TODO Petaxian has gameplay problems on the C64 (with and without optimization) , cx16 target is fine. (seems unrelated to boolean type changes. 10.1 was still fine.) +caused by 358215e4ddf408e568ded0d36afce9f0162e21d1 Removed PostIncrDecr ...