Commit e8d1df07 authored by pq's avatar pq

Dead code and switch cleanup (continued).

Prep to get us ready to pull in a new dev SDK and bump our analyzer DEP.

* updates `crypto` (required by fresh analyzer)
* fixes newly flagged dead code warnings
* fixes switches that fall through and don't return
parent 7e8274e2
...@@ -57,6 +57,8 @@ class RenderBlock extends RenderBox ...@@ -57,6 +57,8 @@ class RenderBlock extends RenderBox
case Axis.vertical: case Axis.vertical:
return new BoxConstraints.tightFor(width: constraints.maxWidth); return new BoxConstraints.tightFor(width: constraints.maxWidth);
} }
assert(_mainAxis != null);
return null;
} }
double get _mainAxisExtent { double get _mainAxisExtent {
...@@ -70,6 +72,8 @@ class RenderBlock extends RenderBox ...@@ -70,6 +72,8 @@ class RenderBlock extends RenderBox
case Axis.vertical: case Axis.vertical:
return parentData.offset.dy + child.size.height; return parentData.offset.dy + child.size.height;
} }
assert(mainAxis != null);
return null;
} }
@override @override
...@@ -92,7 +96,6 @@ class RenderBlock extends RenderBox ...@@ -92,7 +96,6 @@ class RenderBlock extends RenderBox
'axis. You probably want to put the RenderBlock inside a ' 'axis. You probably want to put the RenderBlock inside a '
'RenderViewport with a matching main axis.' 'RenderViewport with a matching main axis.'
); );
return false;
}); });
assert(() { assert(() {
switch (mainAxis) { switch (mainAxis) {
...@@ -118,7 +121,6 @@ class RenderBlock extends RenderBox ...@@ -118,7 +121,6 @@ class RenderBlock extends RenderBox
'for example, a RenderIntrinsicWidth or RenderIntrinsicHeight object. ' 'for example, a RenderIntrinsicWidth or RenderIntrinsicHeight object. '
'This is relatively expensive, however.' // (that's why we don't do it automatically) 'This is relatively expensive, however.' // (that's why we don't do it automatically)
); );
return false;
}); });
BoxConstraints innerConstraints = _getInnerConstraints(constraints); BoxConstraints innerConstraints = _getInnerConstraints(constraints);
double position = 0.0; double position = 0.0;
...@@ -187,6 +189,8 @@ class RenderBlock extends RenderBox ...@@ -187,6 +189,8 @@ class RenderBlock extends RenderBox
case Axis.vertical: case Axis.vertical:
return _getIntrinsicCrossAxis((RenderBox child) => child.getMinIntrinsicWidth(height)); return _getIntrinsicCrossAxis((RenderBox child) => child.getMinIntrinsicWidth(height));
} }
assert(mainAxis != null);
return null;
} }
@override @override
...@@ -197,6 +201,8 @@ class RenderBlock extends RenderBox ...@@ -197,6 +201,8 @@ class RenderBlock extends RenderBox
case Axis.vertical: case Axis.vertical:
return _getIntrinsicCrossAxis((RenderBox child) => child.getMaxIntrinsicWidth(height)); return _getIntrinsicCrossAxis((RenderBox child) => child.getMaxIntrinsicWidth(height));
} }
assert(mainAxis != null);
return null;
} }
@override @override
...@@ -207,6 +213,8 @@ class RenderBlock extends RenderBox ...@@ -207,6 +213,8 @@ class RenderBlock extends RenderBox
case Axis.vertical: case Axis.vertical:
return _getIntrinsicCrossAxis((RenderBox child) => child.getMinIntrinsicHeight(width)); return _getIntrinsicCrossAxis((RenderBox child) => child.getMinIntrinsicHeight(width));
} }
assert(mainAxis != null);
return null;
} }
@override @override
...@@ -217,6 +225,8 @@ class RenderBlock extends RenderBox ...@@ -217,6 +225,8 @@ class RenderBlock extends RenderBox
case Axis.vertical: case Axis.vertical:
return _getIntrinsicCrossAxis((RenderBox child) => child.getMaxIntrinsicHeight(width)); return _getIntrinsicCrossAxis((RenderBox child) => child.getMaxIntrinsicHeight(width));
} }
assert(mainAxis != null);
return null;
} }
@override @override
......
...@@ -136,6 +136,8 @@ class RenderList extends RenderVirtualViewport<ListParentData> { ...@@ -136,6 +136,8 @@ class RenderList extends RenderVirtualViewport<ListParentData> {
assert(debugThrowIfNotCheckingIntrinsics()); assert(debugThrowIfNotCheckingIntrinsics());
return 0.0; return 0.0;
} }
assert(mainAxis != null);
return null;
} }
@override @override
......
...@@ -324,6 +324,8 @@ class LazyBlockViewport extends RenderObjectWidget { ...@@ -324,6 +324,8 @@ class LazyBlockViewport extends RenderObjectWidget {
case Axis.vertical: case Axis.vertical:
return padding.vertical; return padding.vertical;
} }
assert(mainAxis != null);
return null;
} }
@override @override
...@@ -716,6 +718,8 @@ class _LazyBlockElement extends RenderObjectElement { ...@@ -716,6 +718,8 @@ class _LazyBlockElement extends RenderObjectElement {
double width = math.max(0.0, constraints.maxWidth - padding); double width = math.max(0.0, constraints.maxWidth - padding);
return new BoxConstraints.tightFor(width: width); return new BoxConstraints.tightFor(width: width);
} }
assert(widget.mainAxis != null);
return null;
} }
Offset get _initialChildOffset { Offset get _initialChildOffset {
......
...@@ -299,6 +299,8 @@ class ScrollableState<T extends Scrollable> extends State<T> { ...@@ -299,6 +299,8 @@ class ScrollableState<T extends Scrollable> extends State<T> {
case ViewportAnchor.end: case ViewportAnchor.end:
return scrollOffset; return scrollOffset;
} }
assert(config.scrollAnchor != null);
return null;
} }
/// Returns the scroll offset component of the given pixel delta, accounting /// Returns the scroll offset component of the given pixel delta, accounting
...@@ -313,6 +315,8 @@ class ScrollableState<T extends Scrollable> extends State<T> { ...@@ -313,6 +315,8 @@ class ScrollableState<T extends Scrollable> extends State<T> {
case Axis.vertical: case Axis.vertical:
return pixelOffsetToScrollOffset(pixelDelta.dy); return pixelOffsetToScrollOffset(pixelDelta.dy);
} }
assert(config.scrollDirection != null);
return null;
} }
/// Returns a two-dimensional representation of the scroll offset, accounting /// Returns a two-dimensional representation of the scroll offset, accounting
...@@ -326,6 +330,8 @@ class ScrollableState<T extends Scrollable> extends State<T> { ...@@ -326,6 +330,8 @@ class ScrollableState<T extends Scrollable> extends State<T> {
case Axis.vertical: case Axis.vertical:
return new Offset(0.0, scrollOffsetToPixelOffset(scrollOffset)); return new Offset(0.0, scrollOffsetToPixelOffset(scrollOffset));
} }
assert(config.scrollDirection != null);
return null;
} }
/// The current scroll behavior of this widget. /// The current scroll behavior of this widget.
......
...@@ -83,6 +83,8 @@ abstract class VirtualViewportElement extends RenderObjectElement { ...@@ -83,6 +83,8 @@ abstract class VirtualViewportElement extends RenderObjectElement {
case Axis.vertical: case Axis.vertical:
return new Offset(0.0, scrollOffsetToPixelOffset(scrollOffset)); return new Offset(0.0, scrollOffsetToPixelOffset(scrollOffset));
} }
assert(renderObject.mainAxis != null);
return null;
} }
List<Element> _materializedChildren = const <Element>[]; List<Element> _materializedChildren = const <Element>[];
......
...@@ -10,7 +10,7 @@ dependencies: ...@@ -10,7 +10,7 @@ dependencies:
vector_math: '>=2.0.3 <3.0.0' vector_math: '>=2.0.3 <3.0.0'
# We need to pin crypto because archive can't handle larger numbers. # We need to pin crypto because archive can't handle larger numbers.
crypto: 0.9.2 crypto: '>=1.1.1 <3.0.0'
meta: ^0.12.0 meta: ^0.12.0
......
...@@ -19,7 +19,6 @@ void main() { ...@@ -19,7 +19,6 @@ void main() {
try { try {
throw null; throw null;
expect(false, isTrue); // shouldn't get here
} catch (e, stack) { } catch (e, stack) {
StringBuffer information = new StringBuffer(); StringBuffer information = new StringBuffer();
expect(reportExpectCall(stack, information), 0); expect(reportExpectCall(stack, information), 0);
......
...@@ -10,7 +10,7 @@ environment: ...@@ -10,7 +10,7 @@ environment:
dependencies: dependencies:
archive: ^1.0.20 archive: ^1.0.20
args: ^0.13.4 args: ^0.13.4
crypto: 0.9.2 crypto: '>=1.1.1 <3.0.0'
file: ^0.1.0 file: ^0.1.0
http: ^0.11.3 http: ^0.11.3
json_rpc_2: ^2.0.0 json_rpc_2: ^2.0.0
......
...@@ -9,7 +9,7 @@ import 'dart:typed_data'; ...@@ -9,7 +9,7 @@ import 'dart:typed_data';
import 'package:asn1lib/asn1lib.dart'; import 'package:asn1lib/asn1lib.dart';
import 'package:bignum/bignum.dart'; import 'package:bignum/bignum.dart';
import 'package:crypto/crypto.dart' hide BASE64, Digest; import 'package:crypto/crypto.dart' hide Digest;
import 'package:pointycastle/pointycastle.dart'; import 'package:pointycastle/pointycastle.dart';
export 'package:pointycastle/pointycastle.dart' show AsymmetricKeyPair, PublicKey, PrivateKey; export 'package:pointycastle/pointycastle.dart' show AsymmetricKeyPair, PublicKey, PrivateKey;
......
...@@ -7,7 +7,7 @@ dependencies: ...@@ -7,7 +7,7 @@ dependencies:
bignum: ^0.1.0 bignum: ^0.1.0
asn1lib: ^0.4.1 asn1lib: ^0.4.1
pointycastle: 0.10.0 pointycastle: 0.10.0
crypto: 0.9.2 crypto: '>=1.1.1 <3.0.0'
environment: environment:
sdk: '>=1.16.0 <2.0.0' sdk: '>=1.16.0 <2.0.0'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment