mirror of
https://github.com/irmen/prog8.git
synced 2024-12-27 20:33:39 +00:00
better error message
This commit is contained in:
parent
20cdcc673b
commit
c6e13ae2a3
@ -1039,7 +1039,10 @@ internal class AstChecker(private val program: Program,
|
||||
val targetStatement = target.targetStatement(program.namespace)
|
||||
if(targetStatement is Label || targetStatement is Subroutine || targetStatement is BuiltinFunctionStatementPlaceholder)
|
||||
return targetStatement
|
||||
errors.err("undefined function or subroutine: ${target.nameInSource.joinToString(".")}", statement.position)
|
||||
else if(targetStatement==null)
|
||||
errors.err("undefined function or subroutine: ${target.nameInSource.joinToString(".")}", statement.position)
|
||||
else
|
||||
errors.err("cannot call that: ${target.nameInSource.joinToString(".")}", statement.position)
|
||||
return null
|
||||
}
|
||||
|
||||
|
@ -22,6 +22,9 @@ internal class AstIdentifiersChecker(private val program: Program, private val e
|
||||
}
|
||||
|
||||
override fun visit(block: Block) {
|
||||
if(block.name in CompilationTarget.machine.opcodeNames)
|
||||
errors.err("can't use a cpu opcode name as a symbol: '${block.name}'", block.position)
|
||||
|
||||
val existing = blocks[block.name]
|
||||
if(existing!=null)
|
||||
nameError(block.name, block.position, existing)
|
||||
|
@ -10,28 +10,10 @@ main {
|
||||
sub start() {
|
||||
|
||||
byte nop2
|
||||
|
||||
nop2=4
|
||||
nop2++
|
||||
foo.xxx()
|
||||
|
||||
derp:
|
||||
goto main.nop2
|
||||
main.nop2()
|
||||
}
|
||||
|
||||
sub nop2 () {
|
||||
c64.CHROUT('\n')
|
||||
; nop2() ; better error
|
||||
nop2()
|
||||
}
|
||||
}
|
||||
|
||||
foo {
|
||||
|
||||
sub xxx() {
|
||||
|
||||
bar:
|
||||
goto bar
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user