github.com/gnolang/gno@v0.0.0-20240520182011-228e9d0192ce/gnovm/tests/files/zrealm3.gno (about)

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