Changes for landing https://github.com/dart-lang/sdk/issues/32161
Add void declarations to methods with implicit dynamic returning void
values, which may be illegal in dart 2, but in either case, expresses
the current intent better.
diff --git a/lib/src/renderer.dart b/lib/src/renderer.dart
index ca27f21..3517d22 100644
--- a/lib/src/renderer.dart
+++ b/lib/src/renderer.dart
@@ -51,7 +51,7 @@
Object pop() => _stack.removeLast();
- write(Object output) => sink.write(output.toString());
+ void write(Object output) => sink.write(output.toString());
void render(List<Node> nodes) {
if (indent == null || indent == '') {
@@ -96,8 +96,8 @@
}
if (value == noSuchProperty) {
- if (!lenient) throw error(
- 'Value was missing for variable tag: ${node.name}.', node);
+ if (!lenient)
+ throw error('Value was missing for variable tag: ${node.name}.', node);
} else {
var valueString = (value == null) ? '' : value.toString();
var output = !node.escape || !htmlEscapeValues
@@ -108,8 +108,10 @@
}
void visitSection(SectionNode node) {
- if (node.inverse) _renderInvSection(node);
- else _renderSection(node);
+ if (node.inverse)
+ _renderInvSection(node);
+ else
+ _renderSection(node);
}
//TODO can probably combine Inv and Normal to shorten.
@@ -129,8 +131,8 @@
// Do nothing.
} else if (value == noSuchProperty) {
- if (!lenient) throw error(
- 'Value was missing for section tag: ${node.name}.', node);
+ if (!lenient)
+ throw error('Value was missing for section tag: ${node.name}.', node);
} else if (value is Function) {
var context = new LambdaContext(node, this);
var output = value(context);
@@ -233,8 +235,8 @@
_getNamedProperty(object, name) {
if (object is Map && object.containsKey(name)) return object[name];
- if (object is List && _integerTag.hasMatch(name)) return object[
- int.parse(name)];
+ if (object is List && _integerTag.hasMatch(name))
+ return object[int.parse(name)];
if (lenient && !_validTag.hasMatch(name)) return noSuchProperty;
diff --git a/lib/src/scanner.dart b/lib/src/scanner.dart
index 4ee2621..2a668b5 100644
--- a/lib/src/scanner.dart
+++ b/lib/src/scanner.dart
@@ -138,7 +138,7 @@
}
}
- _append(TokenType type, String value, int start, int end) =>
+ void _append(TokenType type, String value, int start, int end) =>
_tokens.add(new Token(type, value, start, end));
bool _isWhitespace(int c) =>
@@ -197,7 +197,7 @@
bool isCloseDelimiter(int c) =>
(_closeDelimiterInner == null && c == _closeDelimiter) ||
- (_closeDelimiterInner != null && c == _closeDelimiterInner);
+ (_closeDelimiterInner != null && c == _closeDelimiterInner);
for (int c = _peek(); c != _EOF && !isCloseDelimiter(c); c = _peek()) {
start = _offset;
@@ -231,7 +231,8 @@
default:
// Identifier can be any other character in lenient mode.
token = TokenType.identifier;
- value = _readWhile((c) => !(const [
+ value = _readWhile((c) =>
+ !(const [
_HASH,
_CARET,
_FORWARD_SLASH,
@@ -306,8 +307,8 @@
c = _read();
- if (_isWhitespace(c) ||
- c == _EQUAL) throw _error('Incorrect change delimiter tag.');
+ if (_isWhitespace(c) || c == _EQUAL)
+ throw _error('Incorrect change delimiter tag.');
if (_isWhitespace(_peek()) || _peek() == _EQUAL) {
_closeDelimiterInner = null;