浏览代码

Remove redundant assertions.

/main
Yuncong Zhang 6 年前
当前提交
190bf7ea
共有 2 个文件被更改,包括 0 次插入28 次删除
  1. 26
      Runtime/rendering/wrap.cs
  2. 2
      Runtime/widgets/transitions.cs

26
Runtime/rendering/wrap.cs


TextDirection? textDirection = null,
VerticalDirection verticalDirection = VerticalDirection.down
) {
D.assert(direction != null);
D.assert(alignment != null);
D.assert(spacing != null);
D.assert(runAlignment != null);
D.assert(runSpacing != null);
D.assert(crossAxisAlignment != null);
this._direction = direction;
this._alignment = alignment;
this._spacing = spacing;

public Axis direction {
get { return this._direction; }
set {
D.assert(value != null);
if (this._direction == value) {
return;
}

public WrapAlignment alignment {
get { return this._alignment; }
set {
D.assert(value != null);
if (this._alignment == value) {
return;
}

public float spacing {
get { return this._spacing; }
set {
D.assert(value != null);
if (this._spacing == value) {
return;
}

public WrapAlignment runAlignment {
get { return this._runAlignment; }
set {
D.assert(value != null);
if (this._runAlignment == value) {
return;
}

public float runSpacing {
get { return this._runSpacing; }
set {
D.assert(value != null);
if (this._runSpacing == value) {
return;
}

public WrapCrossAlignment crossAxisAlignment {
get { return this._crossAxisAlignment; }
set {
D.assert(value != null);
if (this._crossAxisAlignment == value) {
return;
}

public bool _debugHasNecessaryDirections {
get {
D.assert(this.direction != null);
D.assert(this.alignment != null);
D.assert(this.runAlignment != null);
D.assert(this.crossAxisAlignment != null);
if (this.firstChild != null && this.lastChild != this.firstChild) {
// i.e. there"s more than one child
switch (this.direction) {

break;
case Axis.vertical:
D.assert(this.verticalDirection != null,
"Vertical $runtimeType with multiple children has a null verticalDirection, so the layout order is undefined.");
break;
}
}

"Horizontal $runtimeType with alignment $alignment has a null textDirection, so the alignment cannot be resolved.");
break;
case Axis.vertical:
D.assert(this.verticalDirection != null,
"Vertical $runtimeType with alignment $alignment has a null verticalDirection, so the alignment cannot be resolved.");
break;
}
}

case Axis.horizontal:
D.assert(this.verticalDirection != null,
"Horizontal $runtimeType with runAlignment $runAlignment has a null verticalDirection, so the alignment cannot be resolved.");
break;
case Axis.vertical:
D.assert(this.textDirection != null,

this.crossAxisAlignment == WrapCrossAlignment.end) {
switch (this.direction) {
case Axis.horizontal:
D.assert(this.verticalDirection != null,
"Horizontal $runtimeType with crossAxisAlignment $crossAxisAlignment has a null verticalDirection, so the alignment cannot be resolved.");
break;
case Axis.vertical:
D.assert(this.textDirection != null,

}
D.assert(childConstraints != null);
D.assert(mainAxisLimit != null);
float spacing = this.spacing;
float runSpacing = this.runSpacing;
List<_RunMetrics> runMetrics = new List<_RunMetrics> { };

2
Runtime/widgets/transitions.cs


Animation<float> sizeFactor = null,
float axisAlignment = 0.0f,
Widget child = null) : base(key: key, listenable: sizeFactor) {
D.assert(axis != null);
D.assert(axisAlignment != null);
this.axis = axis;
this.axisAlignment = axisAlignment;
this.child = child;

正在加载...
取消
保存