Change order of line number geneartion for function call, and also force

line number generation after visiting inline functions.
This commit is contained in:
Jiaxiang Chen
2019-05-03 17:37:49 -07:00
committed by max-kammerer
parent eeb1c0a0fc
commit 0020e953e1
4 changed files with 4 additions and 5 deletions
@@ -268,7 +268,6 @@ class ExpressionCodegen(
visitStatementContainer(expression, data).coerce(expression.asmType) visitStatementContainer(expression, data).coerce(expression.asmType)
override fun visitFunctionAccess(expression: IrFunctionAccessExpression, data: BlockInfo): PromisedValue { override fun visitFunctionAccess(expression: IrFunctionAccessExpression, data: BlockInfo): PromisedValue {
expression.markLineNumber(startOffset = true)
classCodegen.context.irIntrinsics.getIntrinsic(expression.symbol) classCodegen.context.irIntrinsics.getIntrinsic(expression.symbol)
?.invoke(expression, this, data)?.let { return it.coerce(expression.asmType) } ?.invoke(expression, this, data)?.let { return it.coerce(expression.asmType) }
@@ -353,6 +352,7 @@ class ExpressionCodegen(
} }
} }
expression.markLineNumber(true)
callGenerator.genCall( callGenerator.genCall(
callable, callable,
defaultMask.generateOnStackIfNeeded(callGenerator, callee is IrConstructor, this), defaultMask.generateOnStackIfNeeded(callGenerator, callee is IrConstructor, this),
@@ -1088,7 +1088,9 @@ class ExpressionCodegen(
} }
override fun markLineNumberAfterInlineIfNeeded() { override fun markLineNumberAfterInlineIfNeeded() {
//TODO // Inline function has its own line number which is in a separate instance of codegen,
// therefore we need to reset lastLineNumber to force a line number generation after visiting inline function.
lastLineNumber = -1
} }
fun isFinallyMarkerRequired(): Boolean { fun isFinallyMarkerRequired(): Boolean {
-1
View File
@@ -84,4 +84,3 @@ fun String.fail(): String {
fun call(): String { fun call(): String {
return "xxx" return "xxx"
} }
// IGNORE_BACKEND: JVM_IR
-1
View File
@@ -64,4 +64,3 @@ infix fun String.fail(p: String): String {
fun call(): String { fun call(): String {
return "xxx" return "xxx"
} }
// IGNORE_BACKEND: JVM_IR
@@ -108,4 +108,3 @@ inline fun inlineFun(): String {
fun fail(): String { fun fail(): String {
throw AssertionError("fail") throw AssertionError("fail")
} }
// IGNORE_BACKEND: JVM_IR