Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

innerowner.gno

0.62 Kb · 20 lines
 1// Package innerowner persists an *Inner that lives in this realm.
 2// Foreign-realm callers use GetInner() to obtain a pointer to it.
 3// When they pass it as the receiver of a /p/ method, PushFrameCall's
 4// borrow rule 2 fires and m.Realm shifts to this realm.
 5package innerowner
 6
 7import "gno.land/p/demo/tests/p_closurecap"
 8
 9var inn *p_closurecap.Inner
10
11func init() {
12	inn = &p_closurecap.Inner{N: 0}
13}
14
15// GetInner returns the persisted Inner. Non-crossing: the caller's
16// realm stays current, but the returned *Inner carries PkgID =
17// innerowner from its init-time allocation.
18func GetInner() *p_closurecap.Inner {
19	return inn
20}