github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/gnovm/tests/files/zrealm2.gno (about) 1 // PKGPATH: gno.land/r/test 2 package test 3 4 var root Node 5 6 type ( 7 Node interface{} 8 Key interface{} 9 ) 10 11 type InnerNode struct { 12 Key Key 13 Left Node 14 Right Node 15 } 16 17 func init() { 18 root = InnerNode{ 19 Key: "old", 20 } 21 } 22 23 func main() { 24 root = InnerNode{ 25 Key: "new", 26 } 27 } 28 29 // Realm: 30 // switchrealm["gno.land/r/test"] 31 // c[a8ada09dee16d791fd406d629fe29bb0ed084a30:5]={ 32 // "Fields": [ 33 // { 34 // "T": { 35 // "@type": "/gno.PrimitiveType", 36 // "value": "16" 37 // }, 38 // "V": { 39 // "@type": "/gno.StringValue", 40 // "value": "new" 41 // } 42 // }, 43 // {}, 44 // {} 45 // ], 46 // "ObjectInfo": { 47 // "ID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:5", 48 // "ModTime": "0", 49 // "OwnerID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:2", 50 // "RefCount": "1" 51 // } 52 // } 53 // u[a8ada09dee16d791fd406d629fe29bb0ed084a30:2]={ 54 // "Blank": {}, 55 // "ObjectInfo": { 56 // "ID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:2", 57 // "IsEscaped": true, 58 // "ModTime": "4", 59 // "RefCount": "2" 60 // }, 61 // "Parent": null, 62 // "Source": { 63 // "@type": "/gno.RefNode", 64 // "BlockNode": null, 65 // "Location": { 66 // "File": "", 67 // "Line": "0", 68 // "Nonce": "0", 69 // "PkgPath": "gno.land/r/test" 70 // } 71 // }, 72 // "Values": [ 73 // { 74 // "T": { 75 // "@type": "/gno.TypeType" 76 // }, 77 // "V": { 78 // "@type": "/gno.TypeValue", 79 // "Type": { 80 // "@type": "/gno.DeclaredType", 81 // "Base": { 82 // "@type": "/gno.InterfaceType", 83 // "Generic": "", 84 // "Methods": [], 85 // "PkgPath": "gno.land/r/test" 86 // }, 87 // "Methods": [], 88 // "Name": "Node", 89 // "PkgPath": "gno.land/r/test" 90 // } 91 // } 92 // }, 93 // { 94 // "T": { 95 // "@type": "/gno.TypeType" 96 // }, 97 // "V": { 98 // "@type": "/gno.TypeValue", 99 // "Type": { 100 // "@type": "/gno.DeclaredType", 101 // "Base": { 102 // "@type": "/gno.InterfaceType", 103 // "Generic": "", 104 // "Methods": [], 105 // "PkgPath": "gno.land/r/test" 106 // }, 107 // "Methods": [], 108 // "Name": "Key", 109 // "PkgPath": "gno.land/r/test" 110 // } 111 // } 112 // }, 113 // { 114 // "T": { 115 // "@type": "/gno.TypeType" 116 // }, 117 // "V": { 118 // "@type": "/gno.TypeValue", 119 // "Type": { 120 // "@type": "/gno.DeclaredType", 121 // "Base": { 122 // "@type": "/gno.StructType", 123 // "Fields": [ 124 // { 125 // "Embedded": false, 126 // "Name": "Key", 127 // "Tag": "", 128 // "Type": { 129 // "@type": "/gno.RefType", 130 // "ID": "gno.land/r/test.Key" 131 // } 132 // }, 133 // { 134 // "Embedded": false, 135 // "Name": "Left", 136 // "Tag": "", 137 // "Type": { 138 // "@type": "/gno.RefType", 139 // "ID": "gno.land/r/test.Node" 140 // } 141 // }, 142 // { 143 // "Embedded": false, 144 // "Name": "Right", 145 // "Tag": "", 146 // "Type": { 147 // "@type": "/gno.RefType", 148 // "ID": "gno.land/r/test.Node" 149 // } 150 // } 151 // ], 152 // "PkgPath": "gno.land/r/test" 153 // }, 154 // "Methods": [], 155 // "Name": "InnerNode", 156 // "PkgPath": "gno.land/r/test" 157 // } 158 // } 159 // }, 160 // { 161 // "T": { 162 // "@type": "/gno.FuncType", 163 // "Params": [], 164 // "Results": [] 165 // }, 166 // "V": { 167 // "@type": "/gno.FuncValue", 168 // "Closure": { 169 // "@type": "/gno.RefValue", 170 // "Escaped": true, 171 // "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:3" 172 // }, 173 // "FileName": "main.gno", 174 // "IsMethod": false, 175 // "Name": "init.3", 176 // "NativeName": "", 177 // "NativePkg": "", 178 // "PkgPath": "gno.land/r/test", 179 // "Source": { 180 // "@type": "/gno.RefNode", 181 // "BlockNode": null, 182 // "Location": { 183 // "File": "main.gno", 184 // "Line": "17", 185 // "Nonce": "0", 186 // "PkgPath": "gno.land/r/test" 187 // } 188 // }, 189 // "Type": { 190 // "@type": "/gno.FuncType", 191 // "Params": [], 192 // "Results": [] 193 // } 194 // } 195 // }, 196 // { 197 // "T": { 198 // "@type": "/gno.FuncType", 199 // "Params": [], 200 // "Results": [] 201 // }, 202 // "V": { 203 // "@type": "/gno.FuncValue", 204 // "Closure": { 205 // "@type": "/gno.RefValue", 206 // "Escaped": true, 207 // "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:3" 208 // }, 209 // "FileName": "main.gno", 210 // "IsMethod": false, 211 // "Name": "main", 212 // "NativeName": "", 213 // "NativePkg": "", 214 // "PkgPath": "gno.land/r/test", 215 // "Source": { 216 // "@type": "/gno.RefNode", 217 // "BlockNode": null, 218 // "Location": { 219 // "File": "main.gno", 220 // "Line": "23", 221 // "Nonce": "0", 222 // "PkgPath": "gno.land/r/test" 223 // } 224 // }, 225 // "Type": { 226 // "@type": "/gno.FuncType", 227 // "Params": [], 228 // "Results": [] 229 // } 230 // } 231 // }, 232 // { 233 // "T": { 234 // "@type": "/gno.RefType", 235 // "ID": "gno.land/r/test.InnerNode" 236 // }, 237 // "V": { 238 // "@type": "/gno.RefValue", 239 // "Hash": "61d4aa77a87c01e07038c6030d6aca299d0fdc1b", 240 // "ObjectID": "a8ada09dee16d791fd406d629fe29bb0ed084a30:5" 241 // } 242 // } 243 // ] 244 // } 245 // d[a8ada09dee16d791fd406d629fe29bb0ed084a30:4]