Skip to content

Commit

Permalink
Computate invocation range lazily
Browse files Browse the repository at this point in the history
Co-authored-by: Bastian Müller <[email protected]>
  • Loading branch information
darkdrag00nv2 and turbolent committed Dec 8, 2023
1 parent bc8b2ca commit 437ea4b
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions runtime/sema/check_invocation_expression.go
Original file line number Diff line number Diff line change
Expand Up @@ -459,10 +459,19 @@ func (checker *Checker) checkInvocation(
}
}

invocationRange := ast.NewRangeFromPositioned(
checker.memoryGauge,
invocationExpression,
)
// Compute the invocation range, once, if needed
getInvocationRange := func() func() ast.Range {
var invcocationRange ast.Range
return func() ast.Range {
if invocationRange == ast.EmptyRange {
invocationRange = ast.NewRangeFromPositioned(
checker.memoryGauge,
invocationExpression,
)
}
return invocationRange
}
}()

// The invokable type might have special checks for the arguments

Expand Down

0 comments on commit 437ea4b

Please sign in to comment.