mirror of
https://github.com/irmen/prog8.git
synced 2024-09-07 19:54:26 +00:00
update to kotlin 2.0, fix several code style issues
This commit is contained in:
parent
ae0d52274c
commit
c9a4235669
@ -1,23 +1,23 @@
|
||||
<component name="libraryTable">
|
||||
<library name="KotlinJavaRuntime" type="repository">
|
||||
<properties maven-id="org.jetbrains.kotlin:kotlin-stdlib-jdk8:1.9.24" />
|
||||
<properties maven-id="org.jetbrains.kotlin:kotlin-stdlib-jdk8:2.0.0" />
|
||||
<CLASSES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.9.24/kotlin-stdlib-jdk8-1.9.24.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.9.24/kotlin-stdlib-1.9.24.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/2.0.0/kotlin-stdlib-jdk8-2.0.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/2.0.0/kotlin-stdlib-2.0.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.9.24/kotlin-stdlib-jdk7-1.9.24.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/2.0.0/kotlin-stdlib-jdk7-2.0.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.9.24/kotlin-stdlib-jdk8-1.9.24-javadoc.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.9.24/kotlin-stdlib-1.9.24-javadoc.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/2.0.0/kotlin-stdlib-jdk8-2.0.0-javadoc.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/2.0.0/kotlin-stdlib-2.0.0-javadoc.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0-javadoc.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.9.24/kotlin-stdlib-jdk7-1.9.24-javadoc.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/2.0.0/kotlin-stdlib-jdk7-2.0.0-javadoc.jar!/" />
|
||||
</JAVADOC>
|
||||
<SOURCES>
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/1.9.24/kotlin-stdlib-jdk8-1.9.24-sources.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/1.9.24/kotlin-stdlib-1.9.24-sources.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk8/2.0.0/kotlin-stdlib-jdk8-2.0.0-sources.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib/2.0.0/kotlin-stdlib-2.0.0-sources.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/annotations/13.0/annotations-13.0-sources.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/1.9.24/kotlin-stdlib-jdk7-1.9.24-sources.jar!/" />
|
||||
<root url="jar://$MAVEN_REPOSITORY$/org/jetbrains/kotlin/kotlin-stdlib-jdk7/2.0.0/kotlin-stdlib-jdk7-2.0.0-sources.jar!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
@ -267,12 +267,12 @@ class PtNumber(type: DataType, val number: Double, position: Position) : PtExpre
|
||||
override fun hashCode(): Int = Objects.hash(type, number)
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if(other==null || other !is PtNumber)
|
||||
return false
|
||||
return if(other==null || other !is PtNumber)
|
||||
false
|
||||
else if(type!=DataType.BOOL && other.type!=DataType.BOOL)
|
||||
return number==other.number
|
||||
number==other.number
|
||||
else
|
||||
return type==other.type && number==other.number
|
||||
type==other.type && number==other.number
|
||||
}
|
||||
|
||||
operator fun compareTo(other: PtNumber): Int = number.compareTo(other.number)
|
||||
|
@ -405,14 +405,14 @@ internal class IfElseAsmGen(private val program: PtProgram,
|
||||
val condition = stmt.condition as PtBinaryExpression
|
||||
if(signed) {
|
||||
// X>Y --> Y<X
|
||||
asmgen.assignExpressionToRegister(condition.right, RegisterOrPair.A, signed)
|
||||
asmgen.assignExpressionToRegister(condition.right, RegisterOrPair.A, true)
|
||||
cmpAwithByteValue(condition.left, true)
|
||||
if (jumpAfterIf != null)
|
||||
translateJumpElseBodies("bmi", "bpl", jumpAfterIf, stmt.elseScope)
|
||||
else
|
||||
translateIfElseBodies("bpl", stmt)
|
||||
} else {
|
||||
asmgen.assignExpressionToRegister(condition.left, RegisterOrPair.A, signed)
|
||||
asmgen.assignExpressionToRegister(condition.left, RegisterOrPair.A, false)
|
||||
cmpAwithByteValue(condition.right, false)
|
||||
if(jumpAfterIf!=null) {
|
||||
val (asmLabel, indirect) = asmgen.getJumpTarget(jumpAfterIf)
|
||||
@ -848,10 +848,10 @@ _jump jmp ($asmLabel)
|
||||
}
|
||||
} else {
|
||||
asmgen.loadScaledArrayIndexIntoRegister(value, CpuRegister.Y)
|
||||
if(value.splitWords) {
|
||||
return compareLsbMsb("${varname}_lsb,y", "${varname}_msb,y")
|
||||
return if(value.splitWords) {
|
||||
compareLsbMsb("${varname}_lsb,y", "${varname}_msb,y")
|
||||
} else {
|
||||
return compareLsbMsb("$varname,y", "$varname+1,y")
|
||||
compareLsbMsb("$varname,y", "$varname+1,y")
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -985,10 +985,10 @@ _jump jmp ($asmLabel)
|
||||
}
|
||||
} else {
|
||||
asmgen.loadScaledArrayIndexIntoRegister(value, CpuRegister.Y)
|
||||
if(value.splitWords) {
|
||||
return compareLsbMsb("${varname}_lsb,y", "${varname}_msb,y")
|
||||
return if(value.splitWords) {
|
||||
compareLsbMsb("${varname}_lsb,y", "${varname}_msb,y")
|
||||
} else {
|
||||
return compareLsbMsb("$varname,y", "$varname+1,y")
|
||||
compareLsbMsb("$varname,y", "$varname+1,y")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1390,9 +1390,9 @@ internal class AssignmentGen(private val codeGen: IRCodeGen, private val express
|
||||
val valueReg = codeGen.registers.nextFree()
|
||||
result += IRCodeChunk(null, null).also {
|
||||
it += IRInstruction(Opcode.LOADM, vmDt, reg1=valueReg, labelSymbol = array.variable.name, symbolOffset = constIndex*eltSize)
|
||||
when(comparisonOperator) {
|
||||
"==" -> it += IRInstruction(Opcode.SZ, vmDt, reg1=cmpResultReg, reg2=valueReg)
|
||||
"!=" -> it += IRInstruction(Opcode.SNZ, vmDt, reg1=cmpResultReg, reg2=valueReg)
|
||||
it += when(comparisonOperator) {
|
||||
"==" -> IRInstruction(Opcode.SZ, vmDt, reg1=cmpResultReg, reg2=valueReg)
|
||||
"!=" -> IRInstruction(Opcode.SNZ, vmDt, reg1=cmpResultReg, reg2=valueReg)
|
||||
"<" -> return null // TODO("array <0 inplace")) // TODO?
|
||||
"<=" -> return null // TODO("array <=0 inplace")) // TODO?
|
||||
">" -> return null // TODO("array >0 inplace")) // TODO?
|
||||
@ -1413,9 +1413,9 @@ internal class AssignmentGen(private val codeGen: IRCodeGen, private val express
|
||||
addToResult(result, indexTr, indexTr.resultReg, -1)
|
||||
result += IRCodeChunk(null, null).also {
|
||||
it += IRInstruction(Opcode.LOADX, vmDt, reg1=valueReg, reg2=indexTr.resultReg, labelSymbol = array.variable.name)
|
||||
when(comparisonOperator) {
|
||||
"==" -> it += IRInstruction(Opcode.SZ, vmDt, reg1=cmpResultReg, reg2=valueReg)
|
||||
"!=" -> it += IRInstruction(Opcode.SNZ, vmDt, reg1=cmpResultReg, reg2=valueReg)
|
||||
it += when(comparisonOperator) {
|
||||
"==" -> IRInstruction(Opcode.SZ, vmDt, reg1=cmpResultReg, reg2=valueReg)
|
||||
"!=" -> IRInstruction(Opcode.SNZ, vmDt, reg1=cmpResultReg, reg2=valueReg)
|
||||
"<" -> return null // TODO("array <0 inplace")) // TODO?
|
||||
"<=" -> return null // TODO("array <=0 inplace")) // TODO?
|
||||
">" -> return null // TODO("array >0 inplace")) // TODO?
|
||||
|
@ -132,10 +132,10 @@ internal class BuiltinFuncGen(private val codeGen: IRCodeGen, private val exprGe
|
||||
val addressTr = exprGen.translateExpression(call.args[0])
|
||||
addToResult(result, addressTr, addressTr.resultReg, -1)
|
||||
addInstr(result, IRInstruction(Opcode.CALLI, reg1 = addressTr.resultReg), null)
|
||||
if(call.void)
|
||||
return ExpressionCodeResult(result, IRDataType.BYTE, -1, -1)
|
||||
return if(call.void)
|
||||
ExpressionCodeResult(result, IRDataType.BYTE, -1, -1)
|
||||
else
|
||||
return ExpressionCodeResult(result, IRDataType.WORD, codeGen.registers.nextFree(), -1) // TODO actually the result is returned in CPU registers AY...
|
||||
ExpressionCodeResult(result, IRDataType.WORD, codeGen.registers.nextFree(), -1) // TODO actually the result is returned in CPU registers AY...
|
||||
}
|
||||
|
||||
private fun funcCallfar(call: PtBuiltinFunctionCall): ExpressionCodeResult {
|
||||
|
@ -391,10 +391,10 @@ class IRCodeGen(
|
||||
val result = mutableListOf<IRCodeChunkBase>()
|
||||
when(iterable) {
|
||||
is PtRange -> {
|
||||
if(iterable.from is PtNumber && iterable.to is PtNumber)
|
||||
result += translateForInConstantRange(forLoop, loopvar)
|
||||
result += if(iterable.from is PtNumber && iterable.to is PtNumber)
|
||||
translateForInConstantRange(forLoop, loopvar)
|
||||
else
|
||||
result += translateForInNonConstantRange(forLoop, loopvar)
|
||||
translateForInNonConstantRange(forLoop, loopvar)
|
||||
}
|
||||
is PtIdentifier -> {
|
||||
require(forLoop.variable.name == loopvar.scopedName)
|
||||
@ -791,6 +791,7 @@ class IRCodeGen(
|
||||
}
|
||||
else if(pow2>=1 &&!signed) {
|
||||
// just shift multiple bits
|
||||
// TODO also try to optimize for signed division by powers of 2
|
||||
val pow2reg = registers.nextFree()
|
||||
code += IRInstruction(Opcode.LOAD, dt, reg1=pow2reg, immediate = pow2)
|
||||
code += if(signed)
|
||||
@ -1503,17 +1504,16 @@ class IRCodeGen(
|
||||
private fun translate(jump: PtJump): IRCodeChunks {
|
||||
val result = mutableListOf<IRCodeChunkBase>()
|
||||
val chunk = IRCodeChunk(null, null)
|
||||
if(jump.address!=null) {
|
||||
chunk += IRInstruction(Opcode.JUMP, address = jump.address!!.toInt())
|
||||
chunk += if(jump.address!=null) {
|
||||
IRInstruction(Opcode.JUMP, address = jump.address!!.toInt())
|
||||
} else {
|
||||
if (jump.identifier != null) {
|
||||
if(isIndirectJump(jump)) {
|
||||
chunk += IRInstruction(Opcode.JUMPI, labelSymbol = jump.identifier!!.name)
|
||||
IRInstruction(Opcode.JUMPI, labelSymbol = jump.identifier!!.name)
|
||||
} else {
|
||||
chunk += IRInstruction(Opcode.JUMP, labelSymbol = jump.identifier!!.name)
|
||||
IRInstruction(Opcode.JUMP, labelSymbol = jump.identifier!!.name)
|
||||
}
|
||||
}
|
||||
else
|
||||
} else
|
||||
throw AssemblyError("weird jump")
|
||||
}
|
||||
result += chunk
|
||||
|
@ -154,11 +154,10 @@ class VarConstantValueTypeAdjuster(
|
||||
if(func==listOf("clamp")) {
|
||||
val t1 = functionCallExpr.args[0].inferType(program)
|
||||
if(t1.isKnown) {
|
||||
val replaceFunc: String
|
||||
if(t1.isBytes) {
|
||||
replaceFunc = if(t1.istype(DataType.BYTE)) "clamp__byte" else "clamp__ubyte"
|
||||
val replaceFunc = if(t1.isBytes) {
|
||||
if(t1.istype(DataType.BYTE)) "clamp__byte" else "clamp__ubyte"
|
||||
} else if(t1.isInteger) {
|
||||
replaceFunc = if(t1.istype(DataType.WORD)) "clamp__word" else "clamp__uword"
|
||||
if(t1.istype(DataType.WORD)) "clamp__word" else "clamp__uword"
|
||||
} else {
|
||||
errors.err("clamp builtin not supported for floats, use floats.clamp", functionCallExpr.position)
|
||||
return noModifications
|
||||
|
@ -102,10 +102,14 @@ private fun compileMain(args: Array<String>): Boolean {
|
||||
}
|
||||
}
|
||||
|
||||
if(bytes2float!=null)
|
||||
return convertBytesToFloat(bytes2float!!, compilationTarget!!)
|
||||
if(float2bytes!=null)
|
||||
return convertFloatToBytes(float2bytes!!, compilationTarget!!)
|
||||
if(bytes2float!=null) {
|
||||
convertBytesToFloat(bytes2float!!, compilationTarget!!)
|
||||
return true
|
||||
}
|
||||
if(float2bytes!=null) {
|
||||
convertFloatToBytes(float2bytes!!, compilationTarget!!)
|
||||
return true
|
||||
}
|
||||
|
||||
if(varsHighBank==0 && compilationTarget==Cx16Target.NAME) {
|
||||
System.err.println("On the Commander X16, HiRAM bank 0 is used by the kernal and can't be used.")
|
||||
@ -139,7 +143,8 @@ private fun compileMain(args: Array<String>): Boolean {
|
||||
}
|
||||
|
||||
if(startVm==true) {
|
||||
return runVm(moduleFiles.first())
|
||||
runVm(moduleFiles.first())
|
||||
return true
|
||||
}
|
||||
|
||||
val processedSymbols = processSymbolDefs(symbolDefs) ?: return false
|
||||
@ -297,21 +302,19 @@ private fun compileMain(args: Array<String>): Boolean {
|
||||
return true
|
||||
}
|
||||
|
||||
fun convertFloatToBytes(number: String, target: String): Boolean {
|
||||
fun convertFloatToBytes(number: String, target: String) {
|
||||
val tgt = getCompilationTargetByName(target)
|
||||
val dbl = number.toDouble()
|
||||
val bytes = tgt.machine.convertFloatToBytes(dbl)
|
||||
print("$dbl in bytes on '$target': ")
|
||||
println(bytes.joinToString(","))
|
||||
return true
|
||||
}
|
||||
|
||||
fun convertBytesToFloat(bytelist: String, target: String): Boolean {
|
||||
fun convertBytesToFloat(bytelist: String, target: String) {
|
||||
val tgt = getCompilationTargetByName(target)
|
||||
val bytes = bytelist.split(',').map { it.trim().toUByte() }
|
||||
val number = tgt.machine.convertBytesToFloat(bytes)
|
||||
println("floating point value on '$target': $number")
|
||||
return true
|
||||
}
|
||||
|
||||
private fun processSymbolDefs(symbolDefs: List<String>): Map<String, String>? {
|
||||
@ -329,9 +332,8 @@ private fun processSymbolDefs(symbolDefs: List<String>): Map<String, String>? {
|
||||
return result
|
||||
}
|
||||
|
||||
fun runVm(irFilename: String): Boolean {
|
||||
fun runVm(irFilename: String) {
|
||||
val irFile = Path(irFilename)
|
||||
val vmdef = VirtualMachineDefinition()
|
||||
vmdef.launchEmulator(0, irFile)
|
||||
return true
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ main {
|
||||
}
|
||||
|
||||
test("ubyte to word casts") {
|
||||
var src="""
|
||||
val src="""
|
||||
main {
|
||||
sub start() {
|
||||
ubyte @shared bb = 255
|
||||
|
@ -35,7 +35,7 @@ class TestProg8Parser: FunSpec( {
|
||||
context("Newline at end") {
|
||||
test("is not required - #40, fixed by #45") {
|
||||
val nl = "\n" // say, Unix-style (different flavours tested elsewhere)
|
||||
val src = SourceCode.Text("foo {" + nl + "}") // source ends with '}' (= NO newline, issue #40)
|
||||
val src = SourceCode.Text("foo {$nl}") // source ends with '}' (= NO newline, issue #40)
|
||||
|
||||
// #40: Prog8ANTLRParser would report (throw) "missing <EOL> at '<EOF>'"
|
||||
val module = parseModule(src)
|
||||
@ -44,7 +44,7 @@ class TestProg8Parser: FunSpec( {
|
||||
|
||||
test("is still accepted - #40, fixed by #45") {
|
||||
val nl = "\n" // say, Unix-style (different flavours tested elsewhere)
|
||||
val srcText = "foo {" + nl + "}" + nl // source does end with a newline (issue #40)
|
||||
val srcText = "foo {$nl}$nl" // source does end with a newline (issue #40)
|
||||
val module = parseModule(SourceCode.Text(srcText))
|
||||
module.statements.size shouldBe 1
|
||||
}
|
||||
@ -55,10 +55,10 @@ class TestProg8Parser: FunSpec( {
|
||||
val nl = "\n" // say, Unix-style (different flavours tested elsewhere)
|
||||
|
||||
// BAD: 2nd block `bar` does NOT start on new line; however, there's is a nl at the very end
|
||||
val srcBad = "foo {" + nl + "}" + " bar {" + nl + "}" + nl
|
||||
val srcBad = "foo {$nl} bar {$nl}$nl"
|
||||
|
||||
// GOOD: 2nd block `bar` does start on a new line; however, a nl at the very end ain't needed
|
||||
val srcGood = "foo {" + nl + "}" + nl + "bar {" + nl + "}"
|
||||
val srcGood = "foo {$nl}${nl}bar {$nl}"
|
||||
|
||||
shouldThrow<ParseError> { parseModule(SourceCode.Text(srcBad)) }
|
||||
val module = parseModule(SourceCode.Text(srcGood))
|
||||
|
@ -67,9 +67,10 @@ main {
|
||||
}"""
|
||||
val result = compileText(C64Target(), false, text, writeAssembly = true)!!
|
||||
result.compilerAst.name shouldStartWith "on_the_fly"
|
||||
result.codegenAst!!.name shouldBe result.compilerAst.name
|
||||
result.codegenAst!!.children.size shouldBeGreaterThan 2
|
||||
val start = result.codegenAst!!.entrypoint()!!
|
||||
val ast = result.codegenAst!!
|
||||
ast.name shouldBe result.compilerAst.name
|
||||
ast.children.size shouldBeGreaterThan 2
|
||||
val start = ast.entrypoint()!!
|
||||
start.name shouldBe "p8s_start"
|
||||
start.children.size shouldBeGreaterThan 2
|
||||
val seed = start.children[0] as PtVariable
|
||||
|
@ -316,12 +316,12 @@ class AstToSourceTextConverter(val output: (text: String) -> Unit, val program:
|
||||
}
|
||||
|
||||
override fun visit(array: ArrayLiteral) {
|
||||
outputListMembers(array.value.asSequence(), '[', ']')
|
||||
outputListMembers(array.value.asSequence())
|
||||
}
|
||||
|
||||
private fun outputListMembers(array: Sequence<Expression>, openchar: Char, closechar: Char) {
|
||||
private fun outputListMembers(array: Sequence<Expression>) {
|
||||
var counter = 0
|
||||
output(openchar.toString())
|
||||
output("[")
|
||||
scopelevel++
|
||||
for (v in array) {
|
||||
v.accept(this)
|
||||
@ -335,7 +335,7 @@ class AstToSourceTextConverter(val output: (text: String) -> Unit, val program:
|
||||
}
|
||||
}
|
||||
scopelevel--
|
||||
output(closechar.toString())
|
||||
output("]")
|
||||
}
|
||||
|
||||
override fun visit(assignment: Assignment) {
|
||||
|
@ -364,10 +364,10 @@ private fun AssignmentContext.toAst(): Statement {
|
||||
}
|
||||
|
||||
val nestedAssign = assignment()
|
||||
if(nestedAssign==null)
|
||||
return Assignment(assign_target().toAst(), expression().toAst(), AssignmentOrigin.USERCODE, toPosition())
|
||||
return if(nestedAssign==null)
|
||||
Assignment(assign_target().toAst(), expression().toAst(), AssignmentOrigin.USERCODE, toPosition())
|
||||
else
|
||||
return ChainedAssignment(assign_target().toAst(), nestedAssign.toAst(), toPosition())
|
||||
ChainedAssignment(assign_target().toAst(), nestedAssign.toAst(), toPosition())
|
||||
}
|
||||
|
||||
private fun AugassignmentContext.toAst(): Assignment {
|
||||
|
@ -563,12 +563,12 @@ class NumericLiteral(val type: DataType, // only numerical types allowed
|
||||
override fun hashCode(): Int = Objects.hash(type, number)
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if(other==null || other !is NumericLiteral)
|
||||
return false
|
||||
return if(other==null || other !is NumericLiteral)
|
||||
false
|
||||
else if(type!=DataType.BOOL && other.type!=DataType.BOOL)
|
||||
return number==other.number
|
||||
number==other.number
|
||||
else
|
||||
return type==other.type && number==other.number
|
||||
type==other.type && number==other.number
|
||||
}
|
||||
|
||||
operator fun compareTo(other: NumericLiteral): Int = number.compareTo(other.number)
|
||||
|
@ -5,7 +5,7 @@ https://github.com/irmen/prog8/issues/136 (string.find register order issue)
|
||||
|
||||
optimize signed byte/word division by powers of 2, it's now using divmod routine. (also % ?)
|
||||
see inplacemodificationByteVariableWithLiteralval() and inplacemodificationSomeWordWithLiteralval()
|
||||
|
||||
and for IR: see divideByConst() in IRCodeGen
|
||||
|
||||
|
||||
Future Things and Ideas
|
||||
|
@ -4,5 +4,5 @@ org.gradle.parallel=true
|
||||
org.gradle.daemon=true
|
||||
kotlin.code.style=official
|
||||
javaVersion=11
|
||||
kotlinVersion=1.9.24
|
||||
version=10.3.1
|
||||
kotlinVersion=2.0.0
|
||||
version=10.4-SNAPSHOT
|
||||
|
@ -227,10 +227,10 @@ class IRStStaticVariable(name: String,
|
||||
class IRStArrayElement(val number: Double?, val addressOfSymbol: String?) {
|
||||
companion object {
|
||||
fun from(elt: StArrayElement): IRStArrayElement {
|
||||
if(elt.boolean!=null)
|
||||
return IRStArrayElement(if(elt.boolean==true) 1.0 else 0.0, elt.addressOfSymbol)
|
||||
return if(elt.boolean!=null)
|
||||
IRStArrayElement(if(elt.boolean==true) 1.0 else 0.0, elt.addressOfSymbol)
|
||||
else
|
||||
return IRStArrayElement(elt.number, elt.addressOfSymbol)
|
||||
IRStArrayElement(elt.number, elt.addressOfSymbol)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user