Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Remove nonsense comment. Run loop detection code only when necessary.

  • Loading branch information...
commit cb4774c13f8c09c53e89c169a82921ea62d2dd4f 1 parent cbc5793
@nsf authored
Showing with 7 additions and 8 deletions.
  1. +7 −8 decl.go
View
15 decl.go
@@ -353,8 +353,6 @@ func (other *decl) deep_copy() *decl {
func (d *decl) clear_visited() {
d.flags &^= decl_visited
- // don't clear children, because only package level decls are subject
- // to possible loops
}
func (d *decl) expand_or_replace(other *decl) {
@@ -898,12 +896,6 @@ func (d *decl) infer_type() (ast.Expr, *scope) {
return d.typ, scope
}
- if d.flags&decl_visited != 0 {
- return nil, nil
- }
- d.flags |= decl_visited
- defer d.clear_visited()
-
switch d.class {
case decl_package:
// package is handled specially in inferType
@@ -917,6 +909,13 @@ func (d *decl) infer_type() (ast.Expr, *scope) {
return d.typ, d.scope
}
+ // prevent loops
+ if d.flags&decl_visited != 0 {
+ return nil, nil
+ }
+ d.flags |= decl_visited
+ defer d.clear_visited()
+
var scope *scope
d.typ, scope, _ = infer_type(d.value, d.scope, d.value_index)
return d.typ, scope
Please sign in to comment.
Something went wrong with that request. Please try again.