Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
pubx
delve
提交
1aa83e30
D
delve
项目概览
pubx
/
delve
通知
0
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
delve
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
1aa83e30
编写于
12月 20, 2015
作者:
A
aarzilli
提交者:
Derek Parker
12月 26, 2015
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
proc/variables: bugfix: nil pointer with interfaces to functions
Fixes #325
上级
8872b53e
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
28 addition
and
3 deletion
+28
-3
_fixtures/testvariables3.go
_fixtures/testvariables3.go
+10
-1
proc/proc_test.go
proc/proc_test.go
+14
-0
proc/types.go
proc/types.go
+4
-2
未找到文件。
_fixtures/testvariables3.go
浏览文件 @
1aa83e30
...
...
@@ -25,6 +25,13 @@ func afunc(x int) int {
return
x
+
2
}
func
afunc1
(
x
int
)
{
}
func
afunc2
()
int
{
return
0
}
type
functype
func
(
int
)
int
func
(
a
*
astruct
)
Error
()
string
{
...
...
@@ -125,6 +132,8 @@ func main() {
recursive1
:=
dstruct
{}
recursive1
.
x
=
&
recursive1
var
iface5
interface
{}
=
&
recursive1
var
iface2fn1
interface
{}
=
afunc1
var
iface2fn2
interface
{}
=
afunc2
var
amb1
=
1
runtime
.
Breakpoint
()
...
...
@@ -132,5 +141,5 @@ func main() {
fmt
.
Println
(
amb1
)
}
runtime
.
Breakpoint
()
fmt
.
Println
(
i1
,
i2
,
i3
,
p1
,
amb1
,
s1
,
s3
,
a1
,
p2
,
p3
,
s2
,
as1
,
str1
,
f1
,
fn1
,
fn2
,
nilslice
,
nilptr
,
ch1
,
chnil
,
m1
,
mnil
,
m2
,
m3
,
up1
,
i4
,
i5
,
i6
,
err1
,
err2
,
errnil
,
iface1
,
iface2
,
ifacenil
,
arr1
,
parr
,
cpx1
,
const1
,
iface3
,
iface4
,
recursive1
,
recursive1
.
x
,
iface5
)
fmt
.
Println
(
i1
,
i2
,
i3
,
p1
,
amb1
,
s1
,
s3
,
a1
,
p2
,
p3
,
s2
,
as1
,
str1
,
f1
,
fn1
,
fn2
,
nilslice
,
nilptr
,
ch1
,
chnil
,
m1
,
mnil
,
m2
,
m3
,
up1
,
i4
,
i5
,
i6
,
err1
,
err2
,
errnil
,
iface1
,
iface2
,
ifacenil
,
arr1
,
parr
,
cpx1
,
const1
,
iface3
,
iface4
,
recursive1
,
recursive1
.
x
,
iface5
,
iface2fn1
,
iface2fn2
)
}
proc/proc_test.go
浏览文件 @
1aa83e30
...
...
@@ -1063,3 +1063,17 @@ func TestIssue316(t *testing.T) {
assertNoError
(
err
,
t
,
"EvalVariable()"
)
})
}
func
TestIssue325
(
t
*
testing
.
T
)
{
// nil pointer dereference when evaluating interfaces to function pointers
withTestProcess
(
"testvariables3"
,
t
,
func
(
p
*
Process
,
fixture
protest
.
Fixture
)
{
assertNoError
(
p
.
Continue
(),
t
,
"Continue()"
)
iface2fn1v
,
err
:=
evalVariable
(
p
,
"iface2fn1"
)
assertNoError
(
err
,
t
,
"EvalVariable()"
)
t
.
Logf
(
"iface2fn1: %v
\n
"
,
iface2fn1v
)
iface2fn2v
,
err
:=
evalVariable
(
p
,
"iface2fn2"
)
assertNoError
(
err
,
t
,
"EvalVariable()"
)
t
.
Logf
(
"iface2fn2: %v
\n
"
,
iface2fn2v
)
})
}
proc/types.go
浏览文件 @
1aa83e30
...
...
@@ -98,8 +98,10 @@ func (dbp *Process) expandPackagesInType(expr ast.Expr) {
for
i
:=
range
e
.
Params
.
List
{
dbp
.
expandPackagesInType
(
e
.
Params
.
List
[
i
]
.
Type
)
}
for
i
:=
range
e
.
Results
.
List
{
dbp
.
expandPackagesInType
(
e
.
Results
.
List
[
i
]
.
Type
)
if
e
.
Results
!=
nil
{
for
i
:=
range
e
.
Results
.
List
{
dbp
.
expandPackagesInType
(
e
.
Results
.
List
[
i
]
.
Type
)
}
}
case
*
ast
.
MapType
:
dbp
.
expandPackagesInType
(
e
.
Key
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录