Skip to content

Commit

Permalink
Refactored coercing
Browse files Browse the repository at this point in the history
  • Loading branch information
davidepalladino-apuliasoft committed Dec 9, 2024
1 parent 784d176 commit f57faa4
Showing 1 changed file with 11 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -372,16 +372,6 @@ private fun computeHiValue(type: NumberType): Value {
TODO("Type ${type.rpgType} with ${type.entireDigits} digit is not valid")
}

private fun computeLowValue(type: StringType): Value = StringValue(lowValueString(type))

private fun computeHiValue(type: StringType): Value = StringValue(hiValueString(type))

// TODO
fun lowValueString(type: StringType) = " ".repeat(type.size)

// TODO
fun hiValueString(type: StringType) = "\uFFFF".repeat(type.size)

private fun computeLowValue(type: NumberType): Value {
// Packed and Zone
if (type.rpgType == RpgType.PACKED.rpgType || type.rpgType == RpgType.ZONED.rpgType || type.rpgType.isNullOrBlank()) {
Expand Down Expand Up @@ -413,4 +403,14 @@ private fun computeLowValue(type: NumberType): Value {
return IntValue("-$ed".toLong())
}
TODO("Type '${type.rpgType}' with ${type.entireDigits} digit is not valid")
}
}

private fun computeHiValue(type: StringType): Value = StringValue(hiValueString(type.size))

private fun computeLowValue(type: StringType): Value = StringValue(lowValueString(type.size))

// TODO
private fun hiValueString(size: Int) = "\uFFFF".repeat(size)

// TODO
private fun lowValueString(size: Int) = " ".repeat(size)

0 comments on commit f57faa4

Please sign in to comment.