}
f.Func.Inl.Set(body)
f.Func.InlCost = int32(inlCost)
+ if Debug['E'] > 0 && Debug['m'] > 2 && f.Func.Inl.Len() != 0 {
+ if Debug['m'] > 3 {
+ fmt.Printf("inl body for %v: %+v\n", f, f.Func.Inl)
+ } else {
+ fmt.Printf("inl body for %v: %v\n", f, f.Func.Inl)
+ }
+ }
funcbody()
} else {
// function already imported - read body but discard declarations
n := newfuncnamel(pos, sym)
n.Type = sig
+ // TODO(mdempsky): Stop clobbering n.Pos in declare.
+ savedlineno := lineno
+ lineno = pos
declare(n, PFUNC)
+ lineno = savedlineno
p.funcList = append(p.funcList, n)
importlist = append(importlist, n)
if Debug['E'] > 0 {
fmt.Printf("import [%q] func %v \n", p.imp.Path, n)
- if Debug['m'] > 2 && n.Func.Inl.Len() != 0 {
- fmt.Printf("inl body: %v\n", n.Func.Inl)
- }
}
default:
// read underlying type
t0 := p.typ()
+ // TODO(mdempsky): Stop clobbering n.Pos in declare.
+ savedlineno := lineno
+ lineno = pos
p.importtype(t, t0)
+ lineno = savedlineno
// interfaces don't have associated methods
if t0.IsInterface() {
if Debug['E'] > 0 {
fmt.Printf("import [%q] meth %v \n", p.imp.Path, n)
- if Debug['m'] > 2 && n.Func.Inl.Len() != 0 {
- fmt.Printf("inl body: %v\n", n.Func.Inl)
- }
}
}
// unimplemented
case OPTRLIT:
- n := npos(p.pos(), p.expr())
+ pos := p.pos()
+ n := npos(pos, p.expr())
if !p.bool() /* !implicit, i.e. '&' operator */ {
if n.Op == OCOMPLIT {
// Special case for &T{...}: turn into (*T){...}.
- n.Right = nod(OIND, n.Right, nil)
+ n.Right = nodl(pos, OIND, n.Right, nil)
n.Right.SetImplicit(true)
} else {
- n = nod(OADDR, n, nil)
+ n = nodl(pos, OADDR, n, nil)
}
}
return n
case OSTRUCTLIT:
- n := nodl(p.pos(), OCOMPLIT, nil, typenod(p.typ()))
+ // TODO(mdempsky): Export position information for OSTRUCTKEY nodes.
+ savedlineno := lineno
+ lineno = p.pos()
+ n := nodl(lineno, OCOMPLIT, nil, typenod(p.typ()))
n.List.Set(p.elemList()) // special handling of field names
+ lineno = savedlineno
return n
// case OARRAYLIT, OSLICELIT, OMAPLIT:
61: sink = dx + dy //gdb-opt=(dx,dy)
63: hist := make([]int, 7) //gdb-opt=(sink,dx/O,dy/O)
64: var reader io.Reader = strings.NewReader(cannedInput) //gdb-dbg=(hist/A,cannedInput/A)
-19: "strings"
65: if len(os.Args) > 1 {
-14: "bufio"
74: for scanner.Scan() { //gdb-opt=(scanner/A)
76: i, err := strconv.ParseInt(s, 10, 64)
77: if err != nil { //gdb-dbg=(i) //gdb-opt=(err,hist,i)