]> Cypherpunks.ru repositories - gostls13.git/blobdiff - src/cmd/compile/internal/ir/name.go
cmd/compile/internal/ir: add Func.DeclareParams
[gostls13.git] / src / cmd / compile / internal / ir / name.go
index 2d780bdaf753819710b0fe8c2445a9818b8e4b18..2844c0b8699bd9dd1113384bf8749c758f7eacc3 100644 (file)
@@ -102,16 +102,13 @@ func NewBuiltin(sym *types.Sym, op Op) *Name {
 }
 
 // NewLocal returns a new function-local variable with the given name and type.
-func (fn *Func) NewLocal(pos src.XPos, sym *types.Sym, class Class, typ *types.Type) *Name {
-       switch class {
-       case PPARAM, PPARAMOUT, PAUTO:
-               // ok
-       default:
-               base.FatalfAt(pos, "NewLocal: unexpected class for %v: %v", sym, class)
+func (fn *Func) NewLocal(pos src.XPos, sym *types.Sym, typ *types.Type) *Name {
+       if fn.Dcl == nil {
+               base.FatalfAt(pos, "must call DeclParams on %v first", fn)
        }
 
        n := NewNameAt(pos, sym, typ)
-       n.Class = class
+       n.Class = PAUTO
        n.Curfn = fn
        fn.Dcl = append(fn.Dcl, n)
        return n