Fix xml-importer & pitchmap/indexer

This commit is contained in:
Rafael Weinstein
2015-12-15 21:33:44 -08:00
parent eeea1e2056
commit 9b107c145f
4 changed files with 10 additions and 9 deletions
+7 -6
View File
@@ -33,23 +33,24 @@ func NomsValueFromDecodedJSON(cs chunks.ChunkStore, o interface{}) types.Value {
case nil:
return nil
case []interface{}:
out := types.NewList(cs)
items := make([]types.Value, 0, len(o))
for _, v := range o {
nv := NomsValueFromDecodedJSON(cs, v)
if nv != nil {
out = out.Append(nv)
items = append(items, nv)
}
}
return out
return types.NewList(cs, items...)
case map[string]interface{}:
out := NewMapOfStringToValue(cs)
outDef := MapOfStringToValueDef{}
for k, v := range o {
nv := NomsValueFromDecodedJSON(cs, v)
if nv != nil {
out = out.Set(k, nv)
outDef[k] = nv
}
}
return out
return outDef.New(cs)
default:
d.Chk.Fail("Nomsification failed.", "I don't understand %+v, which is of type %s!\n", o, reflect.TypeOf(o).String())
}
+1 -1
View File
@@ -67,7 +67,7 @@ func (cl compoundList) cursorAt(idx uint64) (*sequenceCursor, listLeaf, uint64)
return idx < offset, offset
}, uint64(0))
if current := cursor.current().(metaTuple); current.ref != leaf.Ref() {
if current := cursor.current().(metaTuple); current.ref != valueFromType(cl.cs, leaf, leaf.Type()).Ref() {
leaf = readMetaTupleValue(cursor.current(), cl.cs)
}
+1 -1
View File
@@ -63,7 +63,7 @@ func (cm compoundMap) findLeaf(key Value) (*sequenceCursor, mapLeaf) {
cursor.seekBinary(seekFn)
current := cursor.current().(metaTuple)
if current.ref != leaf.Ref() {
if current.ref != valueFromType(cm.cs, leaf, leaf.Type()).Ref() {
leaf = readMetaTupleValue(cursor.current(), cm.cs)
}
+1 -1
View File
@@ -89,7 +89,7 @@ func (cs compoundSet) findLeaf(key Value) (*sequenceCursor, setLeaf) {
cursor.seekBinary(seekFn)
current := cursor.current().(metaTuple)
if current.ref != leaf.Ref() {
if current.ref != valueFromType(cs.cs, leaf, leaf.Type()).Ref() {
leaf = readMetaTupleValue(cursor.current(), cs.cs)
}