|
@@ -14,25 +14,11 @@ type Entry struct {
|
|
desc string
|
|
desc string
|
|
fn reflect.Value
|
|
fn reflect.Value
|
|
seqFn func(sc *Context) error
|
|
seqFn func(sc *Context) error
|
|
- param []SeqParam
|
|
|
|
- ret []reflect.Value
|
|
|
|
|
|
+ param []Param
|
|
grab []reflect.Value
|
|
grab []reflect.Value
|
|
}
|
|
}
|
|
-type SeqParam struct {
|
|
|
|
- typ byte
|
|
|
|
- nres int
|
|
|
|
- ires int
|
|
|
|
- // Or
|
|
|
|
- param reflect.Value
|
|
|
|
-}
|
|
|
|
|
|
|
|
// Helper
|
|
// Helper
|
|
-func SeqReturn(n, i int) SeqParam {
|
|
|
|
- return SeqParam{1, n, i, reflect.Value{}}
|
|
|
|
-}
|
|
|
|
-func ExecParam(n int) SeqParam {
|
|
|
|
- return SeqParam{2, n, 0, reflect.Value{}}
|
|
|
|
-}
|
|
|
|
|
|
|
|
type Seq struct {
|
|
type Seq struct {
|
|
seq []*Entry
|
|
seq []*Entry
|
|
@@ -42,7 +28,7 @@ type Seq struct {
|
|
rep []string
|
|
rep []string
|
|
}
|
|
}
|
|
|
|
|
|
-func New() *Seq {
|
|
|
|
|
|
+func NewSeq() *Seq {
|
|
return &Seq{[]*Entry{}, nil, map[string]interface{}{}, nil}
|
|
return &Seq{[]*Entry{}, nil, map[string]interface{}{}, nil}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -65,12 +51,12 @@ func (s *Seq) Add(params ...interface{}) *Seq {
|
|
if fnTyp.Kind() != reflect.Func {
|
|
if fnTyp.Kind() != reflect.Func {
|
|
log.Fatal("First param must be a function")
|
|
log.Fatal("First param must be a function")
|
|
}
|
|
}
|
|
- vparam := []SeqParam{}
|
|
|
|
|
|
+ vparam := []Param{}
|
|
|
|
|
|
for _, p := range params[fni+1:] {
|
|
for _, p := range params[fni+1:] {
|
|
- sp := SeqParam{}
|
|
|
|
|
|
+ sp := Param{}
|
|
switch v := p.(type) {
|
|
switch v := p.(type) {
|
|
- case SeqParam:
|
|
|
|
|
|
+ case Param:
|
|
sp = v
|
|
sp = v
|
|
default:
|
|
default:
|
|
sp.typ = 0
|
|
sp.typ = 0
|