Skip to content
This repository was archived by the owner on Aug 2, 2023. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion lua/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ type errorFn func(error)

func (fn errorFn) throw(state *State, err error) {
if fn == nil {
// fmt.Fprintf(os.Stderr, "lua: runtime error: %v\n", err)
panic(err)
} else {
fn(err)
Expand Down
4 changes: 0 additions & 4 deletions lua/frame.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ func (fr *Frame) absindex(index int) int {
// settop sets the locals stack top to top if valid, removing or adding
// elements to adjust the stack.
func (fr *Frame) settop(top int) {
// if top = fr.absindex(top); top < 0 {
// panic(runtimeErr(fmt.Errorf("stack underflow!")))
// }
switch diff := fr.gettop() - top; {
case diff >= 0: // new top < old top
for i := 0; i < diff; i++ {
Expand Down Expand Up @@ -273,7 +270,6 @@ func (fr *Frame) local(index int) Value {
//
// TODO: ensure stack
func (fr *Frame) pushN(vs []Value) {
// fmt.Printf("frame #%d: push %v\n", fr.depth, vs)
for _, v := range vs {
fr.push(v)
}
Expand Down
3 changes: 0 additions & 3 deletions lua/lua.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,6 @@ func (state *State) Next(index int) (more bool) {
}
var k, v Value
if k, v, more = tbl.next(state.frame().pop()); more {
// fmt.Printf("next: key=%v, value=%v (more = %t)\n", k, v, more)
state.frame().push(k)
state.frame().push(v)
}
Expand Down Expand Up @@ -525,8 +524,6 @@ func (state *State) Call(args, rets int) {
c, ok = value.(*Closure)
)

// state.Logf("call (func @ %d) %v (# args = %d, # rets = %d)\n", funcID, value, args, rets)

if !ok {
if !tryMetaCall(state, value, funcID, args, rets) {
state.errorf("attempt to call a %s value @ %d (%T)\n%v\n", value.Type(), funcID, value, state.frame().locals)
Expand Down
3 changes: 0 additions & 3 deletions lua/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,6 @@ func (state *State) traceback(w io.Writer) {
// If the error is not a runtimeErr, recover repanics the
// error up the stack.
func (state *State) recover(err *error) {
// goutils.DumpStack(err, state.recover)
if r := recover(); r != nil {
state.Debug(false)
if e, ok := r.(runtimeErr); ok {
Expand Down Expand Up @@ -379,7 +378,6 @@ func (state *State) load(filename string, source interface{}) (*Closure, error)
}

func (state *State) gettable(obj, key Value, raw bool) Value {
// fmt.Printf("%v[%v] (%t)\n", obj, key, raw)
if tbl, ok := obj.(*table); ok {
if val := tbl.get(key); !IsNone(val) || raw || IsNone(state.metafield(tbl, "__index")) {
return val
Expand All @@ -401,7 +399,6 @@ func (state *State) gettable(obj, key Value, raw bool) Value {
}

func (state *State) settable(obj, key, val Value, raw bool) {
// fmt.Printf("%v[%v] = %v (%t)\n", obj, key, val, raw)
if tbl, ok := obj.(*table); ok && (tbl.exists(key) || raw) {
tbl.set(key, val)
return
Expand Down
1 change: 0 additions & 1 deletion lua/table.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ func (t *table) get(k Value) Value {
}
if n, ok := k.(Number); ok {
i := arrayIndex(n) - 1
// fmt.Printf("table[%v] (%T) @ %d\n", k, k, i)
if i >= 0 && i < len(t.list) {
return t.list[i]
}
Expand Down
1 change: 0 additions & 1 deletion pkg/packer/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ func (p *state) packValue(o option, v interface{}) error {

func (p *state) packString(o option, v interface{}) error {
fmt.Println("pack: string")
// return p.pack(o, v)
return nil
}

Expand Down
1 change: 0 additions & 1 deletion pkg/pattern/classes.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ func (i item) matches(r rune) (match bool) {
default:
panic(fmt.Errorf("unhandled character class %q", i.val))
}
// fmt.Printf("class(%s) matches (%s) = %t\n", i.val, string(r), match)
if strings.ToUpper(i.val) == i.val {
return !match
}
Expand Down