return value
}
-func (p *Parser) atos(str string) string {
- value, err := strconv.Unquote(str)
- if err != nil {
- p.errorf("%s", err)
- }
- return value
-}
-
// EOF represents the end of input.
var EOF = lex.Make(scanner.EOF, "EOF")
result := p.paramList()
nointerface := p.bool()
- n := methodname1(newname(sym), recv[0].Right)
+ n := methodname(newname(sym), recv[0].Right)
n.Type = functype(recv[0], params, result)
checkwidth(n.Type)
addmethod(sym, n.Type, tsym.Pkg, false, nointerface)
return nil
}
-func methodname(n *Node, t *Type) *Node {
- s := methodsym(n.Sym, t, 0)
- if s == nil {
- return n
- }
- return newname(s)
-}
-
-func methodname1(n *Node, t *Node) *Node {
+func methodname(n *Node, t *Node) *Node {
star := ""
if t.Op == OIND {
star = "*"
return n.Op == ONAME && n.Class == PAUTOHEAP && n.Name.Param.Stackcopy != nil
}
-// paramClass reports the parameter class (PPARAM or PPARAMOUT)
-// of the node, which may be an unmoved on-stack parameter
-// or the on-heap or on-stack copy of a parameter that moved to the heap.
-// If the node is not a parameter, paramClass returns Pxxx.
-func (n *Node) paramClass() Class {
- if n.Op != ONAME {
- return Pxxx
- }
- if n.Class == PPARAM || n.Class == PPARAMOUT {
- return n.Class
- }
- if n.isParamHeapCopy() {
- return n.Name.Param.Stackcopy.Class
- }
- return Pxxx
-}
-
// moveToHeap records the parameter or local variable n as moved to the heap.
func moveToHeap(n *Node) {
if Debug['r'] != 0 {
// Receiver MethodName Signature
f.Func.Shortname = newfuncname(name)
- f.Func.Nname = methodname1(f.Func.Shortname, t.Left.Right)
+ f.Func.Nname = methodname(f.Func.Shortname, t.Left.Right)
}
f.Func.Nname.Name.Defn = f
return newname(p.name(name))
}
-func (p *noder) oldname(name *syntax.Name) *Node {
- return oldname(p.name(name))
-}
-
func (p *noder) wrapname(n syntax.Node, x *Node) *Node {
// These nodes do not carry line numbers.
// Introduce a wrapper node to give them the correct line.
a.Etype = uint8(TSTRING)
}
-func dgostringptr(s *Sym, off int, str string) int {
- if str == "" {
- return duintptr(s, off, 0)
- }
- return dgostrlitptr(s, off, &str)
-}
-
-func dgostrlitptr(s *Sym, off int, lit *string) int {
- if lit == nil {
- return duintptr(s, off, 0)
- }
- off = int(Rnd(int64(off), int64(Widthptr)))
- symhdr, _ := stringsym(*lit)
- Linksym(s).WriteAddr(Ctxt, int64(off), Widthptr, symhdr, 0)
- off += Widthptr
- return off
-}
-
func dsname(s *Sym, off int, t string) int {
return dsnameLSym(Linksym(s), off, t)
}
f := Nod(ODCLFUNC, nil, nil)
f.Func.Shortname = newfuncname(name)
- f.Func.Nname = methodname1(f.Func.Shortname, recv.Right)
+ f.Func.Nname = methodname(f.Func.Shortname, recv.Right)
f.Func.Nname.Name.Defn = f
f.Func.Nname.Name.Param.Ntype = t
declare(f.Func.Nname, PFUNC)
one: (*state).constInt64,
}
-// Excess generality on a machine with 64-bit integer registers.
-// Not used on AMD64.
-var u32_f32 u2fcvtTab = u2fcvtTab{
- geq: ssa.OpGeq32,
- cvt2F: ssa.OpCvt32to32F,
- and: ssa.OpAnd32,
- rsh: ssa.OpRsh32Ux32,
- or: ssa.OpOr32,
- add: ssa.OpAdd32F,
- one: func(s *state, t ssa.Type, x int64) *ssa.Value {
- return s.constInt32(t, int32(x))
- },
-}
-
func (s *state) uint64Tofloat64(n *Node, x *ssa.Value, ft, tt *Type) *ssa.Value {
return s.uintTofloat(&u64_f64, n, x, ft, tt)
}
f.Config.HTML.Close()
}
-// movZero generates a register indirect move with a 0 immediate and keeps track of bytes left and next offset
-func movZero(as obj.As, width int64, nbytes int64, offset int64, regnum int16) (nleft int64, noff int64) {
- p := Prog(as)
- // TODO: use zero register on archs that support it.
- p.From.Type = obj.TYPE_CONST
- p.From.Offset = 0
- p.To.Type = obj.TYPE_MEM
- p.To.Reg = regnum
- p.To.Offset = offset
- offset += width
- nleft = nbytes - width
- return nleft, offset
-}
-
type FloatingEQNEJump struct {
Jump obj.As
Index int
}
}
-func (t *Type) wantEtype2(et1, et2 EType) {
- if t.Etype != et1 && t.Etype != et2 {
- Fatalf("want %v or %v, but have %v", et1, et2, t)
- }
-}
-
func (t *Type) RecvsP() **Type {
t.wantEtype(TFUNC)
return &t.Extra.(*FuncType).Receiver
// to describe the data type, and then finally call End.
type Writer struct {
writeByte func(byte)
- symoff int
index int64
b [progMaxLiteral]byte
nb int
dataOffset int64
limit int64
tmp [256]byte
- pkg string
pkgprefix string
}