Skip to content
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

Commit 6cd480a

Browse files
authored
Merge pull request #201 from UnityTech/yczhang
Cleanup Warnings.
2 parents 7b0ac2d + ca2b422 commit 6cd480a

File tree

11 files changed

+41
-16
lines changed

11 files changed

+41
-16
lines changed

Runtime/debugger/diagnostics.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
using Unity.UIWidgets.ui;
77

88
namespace Unity.UIWidgets.debugger {
9+
#pragma warning disable 0659
10+
#pragma warning disable 0661
911
public class DiagnosticsNode : IEquatable<DiagnosticsNode> {
1012
readonly Dictionary<string, object> _json; // todo use json class such as simple json
1113
public readonly bool isProperty;
@@ -310,6 +312,8 @@ public List<DiagnosticsNode> inlineProperties {
310312
}
311313
}
312314
}
315+
#pragma warning restore 0659
316+
#pragma warning restore 0661
313317

314318
public class InspectorInstanceRef : IEquatable<InspectorInstanceRef> {
315319
public readonly string id;

Runtime/flow/physical_shape_layer.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ public PhysicalShapeLayer(
1717
Color _shadow_color;
1818
float _device_pixel_ratio;
1919
Path _path;
20+
#pragma warning disable 0414
2021
bool _isRect;
22+
#pragma warning restore 0414
2123
Rect _frameRRect;
2224
Clip _clip_behavior;
2325

Runtime/foundation/key.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
using System.Collections.Generic;
33

44
namespace Unity.UIWidgets.foundation {
5+
6+
#pragma warning disable 0660
7+
#pragma warning disable 0661
58
public abstract class Key {
69
protected Key() {
710
}
@@ -18,6 +21,8 @@ public static Key key(string value) {
1821
return !Equals(left, right);
1922
}
2023
}
24+
#pragma warning restore 0660
25+
#pragma warning restore 0661
2126

2227
public abstract class LocalKey : Key {
2328
protected LocalKey() {

Runtime/material/slider_theme.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -929,6 +929,7 @@ TextPainter labelPainter
929929
return true;
930930
}
931931

932+
#pragma warning disable 0162
932933
Offset leftCenter = _topLobeCenter - new Offset(leftWidthNeeded, 0.0f) + neckStretch;
933934
Offset rightCenter = _topLobeCenter + new Offset(rightWidthNeeded, 0.0f) + neckStretch;
934935
Rect valueRect = Rect.fromLTRB(
@@ -943,6 +944,7 @@ TextPainter labelPainter
943944
outlinePaint.strokeWidth = 1.0f;
944945
canvas.drawRect(valueRect, outlinePaint);
945946
return true;
947+
#pragma warning restore 0162
946948
});
947949

948950
_addArc(

Runtime/material/text_field.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -445,7 +445,7 @@ public override Widget build(BuildContext context) {
445445
formatters.Add(new LengthLimitingTextInputFormatter(this.widget.maxLength));
446446
}
447447

448-
bool forcePressEnabled = false;
448+
// bool forcePressEnabled = false; // TODO: wait for force press is ready
449449
TextSelectionControls textSelectionControls = MaterialUtils.materialTextSelectionControls;;
450450
bool paintCursorAboveText = false;
451451
bool cursorOpacityAnimates = false;

Runtime/painting/fractional_offset.cs

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,23 +31,25 @@ public float dy {
3131
get { return (this.y + 1.0f) / 2.0f; }
3232
}
3333

34-
public readonly FractionalOffset topLeft = new FractionalOffset(0.0f, 0.0f);
34+
#pragma warning disable 0108
35+
public static readonly FractionalOffset topLeft = new FractionalOffset(0.0f, 0.0f);
3536

36-
public readonly FractionalOffset topCenter = new FractionalOffset(0.5f, 0.0f);
37+
public static readonly FractionalOffset topCenter = new FractionalOffset(0.5f, 0.0f);
3738

38-
public readonly FractionalOffset topRight = new FractionalOffset(1.0f, 0.0f);
39+
public static readonly FractionalOffset topRight = new FractionalOffset(1.0f, 0.0f);
3940

40-
public readonly FractionalOffset centerLeft = new FractionalOffset(0.0f, 0.5f);
41+
public static readonly FractionalOffset centerLeft = new FractionalOffset(0.0f, 0.5f);
4142

42-
public readonly FractionalOffset center = new FractionalOffset(0.5f, 0.5f);
43+
public static readonly FractionalOffset center = new FractionalOffset(0.5f, 0.5f);
4344

44-
public readonly FractionalOffset centerRight = new FractionalOffset(1.0f, 0.5f);
45+
public static readonly FractionalOffset centerRight = new FractionalOffset(1.0f, 0.5f);
4546

46-
public readonly FractionalOffset bottomLeft = new FractionalOffset(0.0f, 1.0f);
47+
public static readonly FractionalOffset bottomLeft = new FractionalOffset(0.0f, 1.0f);
4748

48-
public readonly FractionalOffset bottomCenter = new FractionalOffset(0.5f, 1.0f);
49+
public static readonly FractionalOffset bottomCenter = new FractionalOffset(0.5f, 1.0f);
4950

50-
public readonly FractionalOffset bottomRight = new FractionalOffset(1.0f, 1.0f);
51+
public static readonly FractionalOffset bottomRight = new FractionalOffset(1.0f, 1.0f);
52+
#pragma warning restore 0108
5153

5254
public static Alignment operator -(FractionalOffset a, Alignment b) {
5355
if (!(b is FractionalOffset)) {

Runtime/rendering/object.mixin.gen.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
namespace Unity.UIWidgets.rendering {
88

99
public abstract class RenderObjectWithChildMixinRenderObject<ChildType> : RenderObject, RenderObjectWithChildMixin<ChildType>, RenderObjectWithChildMixin where ChildType : RenderObject {
10-
public bool debugValidateChild(RenderObject child) {
10+
public virtual bool debugValidateChild(RenderObject child) {
1111
D.assert(() => {
1212
if (!(child is ChildType)) {
1313
throw new UIWidgetsError(
@@ -88,7 +88,7 @@ public override List<DiagnosticsNode> debugDescribeChildren() {
8888

8989

9090
public abstract class RenderObjectWithChildMixinRenderBox<ChildType> : RenderBox, RenderObjectWithChildMixin<ChildType>, RenderObjectWithChildMixin where ChildType : RenderObject {
91-
public bool debugValidateChild(RenderObject child) {
91+
public virtual bool debugValidateChild(RenderObject child) {
9292
D.assert(() => {
9393
if (!(child is ChildType)) {
9494
throw new UIWidgetsError(
@@ -994,7 +994,7 @@ public int childCount {
994994
get { return this._childCount; }
995995
}
996996

997-
public bool debugValidateChild(RenderObject child) {
997+
public override bool debugValidateChild(RenderObject child) {
998998
D.assert(() => {
999999
if (!(child is ChildType)) {
10001000
throw new UIWidgetsError(

Runtime/rendering/paragraph.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,10 @@ public bool hasFocus {
250250
}
251251

252252
TextSpan _previousHoverSpan;
253+
254+
#pragma warning disable 0414
253255
bool _pointerHoverInside;
256+
#pragma warning restore 0414
254257
bool _hasHoverRecognizer;
255258
MouseTrackerAnnotation _hoverAnnotation;
256259

Runtime/widgets/nested_scroll_view.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,6 @@ public ScrollDirection userScrollDirection {
330330
ScrollDirection _userScrollDirection = ScrollDirection.idle;
331331

332332
public void updateUserScrollDirection(ScrollDirection value) {
333-
D.assert(value != null);
334333
if (this.userScrollDirection == value) {
335334
return;
336335
}
@@ -1076,7 +1075,7 @@ internal void _markNeedsLayout() {
10761075
}
10771076

10781077
public override string ToString() {
1079-
string extra;
1078+
string extra = "";
10801079
switch (this._writers) {
10811080
case 0:
10821081
extra = ", orphan";
@@ -1088,7 +1087,7 @@ public override string ToString() {
10881087
break;
10891088
}
10901089

1091-
return "$GetType()($layoutExtent$extra)";
1090+
return $"{this.GetType()}({this.layoutExtent}{extra})";
10921091
}
10931092
}
10941093

Tests/Editor/SceneViewTests.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ namespace UIWidgets.Tests {
1313
public class SceneViewTests {
1414
public static void show() {
1515
onPreSceneGUIDelegate += OnPreSceneGUI;
16+
#pragma warning disable 0618
1617
SceneView.onSceneGUIDelegate += OnSceneGUI;
18+
#pragma warning restore 0618
1719
EditorApplication.update += Update;
1820

1921
SceneView.RepaintAll();
@@ -29,11 +31,14 @@ public static void show() {
2931

3032
public static void hide() {
3133
onPreSceneGUIDelegate -= OnPreSceneGUI;
34+
#pragma warning disable 0618
3235
SceneView.onSceneGUIDelegate -= OnSceneGUI;
36+
#pragma warning restore 0618
3337
EditorApplication.update -= Update;
3438
SceneView.RepaintAll();
3539
}
3640

41+
#pragma warning disable 0618
3742
public static SceneView.OnSceneFunc onPreSceneGUIDelegate {
3843
get {
3944
var field = typeof(SceneView).GetField("onPreSceneGUIDelegate",
@@ -49,6 +54,7 @@ public static SceneView.OnSceneFunc onPreSceneGUIDelegate {
4954
field.SetValue(null, value);
5055
}
5156
}
57+
#pragma warning restore 0618
5258

5359
static Func<Widget>[] _options;
5460

0 commit comments

Comments
 (0)