[FIR] Fix calculating offsets of light tree source elements for local declarations
This commit is contained in:
committed by
TeamCityServer
parent
298e27bdac
commit
554fa358e8
+10
@@ -126,6 +126,16 @@ abstract class BaseConverter(
|
||||
return tree.getParent(this)
|
||||
}
|
||||
|
||||
fun LighterASTNode.getParents(): Sequence<LighterASTNode> {
|
||||
var node = this
|
||||
return sequence {
|
||||
while (true) {
|
||||
yield(node)
|
||||
node = node.getParent() ?: break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun LighterASTNode?.getChildNodesByType(type: IElementType): List<LighterASTNode> {
|
||||
return this?.forEachChildrenReturnList { node, container ->
|
||||
when (node.tokenType) {
|
||||
|
||||
+1
-1
@@ -1410,7 +1410,7 @@ class DeclarationsConverter(
|
||||
return if (!stubMode) {
|
||||
val blockTree = LightTree2Fir.buildLightTreeBlockExpression(block.asText)
|
||||
return DeclarationsConverter(
|
||||
baseSession, baseScopeProvider, stubMode, blockTree, offset = tree.getStartOffset(block), context
|
||||
baseSession, baseScopeProvider, stubMode, blockTree, offset = offset + tree.getStartOffset(block), context
|
||||
).convertBlockExpression(blockTree.root)
|
||||
} else {
|
||||
val firExpression = buildExpressionStub()
|
||||
|
||||
Reference in New Issue
Block a user