Skip to content

Commit

Permalink
Extract variable
Browse files Browse the repository at this point in the history
  • Loading branch information
Lipen committed Feb 27, 2025
1 parent 3579c90 commit 412e4f1
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,13 @@ class TsInterpreter(
when (local) {
// Note: locals have indices starting from (n+1)
is EtsLocal -> {
localVarToIdx.getOrPut(method) {
val map = localVarToIdx.getOrPut(method) {
method.getDeclaredLocals().mapIndexed { idx, local ->
local.name to idx + method.parametersWithThisCount
val localIdx = idx + method.parametersWithThisCount
local.name to localIdx
}.toMap()
}[local.name]
?: error("Local not declared: $local")
}
map[local.name] ?: error("Local not declared: $local")
}

// Note: 'this' has index 'n'
Expand Down

0 comments on commit 412e4f1

Please sign in to comment.