]> Cypherpunks repositories - gostls13.git/commitdiff
go/types: fix Eval to use correct file set when evaluating an expression
authorRobert Griesemer <gri@golang.org>
Mon, 15 Jun 2015 19:49:45 +0000 (12:49 -0700)
committerRobert Griesemer <gri@golang.org>
Mon, 15 Jun 2015 20:11:58 +0000 (20:11 +0000)
This is https://go-review.googlesource.com/10999 which we could not apply
in x/tools/go/types because we must not rely on 1.5 features in that repo
yet.

Change-Id: I9a57cdb7ad4051df278d1fbed90c736df50f426f
Reviewed-on: https://go-review.googlesource.com/11125
Reviewed-by: Alan Donovan <adonovan@google.com>
src/go/types/eval.go

index c09f2a3ba4e96510cbc5b1eed2b8caea7bb0084f..7b42ff1a9d075d4be8c20cf0fb01c176190accf9 100644 (file)
@@ -65,11 +65,7 @@ func Eval(fset *token.FileSet, pkg *Package, pos token.Pos, expr string) (tv Typ
        }
 
        // parse expressions
-       // BUG(gri) In case of type-checking errors below, the type checker
-       //          doesn't have the correct file set for expr. The correct
-       //          solution requires a ParseExpr that uses the incoming
-       //          file set fset.
-       node, err := parser.ParseExpr(expr)
+       node, err := parser.ParseExprFrom(fset, "eval", expr, 0)
        if err != nil {
                return TypeAndValue{}, err
        }