Implement arrayOf symbols interpretation
This commit is contained in:
+2
-2
@@ -82,7 +82,7 @@ class IrInterpreter(irModule: IrModuleFragment) {
|
||||
|
||||
return when (code) {
|
||||
Code.RETURN -> when (this) {
|
||||
is IrCall -> Code.NEXT
|
||||
is IrCall, is IrReturnableBlock -> Code.NEXT
|
||||
else -> Code.RETURN
|
||||
}
|
||||
Code.BREAK_WHEN -> when (this) {
|
||||
@@ -419,7 +419,7 @@ class IrInterpreter(irModule: IrModuleFragment) {
|
||||
IrTypeOperator.IMPLICIT_COERCION_TO_UNIT -> {
|
||||
expression.argument.interpret(data)
|
||||
}
|
||||
IrTypeOperator.CAST -> {
|
||||
IrTypeOperator.CAST, IrTypeOperator.IMPLICIT_DYNAMIC_CAST -> {
|
||||
expression.argument.interpret(data) //todo check cast correctness
|
||||
}
|
||||
else -> TODO("${expression.operator} not implemented")
|
||||
|
||||
+9
-4
@@ -82,10 +82,15 @@ fun IrFunction.isFakeOverridden(): Boolean {
|
||||
|
||||
fun State.toIrExpression(expression: IrExpression): IrExpression {
|
||||
return when (this) {
|
||||
is Primitive<*> -> this.value.toIrConst( // this is necessary to replace ir offsets
|
||||
this.type, expression.startOffset, expression.endOffset
|
||||
)
|
||||
else -> TODO("not supported")
|
||||
is Primitive<*> ->
|
||||
when (this.value) {
|
||||
// toIrConst call is necessary to replace ir offsets
|
||||
is Boolean, is Char, is Byte, is Short, is Int, is Long, is String, is Float, is Double ->
|
||||
this.value.toIrConst(this.type, expression.startOffset, expression.endOffset)
|
||||
null -> this.value.toIrConst(this.type, expression.startOffset, expression.endOffset)
|
||||
else -> expression // TODO support for arrays
|
||||
}
|
||||
else -> expression // TODO support
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user