case OBREAK, OCONTINUE, OGOTO, OFALL, OXFALL:
p.nodesOrNil(n.Left, nil)
- case OEMPTY:
+ case OEMPTY, ODCLCONST:
// nothing to do
case OLABEL:
case OBREAK, OCONTINUE, OGOTO, OFALL, OXFALL:
n.Left, _ = p.nodesOrNil()
- case OEMPTY:
+ case OEMPTY, ODCLCONST:
// nothing to do
case OLABEL:
fallthrough
case OTYPE:
- if n.Sym != nil && !exportedsym(n.Sym) {
+ if n.Sym != nil && n.Sym.Def != nil && !exportedsym(n.Sym) {
if Debug['E'] != 0 {
fmt.Printf("reexport literal/type %v\n", n.Sym)
}
if Debug['l'] < 2 {
typecheckinl(f.Type.Nname)
}
- exportf("\tfunc %v %v %v { %v }\n", Tconv(f.Type.Recvs(), FmtSharp), Sconv(f.Sym, FmtShort|FmtByte|FmtSharp), Tconv(f.Type, FmtShort|FmtSharp), Hconv(f.Type.Nname.Func.Inl, FmtSharp))
+ exportf("\tfunc %v %v %v { %v }\n", Tconv(f.Type.Recvs(), FmtSharp), Sconv(f.Sym, FmtShort|FmtByte|FmtSharp), Tconv(f.Type, FmtShort|FmtSharp), Hconv(f.Type.Nname.Func.Inl, FmtSharp|FmtBody))
reexportdeplist(f.Type.Nname.Func.Inl)
} else {
exportf("\tfunc %v %v %v\n", Tconv(f.Type.Recvs(), FmtSharp), Sconv(f.Sym, FmtShort|FmtByte|FmtSharp), Tconv(f.Type, FmtShort|FmtSharp))
f += fmt.Sprintf(" %v ", Oconv(Op(n.Etype), FmtSharp))
f += exprfmt(n.Right, nprec+1)
return f
+
+ case ODCLCONST:
+ // if exporting, DCLCONST should just be removed as its usage
+ // has already been replaced with literals
+ if fmtbody {
+ return ""
+ }
}
return fmt.Sprintf("<node %v>", Oconv(n.Op, 0))
OSWITCH,
OPROC,
ODEFER,
- ODCLTYPE, // can't print yet
- ODCLCONST, // can't print yet
+ ODCLTYPE, // can't print yet
ORETJMP:
return true
}
func h(x int) int { // ERROR "can inline h"
return x + 2
}
+
+func i(x int) int { // ERROR "can inline i"
+ const y = 2
+ return x + y
+}