Fix minor compile warnings
This commit is contained in:
-2
@@ -176,8 +176,6 @@ internal class FunctionInlining(val context: Context): IrElementTransformerVoidW
|
||||
}
|
||||
}
|
||||
|
||||
val sourceFile = callee.file
|
||||
|
||||
val transformer = ParameterSubstitutor()
|
||||
statements.transform { it.transform(transformer, data = null) }
|
||||
statements.addAll(0, evaluationStatements)
|
||||
|
||||
+2
-2
@@ -12,8 +12,8 @@ import org.jetbrains.kotlin.js.backend.ast.JsDeclarationScope
|
||||
import org.jetbrains.kotlin.js.backend.ast.JsStatement
|
||||
|
||||
class IrFileToJsTransformer : BaseIrElementToJsNodeTransformer<JsStatement, JsGenerationContext> {
|
||||
override fun visitFile(declaration: IrFile, context: JsGenerationContext): JsStatement {
|
||||
val fileContext = context.newDeclaration(JsDeclarationScope(context.currentScope, "scope for file ${declaration.path}"))
|
||||
override fun visitFile(declaration: IrFile, data: JsGenerationContext): JsStatement {
|
||||
val fileContext = data.newDeclaration(JsDeclarationScope(data.currentScope, "scope for file ${declaration.path}"))
|
||||
val block = fileContext.currentBlock
|
||||
|
||||
declaration.declarations.forEach {
|
||||
|
||||
+8
-8
@@ -10,7 +10,9 @@ import org.jetbrains.kotlin.backend.common.ir.isElseBranch
|
||||
import org.jetbrains.kotlin.ir.backend.js.utils.JsGenerationContext
|
||||
import org.jetbrains.kotlin.ir.backend.js.utils.Namer
|
||||
import org.jetbrains.kotlin.ir.declarations.IrFunction
|
||||
import org.jetbrains.kotlin.ir.expressions.*
|
||||
import org.jetbrains.kotlin.ir.expressions.IrExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrMemberAccessExpression
|
||||
import org.jetbrains.kotlin.ir.expressions.IrWhen
|
||||
import org.jetbrains.kotlin.js.backend.ast.*
|
||||
|
||||
fun jsVar(name: JsName, initializer: IrExpression?, context: JsGenerationContext): JsVars {
|
||||
@@ -18,12 +20,12 @@ fun jsVar(name: JsName, initializer: IrExpression?, context: JsGenerationContext
|
||||
return JsVars(JsVars.JsVar(name, jsInitializer))
|
||||
}
|
||||
|
||||
fun <T : JsNode, D : JsGenerationContext> IrWhen.toJsNode(
|
||||
tr: BaseIrElementToJsNodeTransformer<T, D>,
|
||||
data: D,
|
||||
fun <T : JsNode> IrWhen.toJsNode(
|
||||
tr: BaseIrElementToJsNodeTransformer<T, JsGenerationContext>,
|
||||
data: JsGenerationContext,
|
||||
node: (JsExpression, T, T?) -> T
|
||||
): T? =
|
||||
branches.foldRight<IrBranch, T?>(null) { br, n ->
|
||||
branches.foldRight(null) { br, n ->
|
||||
val body = br.result.accept(tr, data)
|
||||
if (isElseBranch(br)) body
|
||||
else {
|
||||
@@ -118,9 +120,7 @@ object JsAstUtils {
|
||||
thenStatement: JsStatement,
|
||||
elseStatement: JsStatement? = null
|
||||
): JsIf {
|
||||
var elseStatement = elseStatement
|
||||
elseStatement = if (elseStatement != null) deBlockIfPossible(elseStatement) else null
|
||||
return JsIf(ifExpression, deBlockIfPossible(thenStatement), elseStatement)
|
||||
return JsIf(ifExpression, deBlockIfPossible(thenStatement), elseStatement?.let { deBlockIfPossible(it) })
|
||||
}
|
||||
|
||||
fun and(op1: JsExpression, op2: JsExpression): JsBinaryOperation {
|
||||
|
||||
@@ -21,6 +21,7 @@ object JsAnnotations {
|
||||
val jsQualifierFqn = FqName("kotlin.js.JsQualifier")
|
||||
}
|
||||
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
private fun IrCall.getSingleConstStringArgument() =
|
||||
(getValueArgument(0) as IrConst<String>).value
|
||||
|
||||
|
||||
Reference in New Issue
Block a user