go/types: fix Eval to use correct file set when evaluating an expression
Change-Id: I221bd26cc90755de57c8f1941cabddd14d56584d Reviewed-on: https://go-review.googlesource.com/10999 Reviewed-by: Alan Donovan <adonovan@google.com>
This commit is contained in:
parent
85ad76014a
commit
d241a1448b
|
@ -65,11 +65,7 @@ func Eval(fset *token.FileSet, pkg *Package, pos token.Pos, expr string) (tv Typ
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse expressions
|
// parse expressions
|
||||||
// BUG(gri) In case of type-checking errors below, the type checker
|
node, err := parser.ParseExprFrom(fset, "eval", expr, 0)
|
||||||
// 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)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return TypeAndValue{}, err
|
return TypeAndValue{}, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue