From ad14c88fde7af3016d2e02981e01e52297ad7e8c Mon Sep 17 00:00:00 2001 From: Irmen de Jong Date: Tue, 14 Nov 2023 21:53:02 +0100 Subject: [PATCH] give error when using %option merge in module scope --- compiler/src/prog8/compiler/astprocessing/AstChecker.kt | 5 ++++- docs/source/todo.rst | 1 - 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/src/prog8/compiler/astprocessing/AstChecker.kt b/compiler/src/prog8/compiler/astprocessing/AstChecker.kt index c0486b1f5..096ca53bf 100644 --- a/compiler/src/prog8/compiler/astprocessing/AstChecker.kt +++ b/compiler/src/prog8/compiler/astprocessing/AstChecker.kt @@ -7,7 +7,6 @@ import prog8.ast.expressions.* import prog8.ast.statements.* import prog8.ast.walk.IAstVisitor import prog8.code.core.* -import prog8.code.target.C64Target import prog8.code.target.Cx16Target import prog8.code.target.VMTarget import prog8.compiler.builtinFunctionReturnType @@ -832,6 +831,10 @@ internal class AstChecker(private val program: Program, if(directive.args.any {it.name !in arrayOf("align_word", "align_page", "no_symbol_prefixing", "force_output", "merge", "splitarrays", "verafxmuls")}) err("using an option that is not valid for blocks") } + if(directive.parent is Module) { + if(directive.args.any {it.name !in arrayOf("enable_floats", "no_sysinit", "splitarrays")}) + err("using an option that is not valid for modules") + } if(directive.args.any { it.name=="verafxmuls" } && compilerOptions.compTarget.name != Cx16Target.NAME) err("verafx option is only valid on cx16 target") } diff --git a/docs/source/todo.rst b/docs/source/todo.rst index 17942bfba..512ba6691 100644 --- a/docs/source/todo.rst +++ b/docs/source/todo.rst @@ -3,7 +3,6 @@ TODO ==== - improve the working of %option merge: should be able to merge your own stuff into say textio. , and improve the docs about it too. -- give error when using %option merge in module scope. - [on branch: shortcircuit] investigate McCarthy evaluation again? this may also reduce code size perhaps for things like if a>4 or a<2 .... - [on branch: ir-less-branch-opcodes] IR: reduce the number of branch instructions such as BEQ, BEQR, etc (gradually), replace with CMP(I) + status branch instruction