提交 04834a78 编写于 作者: A Alessandro Arzilli 提交者: Derek Parker

proc: save location expr and decl line for escaped variables (#1553)

Copy the location expression and declaration line of escaped variables
when auto-dereferencing them.
上级 c30a333f
......@@ -2287,12 +2287,16 @@ func (scope *EvalScope) Locals() ([]*Variable, error) {
for i, v := range vars {
if name := v.Name; len(name) > 1 && name[0] == '&' {
locationExpr := v.LocationExpr
declLine := v.DeclLine
v = v.maybeDereference()
if v.Addr == 0 {
v.Unreadable = fmt.Errorf("no address for escaped variable")
}
v.Name = name[1:]
v.Flags |= VariableEscaped
v.LocationExpr = locationExpr + " (escaped)"
v.DeclLine = declLine
vars[i] = v
}
if hasScopes {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册