Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fix infinite recursion bug. In some cases with closures.

Like this:

func x() func(*view) {
	return func(view *view) {
		view.<cursor>
	}
}

Closure's "view" was declared in a wrong scope.
  • Loading branch information...
commit 94d77e3454f53c044f45c16f1af67115732a84d7 1 parent 1cc0ac9
@nsf authored
Showing with 2 additions and 2 deletions.
  1. +2 −2 autocompletefile.go
View
4 autocompletefile.go
@@ -148,8 +148,8 @@ type func_lit_visitor struct {
func (v *func_lit_visitor) Visit(node ast.Node) ast.Visitor {
if t, ok := node.(*ast.FuncLit); ok && v.ctx.cursor_in(t.Body) {
- s := v.ctx.scope
- v.ctx.scope, _ = advance_scope(v.ctx.scope)
+ var s *scope
+ v.ctx.scope, s = advance_scope(v.ctx.scope)
v.ctx.process_field_list(t.Type.Params, s)
v.ctx.process_field_list(t.Type.Results, s)
Please sign in to comment.
Something went wrong with that request. Please try again.