| Issue 71: | object comparison fails | |
| 1 person starred this issue and may be notified of changes. | Back to list |
Below is a simple binary tree, where the Node#unlink method fails.
Tested with haXe+hxcpp from svn.
class Main
{
static var _app:Main;
public static function main():Void
{
var node = new Node('root');
node.setL('e1');
node.setR('e2');
node.left.unlink(); //failure
}
}
class Node
{
public var val:String;
public var parent:Node;
public var left:Node;
public var right:Node;
public function new(x:String)
{
this.val = x;
}
public function setL(x:String):Void
{
if (left == null)
{
left = new Node(x);
left.parent = this;
}
else
left.val = x;
}
public function setR(x:String):Void
{
if (right == null)
{
right = new Node(x);
right.parent = this;
}
else
right.val = x;
}
public function unlink():Void
{
trace(this == parent.left); //should be true
trace(this == parent.right); //should be true
}
}
Oct 15, 2010
#1
Andy.onthewings
Jan 17, 2011
Fixed on SVN
Status:
Fixed
Jan 20, 2011
I presume the last line should be false: left.parent.right!=left |