diff options
Diffstat (limited to 'src/cmd/compile/internal/ir/node.go')
-rw-r--r-- | src/cmd/compile/internal/ir/node.go | 120 |
1 files changed, 0 insertions, 120 deletions
diff --git a/src/cmd/compile/internal/ir/node.go b/src/cmd/compile/internal/ir/node.go index ca894cd5f1..1679313c86 100644 --- a/src/cmd/compile/internal/ir/node.go +++ b/src/cmd/compile/internal/ir/node.go @@ -640,123 +640,3 @@ func IsBlank(n Node) bool { func IsMethod(n Node) bool { return n.Type().Recv() != nil } - -func Nod(op Op, nleft, nright Node) Node { - return NodAt(base.Pos, op, nleft, nright) -} - -func NodAt(pos src.XPos, op Op, nleft, nright Node) Node { - switch op { - default: - panic("NodAt " + op.String()) - case OADD, OAND, OANDNOT, ODIV, OEQ, OGE, OGT, OLE, - OLSH, OLT, OMOD, OMUL, ONE, OOR, ORSH, OSUB, OXOR, - OCOPY, OCOMPLEX, - OEFACE: - return NewBinaryExpr(pos, op, nleft, nright) - case OADDR: - return NewAddrExpr(pos, nleft) - case OADDSTR: - return NewAddStringExpr(pos, nil) - case OANDAND, OOROR: - return NewLogicalExpr(pos, op, nleft, nright) - case OARRAYLIT, OCOMPLIT, OMAPLIT, OSTRUCTLIT, OSLICELIT: - var typ Ntype - if nright != nil { - typ = nright.(Ntype) - } - return NewCompLitExpr(pos, op, typ, nil) - case OAS: - return NewAssignStmt(pos, nleft, nright) - case OAS2, OAS2DOTTYPE, OAS2FUNC, OAS2MAPR, OAS2RECV, OSELRECV2: - n := NewAssignListStmt(pos, op, nil, nil) - return n - case OASOP: - return NewAssignOpStmt(pos, OXXX, nleft, nright) - case OBITNOT, ONEG, ONOT, OPLUS, ORECV, - OALIGNOF, OCAP, OCLOSE, OIMAG, OLEN, ONEW, ONEWOBJ, - OOFFSETOF, OPANIC, OREAL, OSIZEOF, - OCHECKNIL, OCFUNC, OIDATA, OITAB, OSPTR, OVARDEF, OVARKILL, OVARLIVE: - if nright != nil { - panic("unary nright") - } - return NewUnaryExpr(pos, op, nleft) - case OBLOCK: - return NewBlockStmt(pos, nil) - case OBREAK, OCONTINUE, OFALL, OGOTO, ORETJMP: - return NewBranchStmt(pos, op, nil) - case OCALL, OCALLFUNC, OCALLINTER, OCALLMETH, - OAPPEND, ODELETE, OGETG, OMAKE, OPRINT, OPRINTN, ORECOVER: - return NewCallExpr(pos, op, nleft, nil) - case OCASE: - return NewCaseStmt(pos, nil, nil) - case OCONV, OCONVIFACE, OCONVNOP, ORUNESTR: - return NewConvExpr(pos, op, nil, nleft) - case ODCL, ODCLCONST, ODCLTYPE: - return NewDecl(pos, op, nleft) - case ODCLFUNC: - return NewFunc(pos) - case ODEFER, OGO: - return NewGoDeferStmt(pos, op, nleft) - case ODEREF: - return NewStarExpr(pos, nleft) - case ODOT, ODOTPTR, ODOTMETH, ODOTINTER, OXDOT: - return NewSelectorExpr(pos, op, nleft, nil) - case ODOTTYPE, ODOTTYPE2: - var typ Ntype - if nright != nil { - typ = nright.(Ntype) - } - n := NewTypeAssertExpr(pos, nleft, typ) - if op != ODOTTYPE { - n.SetOp(op) - } - return n - case OFOR: - return NewForStmt(pos, nil, nleft, nright, nil) - case OIF: - return NewIfStmt(pos, nleft, nil, nil) - case OINDEX, OINDEXMAP: - n := NewIndexExpr(pos, nleft, nright) - if op != OINDEX { - n.SetOp(op) - } - return n - case OINLMARK: - return NewInlineMarkStmt(pos, types.BADWIDTH) - case OKEY: - return NewKeyExpr(pos, nleft, nright) - case OSTRUCTKEY: - return NewStructKeyExpr(pos, nil, nleft) - case OLABEL: - return NewLabelStmt(pos, nil) - case OLITERAL, OTYPE, OIOTA: - return newNameAt(pos, op, nil) - case OMAKECHAN, OMAKEMAP, OMAKESLICE, OMAKESLICECOPY: - return NewMakeExpr(pos, op, nleft, nright) - case ONIL: - return NewNilExpr(pos) - case OPACK: - return NewPkgName(pos, nil, nil) - case OPAREN: - return NewParenExpr(pos, nleft) - case ORANGE: - return NewRangeStmt(pos, nil, nright, nil) - case ORESULT: - return NewResultExpr(pos, nil, types.BADWIDTH) - case ORETURN: - return NewReturnStmt(pos, nil) - case OSELECT: - return NewSelectStmt(pos, nil) - case OSEND: - return NewSendStmt(pos, nleft, nright) - case OSLICE, OSLICEARR, OSLICESTR, OSLICE3, OSLICE3ARR: - return NewSliceExpr(pos, op, nleft) - case OSLICEHEADER: - return NewSliceHeaderExpr(pos, nil, nleft, nil, nil) - case OSWITCH: - return NewSwitchStmt(pos, nleft, nil) - case OINLCALL: - return NewInlinedCallExpr(pos, nil, nil) - } -} |