Skip to content

Commit 0b4861a

Browse files
committed
fix null analysis issues on Haxe 4.3
1 parent e5b586b commit 0b4861a

File tree

3 files changed

+8
-8
lines changed

3 files changed

+8
-8
lines changed

src/hx/concurrent/collection/SynchronizedLinkedList.hx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ private class SynchronizedLinkedListImpl<T> implements OrderedCollection<T> {
325325
var i = 0;
326326
var foundAt = -1;
327327
for (item in _items) {
328+
#if (haxe_ver >= 4.3) @:nullSafety(Off) #end
328329
if (startAt != null && i > startAt)
329330
break;
330331
if (item == x)

src/hx/concurrent/executor/ThreadPoolExecutor.hx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,12 @@ class ThreadPoolExecutor extends Executor {
120120
}
121121

122122

123-
public function submit<T>(task:Either2<Void->T,Void->Void>, ?schedule:Schedule):TaskFuture<T>
123+
public function submit<T>(task:Either2<Void->T,Void->Void>, ?schedule:Schedule):TaskFuture<T> {
124+
final schedule:Schedule = schedule == null ? Executor.NOW_ONCE : schedule;
124125
return _stateLock.execute(function() {
125126
if (state != RUNNING)
126127
throw 'Cannot accept new tasks. Executor is not in state [RUNNING] but [$state].';
127128

128-
if (schedule == null)
129-
schedule = Executor.NOW_ONCE;
130-
131129
final future = new TaskFutureImpl<T>(this, task, schedule);
132130

133131
// skip round-trip via scheduler for one-shot tasks that should be executed immediately
@@ -143,6 +141,7 @@ class ThreadPoolExecutor extends Executor {
143141
_newScheduledTasks.push(future);
144142
return future;
145143
});
144+
}
146145

147146

148147
override //

src/hx/concurrent/executor/TimerExecutor.hx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66
package hx.concurrent.executor;
77

8-
import hx.concurrent.Future.FutureResult;
98
import hx.concurrent.executor.Executor.AbstractTaskFuture;
109
import hx.concurrent.executor.Executor.Task;
1110
import hx.concurrent.executor.Executor.TaskFuture;
@@ -30,7 +29,8 @@ class TimerExecutor extends Executor {
3029
}
3130

3231

33-
public function submit<T>(task:Either2<Void->T, Void->Void>, ?schedule:Schedule):TaskFuture<T>
32+
public function submit<T>(task:Either2<Void->T, Void->Void>, ?schedule:Schedule):TaskFuture<T> {
33+
final schedule:Schedule = schedule == null ? Executor.NOW_ONCE : schedule;
3434
return _stateLock.execute(function() {
3535
if (state != RUNNING)
3636
throw 'Cannot accept new tasks. Executor is not in state [RUNNING] but [$state].';
@@ -40,14 +40,14 @@ class TimerExecutor extends Executor {
4040
while (i-- > 0)
4141
if (_scheduledTasks[i].isStopped) _scheduledTasks.splice(i, 1);
4242

43-
final future = new TaskFutureImpl<T>(this, task, schedule == null ? Executor.NOW_ONCE : schedule);
43+
final future = new TaskFutureImpl<T>(this, task, schedule);
4444
switch (schedule) {
4545
case ONCE(0):
4646
default: _scheduledTasks.push(future);
4747
}
4848
return future;
4949
});
50-
50+
}
5151

5252
override //
5353
function onStop() {

0 commit comments

Comments
 (0)