global var init

This commit is contained in:
xushiwei
2024-04-21 00:22:39 +08:00
parent 358e18b9de
commit 8f31e4a6d3
7 changed files with 22 additions and 11 deletions

View File

@@ -46,11 +46,13 @@ type aGlobal struct {
// A Global is a named Value holding the address of a package-level
// variable.
//
// Pos() returns the position of the ast.ValueSpec.Names[*]
// identifier.
type Global = *aGlobal
// Init initializes the global variable with the given value.
func (g Global) Init(v Expr) {
g.impl.SetInitializer(v.impl)
}
// -----------------------------------------------------------------------------
// Function represents the parameters, results, and code of a function