lib/trees: fixes old init
authorAlexandre Terrasa <alexandre@moz-code.org>
Fri, 12 Dec 2014 19:27:14 +0000 (14:27 -0500)
committerAlexandre Terrasa <alexandre@moz-code.org>
Fri, 12 Dec 2014 20:19:51 +0000 (15:19 -0500)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

lib/trees/bintree.nit

index 37d8c87..d11898f 100644 (file)
@@ -378,15 +378,11 @@ end
 class BinTreeNode[K: Comparable, E]
        super TreeNode[K, E]
 
-       private var prev: nullable BinTreeNode[K, E]
-       private var next: nullable BinTreeNode[K, E]
+       private var prev: nullable BinTreeNode[K, E] = null
+       private var next: nullable BinTreeNode[K, E] = null
 
        redef type N: BinTreeNode[K, E]
 
-       init(key: K, item: E) do
-               super(key, item)
-       end
-
        private var left_node: nullable N = null
 
        # `left` tree node child (null if node has no left child)
@@ -455,11 +451,10 @@ end
 private class BinTreeMapIterator[K: Comparable, E]
        super MapIterator[K, E]
 
-       var current: nullable BinTreeNode[K, E]
+       var tree: BinTreeMap[K, E]
+       var current: nullable BinTreeNode[K, E] = null
 
-       init(tree: BinTreeMap[K, E]) do
-               current = tree.first_node
-       end
+       init do current = tree.first_node
 
        redef fun is_ok do return not current == null
        redef fun next do current = current.next