Skip to content

Commit

Permalink
Fixed Go tests
Browse files Browse the repository at this point in the history
  • Loading branch information
oxisto committed Nov 29, 2024
1 parent 00e0a24 commit 1ce6e0c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@ class ScopeManager : ScopeProvider {
val currentFunction: FunctionDeclaration?
get() = this.firstScopeIsInstanceOrNull<FunctionScope>()?.astNode as? FunctionDeclaration

/** The current block, according to the scope that is currently active. */
val currentBlock: Block?
get() =
currentScope?.astNode as? Block
?: currentScope?.astNode?.firstParentOrNull { it is Block } as? Block

/**
* The current method in the active scope tree, this ensures that 'this' keywords are mapped
* correctly if a method contains a lambda or other types of function declarations
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class StatementHandler(frontend: GoLanguageFrontend) :
}

// We need to find the current block / scope and add the statements to it
val currentBlock = case.firstParentOrNull { it is Block } as? Block
val currentBlock = frontend.scopeManager.currentBlock

if (currentBlock == null) {
log.error("could not find block to add case clauses")
Expand Down

0 comments on commit 1ce6e0c

Please sign in to comment.