[JS IR] Generate correct source locations in sourcemap for inline declarations

* Keep returnable blocks.
* Add a new lowering which simplifies returnable blocks by introducing
  temporary variable for result and changing returnable block's type to Unit.
* Use information from returnable blocks in codegen to generate
  the right source locations in sourcemap.
* Support in namer (LocalNameGenerator).
* Fix some lowerings to work correctly with returnable blocks.

#KT-46551 In Progress
This commit is contained in:
Zalim Bashorov
2021-07-02 22:08:49 +03:00
committed by teamcityserver
parent 2460f5f9ae
commit d1f5ab4b09
8 changed files with 174 additions and 27 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2010-2018 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Copyright 2010-2021 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.
*/
@@ -19,6 +19,7 @@ import org.jetbrains.kotlin.ir.symbols.IrReturnableBlockSymbol
import org.jetbrains.kotlin.ir.symbols.IrSymbol
import org.jetbrains.kotlin.ir.transformStatement
// TODO migrate other usages and move this file to backend.jvm
/**
* Replaces returnable blocks and `return`'s with loops and `break`'s correspondingly.
*
@@ -149,4 +150,4 @@ class ReturnableBlockTransformer(val context: CommonBackendContext, val containe
}
}
}
}
}