mirror of
https://github.com/go-delve/delve.git
synced 2025-10-30 02:07:58 +08:00
proc: refactor identifier evaluation for range-over-func support (#3738)
Because of how range-over-func is implemented it is difficult to determine the set of visible local variables during expression compilation (i.e. it is difficulto to keep the HasLocal function correct). This commit moves that logic from expression compilation to expression evaluation. Updates #3733
This commit is contained in:
committed by
GitHub
parent
cce54c0992
commit
4b628b81cb
@ -820,9 +820,9 @@ func getEvalExpressionTestCases() []varTest {
|
||||
{"afunc(2)", false, "", "", "", errors.New("function calls not allowed without using 'call'")},
|
||||
{"(afunc)(2)", false, "", "", "", errors.New("function calls not allowed without using 'call'")},
|
||||
{"(*afunc)(2)", false, "", "", "", errors.New("expression \"afunc\" (func()) can not be dereferenced")},
|
||||
{"unknownthing(2)", false, "", "", "", errors.New("could not evaluate function or type unknownthing: could not find symbol value for unknownthing")},
|
||||
{"(*unknownthing)(2)", false, "", "", "", errors.New("could not evaluate function or type (*unknownthing): could not find symbol value for unknownthing")},
|
||||
{"(*strings.Split)(2)", false, "", "", "", errors.New("could not evaluate function or type (*strings.Split): could not find symbol value for strings")},
|
||||
{"unknownthing(2)", false, "", "", "", errors.New("could not find symbol value for unknownthing")},
|
||||
{"(*unknownthing)(2)", false, "", "", "", errors.New("could not find symbol value for unknownthing")},
|
||||
{"(*strings.Split)(2)", false, "", "", "", errors.New("could not find symbol value for strings")},
|
||||
|
||||
// pretty printing special types
|
||||
{"tim1", false, `time.Time(1977-05-25T18:00:00Z)…`, `time.Time(1977-05-25T18:00:00Z)…`, "time.Time", nil},
|
||||
@ -1195,7 +1195,7 @@ func TestCallFunction(t *testing.T) {
|
||||
{`stringsJoin(nil, "")`, []string{`:string:""`}, nil},
|
||||
{`stringsJoin(stringslice, comma)`, []string{`:string:"one,two,three"`}, nil},
|
||||
{`stringsJoin(stringslice, "~~")`, []string{`:string:"one~~two~~three"`}, nil},
|
||||
{`stringsJoin(s1, comma)`, nil, errors.New(`error evaluating "s1" as argument 1 in function stringsJoin: could not find symbol value for s1`)},
|
||||
{`stringsJoin(s1, comma)`, nil, errors.New(`could not find symbol value for s1`)},
|
||||
{`stringsJoin(intslice, comma)`, nil, errors.New("can not convert value of type []int to []string")},
|
||||
{`noreturncall(2)`, nil, nil},
|
||||
|
||||
@ -1295,11 +1295,11 @@ func TestCallFunction(t *testing.T) {
|
||||
}
|
||||
|
||||
var testcasesBefore114After112 = []testCaseCallFunction{
|
||||
{`strings.Join(s1, comma)`, nil, errors.New(`error evaluating "s1" as argument 1 in function strings.Join: could not find symbol value for s1`)},
|
||||
{`strings.Join(s1, comma)`, nil, errors.New(`could not find symbol value for s1`)},
|
||||
}
|
||||
|
||||
var testcases114 = []testCaseCallFunction{
|
||||
{`strings.Join(s1, comma)`, nil, errors.New(`error evaluating "s1" as argument 1 in function strings.Join: could not find symbol value for s1`)},
|
||||
{`strings.Join(s1, comma)`, nil, errors.New(`could not find symbol value for s1`)},
|
||||
}
|
||||
|
||||
var testcases117 = []testCaseCallFunction{
|
||||
|
||||
Reference in New Issue
Block a user