Skip to content

Commit

Permalink
[IR] KotlinLikeDumper: better support for enum and object accesses
Browse files Browse the repository at this point in the history
  • Loading branch information
bashor authored and teamcityserver committed Nov 25, 2020
1 parent 635cb44 commit 1fd12b7
Showing 1 changed file with 10 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1068,9 +1068,16 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption
spread.expression.accept(this, data)
}

override fun visitDeclarationReference(expression: IrDeclarationReference, data: IrDeclaration?) {
// TODO support
super.visitDeclarationReference(expression, data)
override fun visitGetObjectValue(expression: IrGetObjectValue, data: IrDeclaration?) {
// TODO what if symbol is unbound?
expression.symbol.defaultType.printTypeWithNoIndent()
}

override fun visitGetEnumValue(expression: IrGetEnumValue, data: IrDeclaration?) {
val enumEntry = expression.symbol.owner
p.printWithNoIndent(enumEntry.parentAsClass.name.asString())
p.printWithNoIndent(".")
p.printWithNoIndent(enumEntry.name.asString())
}

override fun visitRawFunctionReference(expression: IrRawFunctionReference, data: IrDeclaration?) {
Expand All @@ -1080,11 +1087,6 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption
super.visitRawFunctionReference(expression, data)
}

override fun visitSingletonReference(expression: IrGetSingletonValue, data: IrDeclaration?) {
// TODO check
expression.type.printTypeWithNoIndent()
}

override fun visitGetValue(expression: IrGetValue, data: IrDeclaration?) {
p.printWithNoIndent(expression.symbol.owner.name.asString())
}
Expand Down Expand Up @@ -1313,16 +1315,6 @@ private class KotlinLikeDumper(val p: Printer, val options: KotlinLikeDumpOption
super.visitSuspensionPoint(expression, data)
}

override fun visitGetObjectValue(expression: IrGetObjectValue, data: IrDeclaration?) {
// ???
super.visitGetObjectValue(expression, data)
}

override fun visitGetEnumValue(expression: IrGetEnumValue, data: IrDeclaration?) {
// ???
super.visitGetEnumValue(expression, data)
}

override fun visitFunctionReference(expression: IrFunctionReference, data: IrDeclaration?) {
super.visitFunctionReference(expression, data)
}
Expand Down

0 comments on commit 1fd12b7

Please sign in to comment.