Commit d014bb4a authored by Sean DuBois's avatar Sean DuBois

Implement R REDUCE opcode

parent 607c0487
...@@ -399,8 +399,16 @@ func (d *Decoder) loadBinPersid() error { ...@@ -399,8 +399,16 @@ func (d *Decoder) loadBinPersid() error {
return errNotImplemented return errNotImplemented
} }
type Thunk struct {
class Class
args []interface{}
}
func (d *Decoder) reduce() error { func (d *Decoder) reduce() error {
return errNotImplemented args := d.pop().([]interface{})
class := d.pop().(Class)
d.stack = append(d.stack, Thunk{class: class, args: args})
return nil
} }
func decodeStringEscape(b []byte) string { func decodeStringEscape(b []byte) string {
...@@ -541,7 +549,7 @@ func (d *Decoder) global() error { ...@@ -541,7 +549,7 @@ func (d *Decoder) global() error {
if err != nil { if err != nil {
return nil return nil
} }
d.stack = append(d.stack, &Class{module: string(module), name: string(name)}) d.stack = append(d.stack, Class{module: string(module), name: string(name)})
return nil return nil
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment