diff options
author | Adam Scarr <adam@vektah.net> | 2017-08-13 17:30:10 +1000 |
---|---|---|
committer | Adam Scarr <adam@vektah.net> | 2017-08-13 18:56:23 +1000 |
commit | 5716ddb5e7ca3cb4ee445bdd4958c37aeb033baa (patch) | |
tree | a5d5017dbf1078220ceef24d9ea9432b33972291 /json | |
parent | 0dc37ae5bc10cc0669f88ab9febbc039a28f23d1 (diff) |
Pass result in instead of returning
Diffstat (limited to 'json')
-rw-r--r-- | json/json.go | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/json/json.go b/json/json.go index 7cc53a1..9b1e8e9 100644 --- a/json/json.go +++ b/json/json.go @@ -13,22 +13,22 @@ var ( _number = NumberLit() _properties = Some(Seq(StringLit(`"`), ":", &_value), ",") - _array = Seq("[", Cut(), Some(&_value, ","), "]").Map(func(n Result) Result { + _array = Seq("[", Cut(), Some(&_value, ","), "]").Map(func(n *Result) { ret := []interface{}{} for _, child := range n.Child[2].Child { ret = append(ret, child.Result) } - return Result{Result: ret} + n.Result = ret }) - _object = Seq("{", Cut(), _properties, "}").Map(func(n Result) Result { + _object = Seq("{", Cut(), _properties, "}").Map(func(n *Result) { ret := map[string]interface{}{} for _, prop := range n.Child[2].Child { ret[prop.Child[0].Result.(string)] = prop.Child[2].Result } - return Result{Result: ret} + n.Result = ret }) ) |