Commit f8931c6c authored by David Symonds's avatar David Symonds

Bug 143 is fixed, so clean up some of exvar.

R=r
APPROVED=r
DELTA=8  (3 added, 1 deleted, 4 changed)
OCL=27699
CL=27701
parent 227fe8c5
...@@ -130,8 +130,7 @@ func IncrementInt(name string, inc int) { ...@@ -130,8 +130,7 @@ func IncrementInt(name string, inc int) {
func IncrementMapInt(name string, key string, inc int) { func IncrementMapInt(name string, key string, inc int) {
workSync(func(state *exVars) { workSync(func(state *exVars) {
mv := state.getOrInitMapVar(name); mv := state.getOrInitMapVar(name);
// TODO(dsymonds): Change this to just mv[key] when bug143 is fixed. if v, ok := mv[key]; ok {
if v, ok := (*mv)[key]; ok {
mv[key] += inc mv[key] += inc
} else { } else {
mv[key] = inc mv[key] = inc
...@@ -167,9 +166,12 @@ func GetMapInt(name string, key string) int { ...@@ -167,9 +166,12 @@ func GetMapInt(name string, key string) int {
var i int; var i int;
var ok bool; var ok bool;
workSync(func(state *exVars) { workSync(func(state *exVars) {
// TODO(dsymonds): Change this to just getOrInitMapVar(name)[key] when // This doesn't work:
// bug143 is fixed. // i, ok = state.getOrInitMapVar(name)[key];
i, ok = (*state.getOrInitMapVar(name))[key]; // exvar.go:169: assignment count mismatch: 2 = 1
// Should it? Wrapping the method call in () doesn't help.
mv := state.getOrInitMapVar(name);
i, ok = mv[key];
}); });
return i return i
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment