fmt.Fprintf(&buf, " tc(%d)", n.Typecheck)
}
- if c == 0 && n.Dodata != 0 {
- fmt.Fprintf(&buf, " dd(%d)", n.Dodata)
+ if c == 0 && n.IsStatic {
+ buf.WriteString(" static")
}
if n.Isddd {
if a.Op != OAS {
Fatalf("structlit: not as")
}
- a.Dodata = 2
+ a.IsStatic = true
} else {
a = orderstmtinplace(a)
a = walkstmt(a)
if a.Op != OAS {
Fatalf("arraylit: not as")
}
- a.Dodata = 2
+ a.IsStatic = true
} else {
a = orderstmtinplace(a)
a = walkstmt(a)
a = Nod(OAS, var_, a)
a = typecheck(a, Etop)
- a.Dodata = 2
+ a.IsStatic = true
init.Append(a)
return
}
as := Nod(OAS, lhs, index)
as = typecheck(as, Etop)
as = walkexpr(as, init)
- as.Dodata = 2
+ as.IsStatic = true
init.Append(as)
// build vstatv[b] = value
as = Nod(OAS, lhs, value)
as = typecheck(as, Etop)
as = walkexpr(as, init)
- as.Dodata = 2
+ as.IsStatic = true
init.Append(as)
b++
// If reportOnly is true, it does not emit static data and does not modify the AST.
func gen_as_init(n *Node, reportOnly bool) bool {
success := genAsInitNoCheck(n, reportOnly)
- if !success && n.Dodata == 2 {
+ if !success && n.IsStatic {
Dump("\ngen_as_init", n)
- Fatalf("gen_as_init couldn't make data statement")
+ Fatalf("gen_as_init couldn't generate static data")
}
return success
}
func genAsInitNoCheck(n *Node, reportOnly bool) bool {
- if n.Dodata == 0 {
+ if !n.IsStatic {
return false
}
if n == nil {
return n
}
- if n.Dodata == 2 { // don't walk, generated by anylit.
+ if n.IsStatic { // don't walk, generated by anylit.
return n
}
}
if n.Left != nil && n.Right != nil {
- dd := n.Dodata
+ static := n.IsStatic
n = convas(n, init)
- n.Dodata = dd
+ n.IsStatic = static
n = applywritebarrier(n)
}