mirror of
https://github.com/irmen/prog8.git
synced 2025-01-14 01:29:55 +00:00
added error message when not using returnvalue of a functioncall
This commit is contained in:
parent
b40e1eabb9
commit
d7d7147d43
@ -11,6 +11,7 @@ import prog8.compiler.target.C64Target
|
|||||||
import prog8.compiler.target.CompilationTarget
|
import prog8.compiler.target.CompilationTarget
|
||||||
import prog8.compiler.target.Cx16Target
|
import prog8.compiler.target.Cx16Target
|
||||||
import prog8.functions.BuiltinFunctions
|
import prog8.functions.BuiltinFunctions
|
||||||
|
import prog8.functions.builtinFunctionReturnType
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
internal class AstChecker(private val program: Program,
|
internal class AstChecker(private val program: Program,
|
||||||
@ -972,6 +973,11 @@ internal class AstChecker(private val program: Program,
|
|||||||
else
|
else
|
||||||
errors.warn("result values of subroutine call are discarded (use void?)", functionCallStatement.position)
|
errors.warn("result values of subroutine call are discarded (use void?)", functionCallStatement.position)
|
||||||
}
|
}
|
||||||
|
else if(targetStatement is BuiltinFunctionStatementPlaceholder) {
|
||||||
|
val rt = builtinFunctionReturnType(targetStatement.name, functionCallStatement.args, program)
|
||||||
|
if(rt.isKnown)
|
||||||
|
errors.warn("result value of a function call is discarded (use void?)", functionCallStatement.position)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(functionCallStatement.target.nameInSource.last() == "sort") {
|
if(functionCallStatement.target.nameInSource.last() == "sort") {
|
||||||
|
@ -145,9 +145,9 @@ private val functionSignatures: List<FSignature> = listOf(
|
|||||||
FSignature("clear_irqd" , false, emptyList(), null),
|
FSignature("clear_irqd" , false, emptyList(), null),
|
||||||
FSignature("read_flags" , true, emptyList(), DataType.UBYTE),
|
FSignature("read_flags" , true, emptyList(), DataType.UBYTE),
|
||||||
FSignature("progend" , true, emptyList(), DataType.UWORD),
|
FSignature("progend" , true, emptyList(), DataType.UWORD),
|
||||||
|
FSignature("memory" , true, listOf(FParam("name", setOf(DataType.STR)), FParam("size", setOf(DataType.UWORD))), DataType.UWORD),
|
||||||
FSignature("target" , true, emptyList(), DataType.UBYTE, ::builtinTarget),
|
FSignature("target" , true, emptyList(), DataType.UBYTE, ::builtinTarget),
|
||||||
FSignature("swap" , false, listOf(FParam("first", NumericDatatypes), FParam("second", NumericDatatypes)), null),
|
FSignature("swap" , false, listOf(FParam("first", NumericDatatypes), FParam("second", NumericDatatypes)), null),
|
||||||
FSignature("memory" , false, listOf(FParam("name", setOf(DataType.STR)), FParam("size", setOf(DataType.UWORD))), DataType.UWORD),
|
|
||||||
FSignature("memcopy" , false, listOf(
|
FSignature("memcopy" , false, listOf(
|
||||||
FParam("from", IterableDatatypes + DataType.UWORD),
|
FParam("from", IterableDatatypes + DataType.UWORD),
|
||||||
FParam("to", IterableDatatypes + DataType.UWORD),
|
FParam("to", IterableDatatypes + DataType.UWORD),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user