removed sum(), max(), min(). abs() now always returns uword type.

This greatly simplifies internal handling of builtin functions by always having one fixed return type.
This commit is contained in:
Irmen de Jong
2022-04-13 23:23:59 +02:00
parent 349e5a15e9
commit 220246278a
22 changed files with 118 additions and 891 deletions

View File

@@ -267,6 +267,8 @@ class ExpressionSimplifier(private val program: Program, private val errors: IEr
override fun after(functionCallExpr: FunctionCallExpression, parent: Node): Iterable<IAstModification> {
if(functionCallExpr.target.nameInSource == listOf("lsb")) {
if(functionCallExpr.args.isEmpty())
return noModifications
val arg = functionCallExpr.args[0]
if(arg is TypecastExpression) {
val valueDt = arg.expression.inferType(program)
@@ -283,6 +285,8 @@ class ExpressionSimplifier(private val program: Program, private val errors: IEr
}
}
else if(functionCallExpr.target.nameInSource == listOf("msb")) {
if(functionCallExpr.args.isEmpty())
return noModifications
val arg = functionCallExpr.args[0]
if(arg is TypecastExpression) {
val valueDt = arg.expression.inferType(program)