diff --git a/compiler/src/prog8/compiler/astprocessing/AstChecker.kt b/compiler/src/prog8/compiler/astprocessing/AstChecker.kt index a084d939a..a0f971603 100644 --- a/compiler/src/prog8/compiler/astprocessing/AstChecker.kt +++ b/compiler/src/prog8/compiler/astprocessing/AstChecker.kt @@ -61,6 +61,14 @@ internal class AstChecker(private val program: Program, } } + override fun visit(identifier: IdentifierReference) { + val targetParam = identifier.targetVarDecl(program)?.subroutineParameter + if(targetParam!=null) { + if((targetParam.parent as Subroutine).isAsmSubroutine) + errors.err("cannot refer to parameter of asmsub by name", identifier.position) + } + } + override fun visit(returnStmt: Return) { val expectedReturnValues = returnStmt.definingSubroutine?.returntypes ?: emptyList() if(expectedReturnValues.size>1) {