proc/variables: Split address calculations from value extraction

Refactored variables.go to separate calculation of a variable's address from
reading its value. This change is useful to implement the 'set' command
as well as the evaluation of more complex expressions (in the future).
This commit is contained in:
aarzilli
2015-09-28 11:17:27 +02:00
parent bba999b985
commit 8d920931e1
2 changed files with 261 additions and 232 deletions

View File

@ -58,8 +58,8 @@ func TestVariableEvaluation(t *testing.T) {
{"baz", "bazburzum", "struct string", nil},
{"neg", "-1", "int", nil},
{"f32", "1.2", "float32", nil},
{"c64", "(1, 2i)", "complex64", nil},
{"c128", "(2, 3i)", "complex128", nil},
{"c64", "(1 + 2i)", "complex64", nil},
{"c128", "(2 + 3i)", "complex128", nil},
{"a6.Baz", "8", "int", nil},
{"a7.Baz", "5", "int", nil},
{"a8.Baz", "feh", "struct string", nil},
@ -181,8 +181,8 @@ func TestLocalVariables(t *testing.T) {
{"b1", "true", "bool", nil},
{"b2", "false", "bool", nil},
{"ba", "[]int len: 200, cap: 200, [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,...+136 more]", "struct []int", nil},
{"c128", "(2, 3i)", "complex128", nil},
{"c64", "(1, 2i)", "complex64", nil},
{"c128", "(2 + 3i)", "complex128", nil},
{"c64", "(1 + 2i)", "complex64", nil},
{"f", "main.barfoo", "func()", nil},
{"f32", "1.2", "float32", nil},
{"i32", "[2]int32 [1,2]", "[2]int32", nil},