vile / scheme / native_guard.v
17 lines · 16 sloc · 587 bytes · 76646891b77a3d5c6af4a1e42b122cd61dc1654b
Raw
1module scheme
2
3// Global values can change without changing name-resolution epochs. Primitive
4// generic installation can also change an existing Procedure's protocol. Keep
5// these changes distinct from the public binding topology and syntax identity.
6@[inline]
7fn (vm &VM) invalidate_native_bindings() {
8 $if vile_native ? {
9 if !isnil(vm.native_execution_scope) {
10 mut scope := unsafe { &NativeScope(vm.native_execution_scope) }
11 scope.binding_revision++
12 if scope.binding_revision == 0 {
13 for i in 0 .. scope.plans.len { scope.plans[i].guards_valid = false }
14 }
15 }
16 }
17}
18