Merge branch 'recursive-flatten' of https://github.com/benblank/OpenComputers into master-MC1.7.10

This commit is contained in:
Florian Nücke 2015-02-09 16:20:13 +01:00
commit 30e37daba6

View File

@ -146,11 +146,6 @@ private[oc] object Registry extends api.detail.DriverAPI {
memo += arg -> null memo += arg -> null
null null
} }
else if (converted.size == 1 && converted.containsKey("oc:flatten")) {
val value = converted.get("oc:flatten")
memo += arg -> value // Update memoization map.
value
}
else { else {
// This is a little nasty but necessary because we need to keep the // This is a little nasty but necessary because we need to keep the
// 'converted' value up-to-date for any reference created to it in // 'converted' value up-to-date for any reference created to it in
@ -163,10 +158,17 @@ private[oc] object Registry extends api.detail.DriverAPI {
memo += converted -> converted // Makes convertMap re-use the map. memo += converted -> converted // Makes convertMap re-use the map.
convertRecursively(converted, memo, force = true) convertRecursively(converted, memo, force = true)
memo -= converted memo -= converted
if (converted.size == 1 && converted.containsKey("oc:flatten")) {
val value = converted.get("oc:flatten")
memo += arg -> value // Update memoization map.
value
}
else {
converted converted
} }
} }
} }
}
def convertList(obj: AnyRef, list: Iterator[(Any, Int)], memo: util.IdentityHashMap[AnyRef, AnyRef]) = { def convertList(obj: AnyRef, list: Iterator[(Any, Int)], memo: util.IdentityHashMap[AnyRef, AnyRef]) = {
val converted = mutable.ArrayBuffer.empty[AnyRef] val converted = mutable.ArrayBuffer.empty[AnyRef]