Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Compiler] Support accessing result variable inside post conditions #3741

Merged
merged 9 commits into from
Feb 5, 2025
Prev Previous commit
Always get a copy of native functions
  • Loading branch information
SupunS committed Feb 5, 2025
commit eb4118b5b4fac206b1d1716fd05d841d961235a1
11 changes: 9 additions & 2 deletions bbq/compiler/native_functions.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,15 @@ var nativeFunctions []*global

func NativeFunctions() map[string]*global {
funcs := make(map[string]*global, len(nativeFunctions))
for _, value := range nativeFunctions {
funcs[value.name] = value
for _, nativeFunction := range nativeFunctions {

// Always return a copy.
// Because the indexes are modified my the imported program.
funcs[nativeFunction.name] = &global{
name: nativeFunction.name,
location: nativeFunction.location,
index: nativeFunction.index,
}
}
return funcs
}
Expand Down
Loading