Skip to content

Commit 8a8ddb8

Browse files
committed
fix comiplation error for .NET 3.5
1 parent 8f32563 commit 8a8ddb8

11 files changed

+36
-26
lines changed

Assets/Plugins/UniRx/Scripts/Async/Internal/ArrayPool.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
1+
#if CSHARP_7_OR_LATER
2+
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
23

34
using System;
45
using System.Threading;
@@ -147,4 +148,5 @@ static int GetQueueIndex(int size)
147148
}
148149
}
149150
}
150-
}
151+
}
152+
#endif

Assets/Plugins/UniRx/Scripts/Async/Internal/PlayerLoopRunner.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if UNITY_2018_1_OR_NEWER
1+
#if CSHARP_7_OR_LATER
22

33
using System;
44
using UnityEngine;

Assets/Plugins/UniRx/Scripts/Async/PlayerLoopHelper.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if UNITY_2018_1_OR_NEWER
1+
#if CSHARP_7_OR_LATER
22
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
33

44
using System;

Assets/Plugins/UniRx/Scripts/Async/UnityAsyncExtensions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if (NET_4_6 || NET_STANDARD_2_0) && CSHARP_7_OR_LATER
1+
#if CSHARP_7_OR_LATER
22
#pragma warning disable CS1591 // Missing XML comment for publicly visible type or member
33

44
using System;

Assets/Plugins/UniRx/Scripts/UnityEngineBridge/UnityUIComponentExtensions.cs

+4
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ public static IObservable<string> OnValueChangedAsObservable(this InputField inp
104104
}
105105
#endif
106106

107+
#if UNITY_5_3_OR_NEWER
108+
107109
/// <summary>Observe onValueChanged with current `value` on subscribe.</summary>
108110
public static IObservable<int> OnValueChangedAsObservable(this Dropdown dropdown)
109111
{
@@ -113,6 +115,8 @@ public static IObservable<int> OnValueChangedAsObservable(this Dropdown dropdown
113115
return d.onValueChanged.AsObservable().Subscribe(observer);
114116
});
115117
}
118+
119+
#endif
116120
}
117121
}
118122

Assets/Scripts/UnityTests/AsyncTestSample.cs

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
#pragma warning disable CS1591
1+
#if CSHARP_7_OR_LATER
2+
#pragma warning disable CS1591
23

34
using UnityEngine.TestTools;
45
using System.Collections;
@@ -11,6 +12,8 @@
1112

1213
public class AsyncTestSample
1314
{
15+
#if ENABLE_WWW
16+
1417
[UnityTest]
1518
public IEnumerator AsyncTest() => UniTask.ToCoroutine(async () =>
1619
{
@@ -30,4 +33,8 @@ public IEnumerator AsyncTest() => UniTask.ToCoroutine(async () =>
3033
var req = await UnityWebRequest.Get("http://google.co.jp/").SendWebRequest();
3134
req.downloadHandler.text.Contains("<title>Google</title>").IsTrue();
3235
});
36+
37+
#endif
3338
}
39+
40+
#endif

Assets/Scripts/UnityTests/ChainingAssertion.Unity.cs

+6-10
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
1-
#pragma warning disable CS1591
2-
3-
using System;
1+
using System;
42
using System.Collections;
53
using System.Collections.Generic;
6-
using System.Diagnostics.Contracts;
74
using System.Linq;
85
using System.Reflection;
96

@@ -12,7 +9,6 @@
129
// no namespace.
1310

1411
[System.Diagnostics.DebuggerStepThroughAttribute]
15-
[ContractVerification(false)]
1612
public static partial class ChainingAssertion
1713
{
1814
/// <summary>Assert.AreEqual, if T is IEnumerable then CollectionAssert.AreEqual</summary>
@@ -219,7 +215,7 @@ public static void IsStructuralEqual(this object actual, object expected, string
219215
if (!r.IsEquals)
220216
{
221217
var msg = string.Format("is not structural equal, failed at {0}, actual = {1} expected = {2}",
222-
string.Join(".", r.Names), r.Left, r.Right);
218+
string.Join(".", r.Names.ToArray()), r.Left, r.Right);
223219
throw new AssertionException(msg, message);
224220
}
225221
}
@@ -318,9 +314,9 @@ static EqualInfo StructuralEqual(object left, object right, IEnumerable<string>
318314
// is object
319315
var fields = left.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public);
320316
var properties = left.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public).Where(x => x.GetGetMethod(false) != null);
321-
var members = fields.Cast<MemberInfo>().Concat(properties);
317+
var members = fields.Cast<MemberInfo>().Concat(properties.Cast<MemberInfo>());
322318

323-
foreach (var mi in fields.Cast<MemberInfo>().Concat(properties))
319+
foreach (var mi in members)
324320
{
325321
var concatNames = names.Concat(new[] { (string)mi.Name });
326322

@@ -336,8 +332,8 @@ static EqualInfo StructuralEqual(object left, object right, IEnumerable<string>
336332
else
337333
{
338334
var i = mi as PropertyInfo;
339-
lv = i.GetValue(left);
340-
rv = i.GetValue(right);
335+
lv = i.GetValue(left, null);
336+
rv = i.GetValue(right, null);
341337
}
342338

343339
var result = StructuralEqual(lv, rv, concatNames);

Assets/Scripts/UnityTests/Rx/ArrayPoolTest.cs

+4-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using NUnit.Framework;
1+
#if CSHARP_7_OR_LATER
2+
using NUnit.Framework;
23
using System;
34
using UniRx.Async.Internal;
45
using System.Collections.Generic;
@@ -33,3 +34,5 @@ public void Rent()
3334
}
3435
}
3536
}
37+
38+
#endif

Assets/Scripts/UnityTests/Rx/MicroCoroutineTest.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ public object Current
2525
return null;
2626
}
2727
}
28-
public int OriginalCount => original;
28+
public int OriginalCount { get { return original; } }
2929

30-
public int Count => count;
30+
public int Count { get { return count; } }
3131

3232
public bool MoveNext()
3333
{
@@ -41,7 +41,7 @@ public void Reset()
4141

4242
public override string ToString()
4343
{
44-
return $"{count}/{original}";
44+
return count + "/" + "original";
4545
}
4646
}
4747

Assets/Scripts/UnityTests/Rx/ReactivePropertyTest.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using System.Collections.Generic;
33
using System.Linq;
44
using System.Text;
5-
using System.Threading.Tasks;
65
using NUnit.Framework;
76

87
namespace UniRx.Tests
@@ -357,7 +356,7 @@ public void FinishedSourceToReadOnlyReactiveProperty()
357356
// immediate
358357
{
359358

360-
var ex = new Exception();
359+
// var ex = new Exception();
361360
var source = new Subject<int>();
362361
var rxProp = source.ToReadOnlyReactiveProperty();
363362

Assets/Scripts/UnityTests/Rx/SelectWhereOptimizeTest.cs

+3-4
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
using System.Collections.Generic;
44
using System.Linq;
55
using System.Text;
6-
using System.Threading.Tasks;
76

87
namespace UniRx.Tests
98
{
@@ -14,9 +13,9 @@ public class SelectWhereOptimizeTest
1413
public void SelectSelect()
1514
{
1615
// Combine selector currently disabled.
17-
var selectselect = Observable.Range(1, 10)
18-
.Select(x => x)
19-
.Select(x => x * -1);
16+
//var selectselect = Observable.Range(1, 10)
17+
// .Select(x => x)
18+
// .Select(x => x * -1);
2019
}
2120

2221
[Test]

0 commit comments

Comments
 (0)