Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

fix cpp blackberry target

  • Loading branch information...
commit 0ffa5a46a5395e431349d2221ccc944b1839c3e9 1 parent 5d0e380
Michael Baczynski authored
6 de/polygonal/ds/Array2.hx
View
@@ -906,7 +906,7 @@ class Array2<T> implements Collection<T>
*/
public function free():Void
{
- for (i in 0...size()) __set(i, cast null);
+ for (i in 0...size()) __set(i, null);
_a = null;
_iterator = null;
}
@@ -938,7 +938,7 @@ class Array2<T> implements Collection<T>
{
if (__get(i) == x)
{
- __set(i, cast null);
+ __set(i, null);
found = true;
}
}
@@ -953,7 +953,7 @@ class Array2<T> implements Collection<T>
*/
public function clear(purge = false):Void
{
- for (i in 0...size()) __set(i, cast null);
+ for (i in 0...size()) __set(i, null);
}
/**
6 de/polygonal/ds/Array3.hx
View
@@ -616,8 +616,7 @@ class Array3<T> implements Collection<T>
*/
public function free():Void
{
- var NULL:Null<T> = null;
- for (i in 0...size()) __set(i, NULL);
+ for (i in 0...size()) __set(i, null);
_a = null;
_iterator = null;
}
@@ -644,13 +643,12 @@ class Array3<T> implements Collection<T>
*/
public function remove(x:T):Bool
{
- var NULL:Null<T> = null;
var found = false;
for (i in 0...size())
{
if (__get(i) == x)
{
- __set(i, NULL);
+ __set(i, null);
found = true;
}
}
11 de/polygonal/ds/ArrayedQueue.hx
View
@@ -247,8 +247,7 @@ class ArrayedQueue<T> implements Queue<T>
D.assert(_t0 == _t1, 'dispose() is only allowed directly after dequeue()');
#end
- var NULL:Null<T> = null;
- __set((_front == 0 ? _capacity : _front) - 1, NULL);
+ __set((_front == 0 ? _capacity : _front) - 1, cast null);
}
/**
@@ -530,7 +529,6 @@ class ArrayedQueue<T> implements Queue<T>
{
if (isEmpty()) return false;
- var NULL:Null<T> = null;
var s = _size;
var found = false;
while (_size > 0)
@@ -541,7 +539,7 @@ class ArrayedQueue<T> implements Queue<T>
if (__get((i + _front) % _capacity) == x)
{
found = true;
- __set((i + _front) % _capacity, NULL);
+ __set((i + _front) % _capacity, cast null);
if (i == 0)
{
@@ -558,7 +556,7 @@ class ArrayedQueue<T> implements Queue<T>
for (j in i0...i1)
__set(j % _capacity, __get((j + 1) % _capacity));
- __set(i1 % _capacity, NULL);
+ __set(i1 % _capacity, cast null);
_size--;
}
@@ -599,8 +597,7 @@ class ArrayedQueue<T> implements Queue<T>
if (purge)
{
var i = _front;
- var NULL:Null<T> = null;
- for (j in 0..._size) __set(i++ % _capacity, NULL);
+ for (j in 0..._size) __set(i++ % _capacity, cast null);
if (_isResizable && _sizeLevel > 0)
{
12 de/polygonal/ds/ArrayedStack.hx
View
@@ -309,8 +309,7 @@ class ArrayedStack<T> implements Stack<T>
D.assert(_t0 == _t1, 'dispose() is only allowed directly after pop()');
#end
- var NULL:Null<T> = null;
- __set(_top, NULL);
+ __set(_top, cast null);
}
/**
@@ -541,8 +540,7 @@ class ArrayedStack<T> implements Stack<T>
*/
public function free():Void
{
- var NULL:Null<T> = null;
- for (i in 0..._a.length) __set(i, NULL);
+ for (i in 0..._a.length) __set(i, cast null);
_a = null;
_iterator = null;
}
@@ -570,7 +568,6 @@ class ArrayedStack<T> implements Stack<T>
{
if (isEmpty()) return false;
- var NULL:Null<T> = null;
var found = false;
while (_top > 0)
{
@@ -589,7 +586,7 @@ class ArrayedStack<T> implements Stack<T>
__cpy(p++, p);
#end
}
- __set(--_top, NULL);
+ __set(--_top, cast null);
found = true;
break;
}
@@ -610,8 +607,7 @@ class ArrayedStack<T> implements Stack<T>
{
if (purge)
{
- var NULL:Null<T> = null;
- for (i in 0..._a.length) __set(i, NULL);
+ for (i in 0..._a.length) __set(i, cast null);
}
_top = 0;
}
6 de/polygonal/ds/BinaryTreeNode.hx
View
@@ -652,8 +652,7 @@ class BinaryTreeNode<T> implements Collection<T>
if (hasL()) l.free();
if (hasR()) r.free();
- var NULL:Null<T> = null;
- val = NULL;
+ val = null;
r = l = p = null;
}
@@ -715,8 +714,7 @@ class BinaryTreeNode<T> implements Collection<T>
if (hasR()) r.clear(purge);
l = r = p = null;
- var NULL:Null<T> = null;
- val = NULL;
+ val = null;
}
else
{
9 de/polygonal/ds/DA.hx
View
@@ -844,8 +844,7 @@ class DA<T> implements Collection<T>
*/
public function free():Void
{
- var NULL:Null<T> = null;
- for (i in 0..._a.length) __set(i, NULL);
+ for (i in 0..._a.length) __set(i, cast null);
_a = null;
_iterator = null;
}
@@ -908,10 +907,8 @@ class DA<T> implements Collection<T>
inline public function clear(purge = false):Void
{
if (purge)
- {
- var NULL:Null<T> = null;
- for (i in 0..._a.length) __set(i, NULL);
- }
+ for (i in 0..._a.length)
+ __set(i, cast null);
_size = 0;
}
11 de/polygonal/ds/DLL.hx
View
@@ -126,8 +126,7 @@ class DLL<T> implements Collection<T>
if (reservedSize > 0)
{
- var NULL:Null<T> = null;
- _headPool = _tailPool = new DLLNode<T>(NULL, this);
+ _headPool = _tailPool = new DLLNode<T>(cast null, this);
}
head = tail = null;
@@ -1025,13 +1024,12 @@ class DLL<T> implements Collection<T>
*/
public function free():Void
{
- var NULL:Null<T> = null;
var node = head;
for (i in 0..._size)
{
var next = node.next;
node.next = node.prev = null;
- node.val = NULL;
+ node.val = cast null;
node = next;
}
head = tail = null;
@@ -1041,7 +1039,7 @@ class DLL<T> implements Collection<T>
{
var next = node.next;
node.next = null;
- node.val = NULL;
+ node.val = cast null;
node = next;
}
@@ -1656,8 +1654,7 @@ class DLL<T> implements Collection<T>
if (_reservedSize > 0 && _poolSize < _reservedSize)
{
_tailPool = _tailPool.next = x;
- var NULL:Null<T> = null;
- x.val = NULL;
+ x.val = cast null;
#if debug
D.assert(x.next == null, 'x.next == null');
3  de/polygonal/ds/DLLNode.hx
View
@@ -80,8 +80,7 @@ implements haxe.rtti.Generic
*/
public function free():Void
{
- var NULL:Null<T> = null;
- val = NULL;
+ val = cast null;
next = prev = null;
_list = null;
}
5 de/polygonal/ds/Graph.hx
View
@@ -1038,7 +1038,6 @@ class Graph<T> implements Collection<T>
*/
public function free():Void
{
- var NULL:Null<T> = null;
var node = _nodeList;
while (node != null)
{
@@ -1096,7 +1095,6 @@ class Graph<T> implements Collection<T>
public function remove(x:T):Bool
{
var found = false;
- var NULL:Null<T> = null;
var node = _nodeList;
while (node != null)
{
@@ -1105,7 +1103,7 @@ class Graph<T> implements Collection<T>
if (node.val == x)
{
unlink(node);
- node.val = NULL;
+ node.val = cast null;
node.next = node.prev = null;
node.arcList = null;
found = true;
@@ -1128,7 +1126,6 @@ class Graph<T> implements Collection<T>
{
if (purge)
{
- var NULL:Null<T> = null;
var node = _nodeList;
while (node != null)
{
3  de/polygonal/ds/GraphNode.hx
View
@@ -112,8 +112,7 @@ class GraphNode<T> implements Hashable
*/
public function free():Void
{
- var NULL:Null<T> = null;
- val = NULL;
+ val = cast null;
next = prev = null;
arcList = null;
_graph = null;
9 de/polygonal/ds/HashTable.hx
View
@@ -306,9 +306,8 @@ class HashTable<K:Hashable, T> implements Map<K, T>
*/
public function pack():Void
{
- var NULL:Null<T> = null;
for (i in 0...getCapacity())
- if (_keys[i] != null) _vals[i] = NULL;
+ if (_keys[i] != null) _vals[i] = cast null;
}
/**
@@ -544,10 +543,9 @@ class HashTable<K:Hashable, T> implements Map<K, T>
*/
public function free():Void
{
- var NULL:Null<T> = null;
for (i in 0...size())
{
- _vals[i] = NULL;
+ _vals[i] = cast null;
_keys[i] = null;
}
_vals = null;
@@ -613,12 +611,11 @@ class HashTable<K:Hashable, T> implements Map<K, T>
_h.clear(purge);
for (i in 0...getCapacity()) _keys[i] = null;
- var NULL:Null<T> = null;
if (purge)
{
for (i in 0...getCapacity())
{
- _vals[i] = NULL;
+ _vals[i] = cast null;
_keys[i] = null;
}
17 de/polygonal/ds/Heap.hx
View
@@ -158,8 +158,7 @@ class Heap<T:(Heapable<T>)> implements Collection<T>
else
_a = new Array<T>();
- var NULL:Null<T> = null;
- __set(0, cast NULL);
+ __set(0, cast null);
_size = 0;
_iterator = null;
@@ -180,10 +179,9 @@ class Heap<T:(Heapable<T>)> implements Collection<T>
_map.clear();
#end
- var NULL:Null<T> = null;
var tmp = _a;
_a = ArrayUtil.alloc(size() + 1);
- __set(0, NULL);
+ __set(0, cast null);
for (i in 1...size() + 1)
{
__set(i, tmp[i]);
@@ -192,7 +190,7 @@ class Heap<T:(Heapable<T>)> implements Collection<T>
_map.set(tmp[i], true);
#end
}
- for (i in size() + 1...tmp.length) tmp[i] = NULL;
+ for (i in size() + 1...tmp.length) tmp[i] = cast null;
}
/**
@@ -207,8 +205,7 @@ class Heap<T:(Heapable<T>)> implements Collection<T>
var tmp = _a;
_a = ArrayUtil.alloc(x + 1);
- var NULL:Null<T> = null;
- __set(0, cast NULL);
+ __set(0, cast null);
if (size() < x)
{
for (i in 1...size() + 1)
@@ -485,8 +482,7 @@ class Heap<T:(Heapable<T>)> implements Collection<T>
*/
public function free():Void
{
- var NULL:Null<T> = null;
- for (i in 0..._a.length) __set(i, NULL);
+ for (i in 0..._a.length) __set(i, cast null);
_a = null;
if (_iterator != null)
@@ -562,8 +558,7 @@ class Heap<T:(Heapable<T>)> implements Collection<T>
if (purge)
{
- var NULL:Null<T> = null;
- for (i in 1..._a.length) __set(i, NULL);
+ for (i in 1..._a.length) __set(i, cast null);
}
_size = 0;
}
19 de/polygonal/ds/LinkedDeque.hx
View
@@ -111,8 +111,7 @@ class LinkedDeque<T> implements Deque<T>
_head = null;
_tail = null;
_iterator = null;
- var NULL:Null<T> = null;
- _headPool = _tailPool = new LinkedDequeNode<T>(NULL);
+ _headPool = _tailPool = new LinkedDequeNode<T>(cast null);
reuseIterator = false;
}
@@ -399,13 +398,12 @@ class LinkedDeque<T> implements Deque<T>
*/
public function free():Void
{
- var NULL:Null<T> = null;
var node = _head;
while (node != null)
{
var next = node.next;
node.next = node.prev = null;
- node.val = NULL;
+ node.val = cast null;
node = next;
}
@@ -416,7 +414,7 @@ class LinkedDeque<T> implements Deque<T>
{
var next = node.next;
node.next = node.prev = null;
- node.val = NULL;
+ node.val = cast null;
node = next;
}
@@ -485,7 +483,6 @@ class LinkedDeque<T> implements Deque<T>
{
if (purge)
{
- var NULL:Null<T> = null;
var node = _head;
while (node != null)
{
@@ -501,7 +498,7 @@ class LinkedDeque<T> implements Deque<T>
{
var next = node.next;
node.next = node.prev = null;
- node.val = NULL;
+ node.val = cast null;
node = next;
}
}
@@ -614,9 +611,8 @@ class LinkedDeque<T> implements Deque<T>
copy._size = _size;
copy._reservedSize = _reservedSize;
copy._poolSize = _poolSize;
- var NULL:Null<T> = null;
- copy._headPool = new LinkedDequeNode<T>(NULL);
- copy._tailPool = new LinkedDequeNode<T>(NULL);
+ copy._headPool = new LinkedDequeNode<T>(cast null);
+ copy._tailPool = new LinkedDequeNode<T>(cast null);
if (assign)
{
@@ -750,8 +746,7 @@ class LinkedDeque<T> implements Deque<T>
if (nullify)
{
x.prev = x.next = null;
- var NULL:Null<T> = null;
- x.val = NULL;
+ x.val = cast null;
}
}
}
11 de/polygonal/ds/LinkedQueue.hx
View
@@ -118,8 +118,7 @@ class LinkedQueue<T> implements Queue<T>
if (reservedSize > 0)
{
- var NULL:Null<T> = null;
- _headPool = _tailPool = new LinkedQueueNode<T>(NULL);
+ _headPool = _tailPool = new LinkedQueueNode<T>(cast null);
}
else
{
@@ -372,13 +371,12 @@ class LinkedQueue<T> implements Queue<T>
*/
public function free():Void
{
- var NULL:Null<T> = null;
var node = _head;
while (node != null)
{
var next = node.next;
node.next = null;
- node.val = NULL;
+ node.val = cast null;
node = next;
}
@@ -389,7 +387,7 @@ class LinkedQueue<T> implements Queue<T>
{
var next = node.next;
node.next = null;
- node.val = NULL;
+ node.val = cast null;
node = next;
}
@@ -690,8 +688,7 @@ class LinkedQueue<T> implements Queue<T>
if (_reservedSize > 0 && _poolSize < _reservedSize)
{
_tailPool = _tailPool.next = x;
- var NULL:Null<T> = null;
- x.val = NULL;
+ x.val = cast null;
x.next = null;
_poolSize++;
}
13 de/polygonal/ds/LinkedStack.hx
View
@@ -115,8 +115,7 @@ class LinkedStack<T> implements Stack<T>
if (reservedSize > 0)
{
- var NULL:Null<T> = null;
- _headPool = _tailPool = new LinkedStackNode<T>(NULL);
+ _headPool = _tailPool = new LinkedStackNode<T>(cast null);
}
else
{
@@ -561,13 +560,12 @@ class LinkedStack<T> implements Stack<T>
*/
public function free():Void
{
- var NULL:Null<T> = null;
var node = _head;
while (node != null)
{
var next = node.next;
node.next = null;
- node.val = NULL;
+ node.val = cast null;
node = next;
}
@@ -578,7 +576,7 @@ class LinkedStack<T> implements Stack<T>
{
var next = node.next;
node.next = null;
- node.val = NULL;
+ node.val = cast null;
node = next;
}
@@ -615,8 +613,6 @@ class LinkedStack<T> implements Stack<T>
var node0 = _head;
var node1 = _head.next;
- var NULL:Null<T> = null;
-
while (node1 != null)
{
if (node1.val == x)
@@ -853,9 +849,8 @@ class LinkedStack<T> implements Stack<T>
if (_reservedSize > 0 && _poolSize < _reservedSize)
{
_tailPool = _tailPool.next = x;
- var NULL:Null<T> = null;
x.next = null;
- x.val = NULL;
+ x.val = cast null;
_poolSize++;
}
return val;
15 de/polygonal/ds/PriorityQueue.hx
View
@@ -161,8 +161,7 @@ class PriorityQueue<T:(Prioritizable)> implements Queue<T>
else
_a = new Array<T>();
- var NULL:Null<T> = null;
- __set(0, cast NULL);
+ __set(0, cast null);
_size = 0;
#if (debug && flash)
@@ -184,8 +183,7 @@ class PriorityQueue<T:(Prioritizable)> implements Queue<T>
var tmp = _a;
_a = ArrayUtil.alloc(size() + 1);
- var NULL:Null<T> = null;
- __set(0, cast NULL);
+ __set(0, cast null);
for (i in 1...size() + 1) __set(i, tmp[i]);
for (i in size() + 1...tmp.length) tmp[i] = null;
}
@@ -203,8 +201,7 @@ class PriorityQueue<T:(Prioritizable)> implements Queue<T>
_a = ArrayUtil.alloc(x + 1);
- var NULL:Null<T> = null;
- __set(0, cast NULL);
+ __set(0, cast null);
if (size() < x)
{
for (i in 1...size() + 1)
@@ -422,8 +419,7 @@ class PriorityQueue<T:(Prioritizable)> implements Queue<T>
*/
public function free():Void
{
- var NULL:Null<T> = null;
- for (i in 0..._a.length) __set(i, NULL);
+ for (i in 0..._a.length) __set(i, cast null);
_a = null;
if (_iterator != null)
@@ -497,8 +493,7 @@ class PriorityQueue<T:(Prioritizable)> implements Queue<T>
{
if (purge)
{
- var NULL:Null<T> = null;
- for (i in 1..._a.length) __set(i, NULL);
+ for (i in 1..._a.length) __set(i, cast null);
}
#if (debug && flash)
11 de/polygonal/ds/SLL.hx
View
@@ -123,8 +123,7 @@ class SLL<T> implements Collection<T>
if (reservedSize > 0)
{
- var NULL:Null<T> = null;
- _headPool = _tailPool = new SLLNode<T>(NULL, this);
+ _headPool = _tailPool = new SLLNode<T>(cast null, this);
}
head = tail = null;
@@ -865,13 +864,12 @@ class SLL<T> implements Collection<T>
*/
public function free():Void
{
- var NULL:Null<T> = null;
var node = head;
for (i in 0..._size)
{
var next = node.next;
node.next = null;
- node.val = NULL;
+ node.val = cast null;
node = next;
}
head = tail = null;
@@ -881,7 +879,7 @@ class SLL<T> implements Collection<T>
{
var next = node.next;
node.next = null;
- node.val = NULL;
+ node.val = cast null;
node = next;
}
@@ -1451,8 +1449,7 @@ class SLL<T> implements Collection<T>
#end
_tailPool = _tailPool.next = x;
- var NULL:Null<T> = null;
- x.val = NULL;
+ x.val = cast null;
x.next = null;
_poolSize++;
}
3  de/polygonal/ds/SLLNode.hx
View
@@ -75,8 +75,7 @@ implements haxe.rtti.Generic
*/
public function free():Void
{
- var NULL:Null<T> = null;
- val = NULL;
+ val = cast null;
next = null;
}
12 de/polygonal/ds/TreeNode.hx
View
@@ -1928,8 +1928,7 @@ class TreeNode<T> implements Collection<T>
}
}
- var NULL:Null<T> = null;
- val = NULL;
+ val = cast null;
prev = null;
next = null;
children = null;
@@ -2001,11 +2000,10 @@ class TreeNode<T> implements Collection<T>
node = hook;
}
- var NULL:Null<T> = null;
- val = NULL;
- parent = null;
- children = null;
- _tail = null;
+ val = cast null;
+ parent = null;
+ children = null;
+ _tail = null;
}
else
children = null;
11 test/TestArray2.hx
View
@@ -29,9 +29,14 @@ class TestArray2 extends haxe.unit.TestCase
var success = a.remove(1);
assertEquals(true, success);
- assertEquals(#if (js || neko) null #else 0 #end, a.get(0, 0));
- assertEquals(#if (js || neko) null #else 0 #end, a.get(1, 1));
- assertEquals(#if (js || neko) null #else 0 #end, a.get(2, 2));
+ var x = a.get(0, 0);
+ assertEquals(#if (js || neko) null #else 0 #end, x);
+
+ var x = a.get(1, 1);
+ assertEquals(#if (js || neko) null #else 0 #end, x);
+
+ var x = a.get(2, 2);
+ assertEquals(#if (js || neko) null #else 0 #end, x);
}
function testIndexOf()
11 test/TestArray3.hx
View
@@ -29,9 +29,14 @@ class TestArray3 extends haxe.unit.TestCase
var k = a.remove(1);
assertEquals(k, true);
- assertEquals(#if (js || neko) null #else 0 #end, a.get(0, 0, 0));
- assertEquals(#if (js || neko) null #else 0 #end, a.get(1, 1, 1));
- assertEquals(#if (js || neko) null #else 0 #end, a.get(2, 2, 2));
+ var x = a.get(0, 0, 0);
+ assertEquals(#if (js || neko) null #else 0 #end, x);
+
+ var x = a.get(1, 1, 1);
+ assertEquals(#if (js || neko) null #else 0 #end, x);
+
+ var x = a.get(2, 2, 2);
+ assertEquals(#if (js || neko) null #else 0 #end, x);
}
function testIndexOf()
2  test/TestArrayedStack.hx
View
@@ -341,7 +341,7 @@ class TestArrayedStack extends haxe.unit.TestCase
stack.pop();
stack.dispose();
var x = untyped stack._a[stack._top];
- assertEquals(null, x);
+ assertEquals(#if (flash && generic) 0 #else null #end, x);
}
function testIterator()
6 test/UnitTest.hx
View
@@ -22,10 +22,8 @@ class UnitTest extends haxe.unit.TestRunner
#end
#end
- //cpp crash with dce-no, cpp + generic fails compiling
-
- add(new TestArray2()); //cpp and --no-inline: testRemove() fails
- add(new TestArray3()); //cpp and --no-inline: testRemove() fails
+ add(new TestArray2());
+ add(new TestArray3());
add(new TestArrayedDeque());
add(new TestArrayedQueue());
add(new TestArrayedStack());
Please sign in to comment.
Something went wrong with that request. Please try again.