1
0
mirror of https://github.com/fumiama/gozel.git synced 2026-06-29 07:10:26 +08:00

feat(gen): finish core/common

This commit is contained in:
源文雨
2026-03-20 22:13:08 +08:00
parent a56666c826
commit 750ec25796
5 changed files with 155 additions and 47 deletions

View File

@@ -11,7 +11,7 @@ var (
errNoSuchSymbol = errors.New("no such sybmol")
)
type symbolTable map[string]symbol
type symbolTable map[string]*symbol
func (st symbolTable) apply(t string) string {
for _, s := range st {
@@ -20,6 +20,11 @@ func (st symbolTable) apply(t string) string {
return t
}
func (st symbolTable) contains(name string) bool {
_, ok := st[name]
return ok
}
type symbolType uintptr
const (
@@ -40,16 +45,16 @@ type symbol struct {
fields []string
}
func newSymbolConst(name, val string) symbol {
return symbol{
func newSymbolConst(name, val string) *symbol {
return &symbol{
stype: symbolTypeConst,
name: name,
fields: []string{val},
}
}
func newSymbolFunc(name, paras, evals string) symbol {
return symbol{
func newSymbolFunc(name, paras, evals string) *symbol {
return &symbol{
stype: symbolTypeFunc,
name: name,
fields: []string{paras, evals},