mirror of
https://github.com/irmen/prog8.git
synced 2025-02-13 18:31:04 +00:00
better error message
This commit is contained in:
parent
f071c07dd9
commit
35d9412559
@ -619,13 +619,13 @@ internal class AstChecker(private val program: Program,
|
||||
super.visit(assignment)
|
||||
}
|
||||
|
||||
private fun numberOfReturnValuesError(actual: Int, expectedTypes: List<DataType>, position: Position) {
|
||||
if(actual<expectedTypes.size) {
|
||||
val missing = expectedTypes.drop(actual).joinToString(", ")
|
||||
errors.err("some return values are not assigned: expected ${expectedTypes.size} got $actual, missing assignments for: $missing", position)
|
||||
private fun numberOfReturnValuesError(numAssigns: Int, providedTypes: List<DataType>, position: Position) {
|
||||
if(numAssigns<providedTypes.size) {
|
||||
val missing = providedTypes.drop(numAssigns).joinToString(", ")
|
||||
errors.err("call returns too many values: expected $numAssigns got ${providedTypes.size}, missing assignments for: $missing", position)
|
||||
}
|
||||
else
|
||||
errors.err("too many return values are assigned: expected ${expectedTypes.size} got $actual", position)
|
||||
errors.err("call returns too few values: expected $numAssigns got ${providedTypes.size}", position)
|
||||
}
|
||||
|
||||
private fun checkMultiAssignment(assignment: Assignment, fcall: IFunctionCall?, fcallTarget: Subroutine?) {
|
||||
|
@ -4,10 +4,13 @@
|
||||
|
||||
main {
|
||||
sub start() {
|
||||
uword[10] @align64 @nosplit array1
|
||||
uword[10] @align64 @split array2
|
||||
cx16.r0L, cx16.r1, cx16.r2 = multiasm()
|
||||
cx16.r0L = multiasm()
|
||||
}
|
||||
|
||||
array1[2]++
|
||||
array2[2]++
|
||||
asmsub multiasm() -> ubyte @A, uword @R1 {
|
||||
%asm {{
|
||||
rts
|
||||
}}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user