func (vs *varStore) mustBeDeclaredAsIndirect(v *ast.Identifier) bool {
	return vs.indirectVars[v]
}
mustBeDeclaredAsIndirect reports whether v must be declared as indirect.
package compiler
import (
	"reflect"
	"github.com/open2b/scriggo/ast"
	"github.com/open2b/scriggo/internal/runtime"
)
type varStore struct {
	emitter *emitter
	indirectVars map[*ast.Identifier]bool
	predefVarRef map[*runtime.Function]map[*reflect.Value]int16
	globals []Global
	scriggoPackageVarRefs map[*ast.Package]map[string]int16
	closureVars map[*runtime.Function]map[string]int16
}
func newVarStore(emitter *emitter, indirectVars map[*ast.Identifier]bool) *varStore {
	return &varStore{
		emitter:               emitter,
		predefVarRef:          map[*runtime.Function]map[*reflect.Value]int16{},
		indirectVars:          indirectVars,
		scriggoPackageVarRefs: map[*ast.Package]map[string]int16{},
		closureVars:           map[*runtime.Function]map[string]int16{},
	}
}
func (vs *varStore) setClosureVar(fn *runtime.Function, name string, index int16) {
	if vs.closureVars[fn] == nil {
		vs.closureVars[fn] = map[string]int16{}
	}
	vs.closureVars[fn][name] = index
}
func (vs *varStore) bindScriggoPackageVar(pkg *ast.Package, name string, index int16) {
	if vs.scriggoPackageVarRefs[pkg] == nil {
		vs.scriggoPackageVarRefs[pkg] = map[string]int16{}
	}
	vs.scriggoPackageVarRefs[pkg][name] = index
}
func (vs *varStore) createScriggoPackageVar(pkg *ast.Package, global Global) int16 {
	index := int16(len(vs.globals))
	vs.globals = append(vs.globals, global)
	if vs.scriggoPackageVarRefs[pkg] == nil {
		vs.scriggoPackageVarRefs[pkg] = map[string]int16{}
	}
	vs.scriggoPackageVarRefs[pkg][global.Name] = index
	return index
}