]> Cypherpunks repositories - gostls13.git/commitdiff
text/template: remove redundant indirect
authorNodir Turakulov <nodir@google.com>
Wed, 14 Oct 2015 04:34:47 +0000 (21:34 -0700)
committerAndrew Gerrand <adg@golang.org>
Wed, 28 Oct 2015 02:51:40 +0000 (02:51 +0000)
Change-Id: I8cc9783fd044bed48347824dcf973c61c78275a5
Reviewed-on: https://go-review.googlesource.com/15833
Reviewed-by: Andrew Gerrand <adg@golang.org>
src/text/template/exec.go

index 233d34a02bc6e30ed4e8a36a58137e4a6e9cf9e2..f45cbb212f3d57f45d73e434d1296f9e2b2cf30a 100644 (file)
@@ -523,7 +523,7 @@ func (s *state) evalField(dot reflect.Value, fieldName string, node parse.Node,
                return zero
        }
        typ := receiver.Type()
-       receiver, = indirect(receiver)
+       receiver, isNil := indirect(receiver)
        // Unless it's an interface, need to get to a value of type *T to guarantee
        // we see all methods of T and *T.
        ptr := receiver
@@ -535,7 +535,6 @@ func (s *state) evalField(dot reflect.Value, fieldName string, node parse.Node,
        }
        hasArgs := len(args) > 1 || final.IsValid()
        // It's not a method; must be a field of a struct or an element of a map. The receiver must not be nil.
-       receiver, isNil := indirect(receiver)
        if isNil {
                s.errorf("nil pointer evaluating %s.%s", typ, fieldName)
        }