浏览代码

fix unity compile error

/main
siyao 3 年前
当前提交
40e92f39
共有 6 个文件被更改,包括 19 次插入19 次删除
  1. 8
      com.unity.uiwidgets/Runtime/async/broadcast_stream_controller.cs
  2. 2
      com.unity.uiwidgets/Runtime/async/stopwatch.cs
  3. 4
      com.unity.uiwidgets/Runtime/async/stream.cs
  4. 6
      com.unity.uiwidgets/Runtime/async/stream_controller.cs
  5. 16
      com.unity.uiwidgets/Runtime/async/stream_impl.cs
  6. 2
      com.unity.uiwidgets/Runtime/async/stream_transformers.cs

8
com.unity.uiwidgets/Runtime/async/broadcast_stream_controller.cs


public override StreamSubscription<T> _subscribe(
Action<T> onData, Action<object, string> onError, Action onDone, bool cancelOnError) {
if (isClosed) {
onDone ??= _stream._nullDoneHandler;
onDone = onDone ?? _stream._nullDoneHandler;
return new _DoneStreamSubscription<T>(() => onDone());
}

stackTrace = replacement.StackTrace;
}
stackTrace ??= AsyncError.defaultStackTrace(error);
stackTrace = stackTrace ?? AsyncError.defaultStackTrace(error);
_sendError(error, stackTrace);
}

}
void _addPendingEvent(_DelayedEvent<T> evt) {
_pending ??= new _StreamImplEvents<T>();
_pending = _pending ?? new _StreamImplEvents<T>();
_pending.add(evt);
}

void addError(object error, string stackTrace) {
// ArgumentError.checkNotNull(error, "error");
stackTrace ??= AsyncError.defaultStackTrace(error);
stackTrace = stackTrace ?? AsyncError.defaultStackTrace(error);
if (!isClosed && _isFiring) {
_addPendingEvent(new _DelayedError<T>((Exception) error, stackTrace));
return;

2
com.unity.uiwidgets/Runtime/async/stopwatch.cs


}
public void stop() {
_stop ??= _now();
_stop = _stop ?? _now();
}
public void reset() {

4
com.unity.uiwidgets/Runtime/async/stream.cs


Action startPeriodicTimer = () => {
D.assert(timer == null);
timer = Timer.periodic(period, (object timer) => {
timer = Timer.periodic(period, (object timer1) => {
sendEvent();
return null;
});

return;
}
if (newValue is Future<E> newFuture) {
if (newValue.f is Future<E> newFuture) { // siyao: this if different from dart
subscription.pause();
newFuture
.then(d => add((E) d), onError: (e) => {

6
com.unity.uiwidgets/Runtime/async/stream_controller.cs


_StreamImplEvents<T> _ensurePendingEvents() {
D.assert(_isInitialState);
if (!_isAddingStream) {
_varData ??= new _StreamImplEvents<T>();
_varData = _varData ?? new _StreamImplEvents<T>();
return (_StreamImplEvents<T>) _varData;
}

}
Future _ensureDoneFuture() {
_doneFuture ??= _isCanceled ? Future._nullFuture : new _Future();
_doneFuture = _doneFuture ?? (_isCanceled ? Future._nullFuture : new _Future());
return _doneFuture;
}

// stackTrace = replacement.stackTrace;
}
stackTrace ??= AsyncError.defaultStackTrace(error);
stackTrace = stackTrace ?? AsyncError.defaultStackTrace(error);
_addError(error, stackTrace);
}

16
com.unity.uiwidgets/Runtime/async/stream_impl.cs


// StreamSubscription interface.
public override void onData(Action<T> handleData) {
handleData ??= _stream._nullDataHandler;
handleData = handleData ?? _stream._nullDataHandler;
// TODO(floitsch): the return type should be 'void', and the type
// should be inferred.
_onData = d => _zone.registerUnaryCallback(data => {

// Siyao: c# does not support convert action
public override void onError(Action<object, string> handleError) {
handleError ??= (input1, input2) => _stream._nullErrorHandler(null);
handleError = handleError ?? ((input1, input2) => _stream._nullErrorHandler(null));
_onError = (_, __) => _zone
.registerBinaryCallback((in1, in2) => {

}
public override void onDone(Action handleDone) {
handleDone ??= _stream._nullDoneHandler;
handleDone = handleDone ?? _stream._nullDoneHandler;
_onDone = () => _zone.registerCallback(() => {
handleDone();
return null;

D.assert(!_inCallback);
bool wasInputPaused = _isInputPaused;
_state |= _STATE_IN_CALLBACK;
_zone.runUnaryGuarded(data => {
_onData((T) data);
_zone.runUnaryGuarded(data1 => {
_onData((T) data1);
return null;
}, data);
_state &= ~_STATE_IN_CALLBACK;

// TODO(floitsch): this dynamic should be 'void'.
var onError = _onError;
if (onError != null) {
_zone.runBinaryGuarded((error, stack) => {
onError((Exception) error, (string) stack);
_zone.runBinaryGuarded((error1, stack) => {
onError((Exception) error1, (string) stack);
return null;
}, error, stackTrace);
}

return new _DoneStreamSubscription<T>(() => onDone());
}
_subscription ??= _source.listen(_controller.add,
_subscription = _subscription ?? _source.listen(_controller.add,
onError: _controller.addError, onDone: () => _controller.close());
cancelOnError = Equals(true, cancelOnError);
return _controller._subscribe(onData, onError, onDone, cancelOnError);

2
com.unity.uiwidgets/Runtime/async/stream_transformers.cs


}
if (_handleError != null) {
stackTrace ??= AsyncError.defaultStackTrace(error);
stackTrace = stackTrace ?? AsyncError.defaultStackTrace(error);
_handleError(error, stackTrace, _sink);
}
else {

正在加载...
取消
保存