[IR] Add an ability to change dump strategy using a system property
This commit is contained in:
+5
-1
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
|
||||||
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@@ -12,6 +12,7 @@ import org.jetbrains.kotlin.backend.common.IrValidatorConfig
|
|||||||
import org.jetbrains.kotlin.ir.IrElement
|
import org.jetbrains.kotlin.ir.IrElement
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.util.dump
|
import org.jetbrains.kotlin.ir.util.dump
|
||||||
|
import org.jetbrains.kotlin.ir.util.dumpKotlinLike
|
||||||
import org.jetbrains.kotlin.ir.util.fqNameWhenAvailable
|
import org.jetbrains.kotlin.ir.util.fqNameWhenAvailable
|
||||||
import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid
|
import org.jetbrains.kotlin.ir.visitors.IrElementVisitorVoid
|
||||||
import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid
|
import org.jetbrains.kotlin.ir.visitors.acceptChildrenVoid
|
||||||
@@ -62,6 +63,9 @@ fun dumpIrElement(actionState: ActionState, data: IrElement, @Suppress("UNUSED_P
|
|||||||
var dumpText: String = ""
|
var dumpText: String = ""
|
||||||
val elementName: String
|
val elementName: String
|
||||||
|
|
||||||
|
val dumpStrategy = System.getProperty("org.jetbrains.kotlin.compiler.ir.dump.strategy")
|
||||||
|
val dump: IrElement.() -> String = if (dumpStrategy == "KotlinLike") IrElement::dumpKotlinLike else IrElement::dump
|
||||||
|
|
||||||
val dumpOnlyFqName = actionState.config.dumpOnlyFqName
|
val dumpOnlyFqName = actionState.config.dumpOnlyFqName
|
||||||
if (dumpOnlyFqName != null) {
|
if (dumpOnlyFqName != null) {
|
||||||
elementName = dumpOnlyFqName
|
elementName = dumpOnlyFqName
|
||||||
|
|||||||
Reference in New Issue
Block a user