Pos returns the location of the AST token most closely associated with the operation that gave rise to this value, or token.NoPos if it was not explicit in the source.

For each ast.Node type, a particular token is designated as the closest location for the expression, e.g. the Lparen for an *ast.CallExpr. This permits a compact but approximate mapping from Values to source positions for use in diagnostic messages, for example.

(Do not use this position to determine which Value corresponds to an ast.Expr; use Function.ValueForExpr instead. NB: it requires that the function was built with debug information.)

Pos is referenced in 12 repositories