Merge pull request #10 from bcko/patch-2
examples can show up on the pub site
diff --git a/.gitignore b/.gitignore
index 25a1df3..49ce72d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,9 +1,3 @@
-.buildlog
-.DS_Store
-.idea
-.pub/
-.settings/
-build/
-packages
+.dart_tool/
.packages
pubspec.lock
diff --git a/.travis.yml b/.travis.yml
index 610bd03..158bb89 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,17 +1,19 @@
language: dart
-sudo: false
+
dart:
- - stable
+ - 2.0.0
- dev
+
dart_task:
- test: -p vm
xvfb: false
- - test: -p firefox
+ # Set concurrency to 1 to avoid flakes on Travis
+ - test: -p firefox -j 1
- dartanalyzer
matrix:
include:
- - dart: stable
+ - dart: dev
dart_task: dartfmt
# Only building master means that we don't run two builds for each pull request.
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 367abee..302c8d3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+## 1.0.4
+
+* Now requires Dart 2.
+
## 1.0.3
* Work around an inference bug in the new common front-end.
diff --git a/analysis_options.yaml b/analysis_options.yaml
index a10d4c5..c269810 100644
--- a/analysis_options.yaml
+++ b/analysis_options.yaml
@@ -1,2 +1,40 @@
-analyzer:
- strong-mode: true
+include: package:pedantic/analysis_options.yaml
+linter:
+ rules:
+ - avoid_empty_else
+ - avoid_init_to_null
+ - avoid_null_checks_in_equality_operators
+ - avoid_unused_constructor_parameters
+ - await_only_futures
+ - camel_case_types
+ - cancel_subscriptions
+ - constant_identifier_names
+ - control_flow_in_finally
+ - directives_ordering
+ - empty_catches
+ - empty_constructor_bodies
+ - empty_statements
+ - hash_and_equals
+ - implementation_imports
+ - iterable_contains_unrelated_type
+ - library_names
+ - library_prefixes
+ - list_remove_unrelated_type
+ - non_constant_identifier_names
+ - overridden_fields
+ - package_api_docs
+ - package_names
+ - package_prefixed_library_names
+ - prefer_equal_for_default_values
+ - prefer_final_fields
+ - prefer_generic_function_type_aliases
+ - prefer_is_not_empty
+ - slash_for_doc_comments
+ - test_types_in_equals
+ - throw_in_finally
+ - type_init_formals
+ - unnecessary_brace_in_string_interps
+ - unnecessary_const
+ - unnecessary_new
+ - unrelated_type_equality_checks
+ - valid_regexps
diff --git a/codereview.settings b/codereview.settings
deleted file mode 100644
index 3de3f59..0000000
--- a/codereview.settings
+++ /dev/null
@@ -1,3 +0,0 @@
-CODE_REVIEW_SERVER: https://codereview.chromium.org/
-VIEW_VC: https://github.com/dart-lang/boolean_selector/commit/
-CC_LIST: reviews@dartlang.org
\ No newline at end of file
diff --git a/lib/boolean_selector.dart b/lib/boolean_selector.dart
index 790740f..adc36b3 100644
--- a/lib/boolean_selector.dart
+++ b/lib/boolean_selector.dart
@@ -20,10 +20,10 @@
/// same parsed structure are considered equal.
abstract class BooleanSelector {
/// A selector that accepts all inputs.
- static const all = const All();
+ static const all = All();
/// A selector that accepts no inputs.
- static const none = const None();
+ static const none = None();
/// All the variables in this selector, in the order they appear.
Iterable<String> get variables;
diff --git a/lib/src/evaluator.dart b/lib/src/evaluator.dart
index 6401a37..fa02f74 100644
--- a/lib/src/evaluator.dart
+++ b/lib/src/evaluator.dart
@@ -2,12 +2,10 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-import 'package:collection/collection.dart';
-
import 'ast.dart';
import 'visitor.dart';
-typedef bool _Semantics(String variable);
+typedef _Semantics = bool Function(String variable);
/// A visitor for evaluating boolean selectors against a specific set of
/// semantics.
@@ -17,7 +15,7 @@
Evaluator(semantics)
: _semantics = semantics is Iterable
- ? DelegatingIterable.typed(semantics.toSet()).contains
+ ? semantics.toSet().contains
: semantics as _Semantics;
bool visitVariable(VariableNode node) => _semantics(node.name);
diff --git a/lib/src/impl.dart b/lib/src/impl.dart
index 2c3ae4d..49e0f5f 100644
--- a/lib/src/impl.dart
+++ b/lib/src/impl.dart
@@ -24,32 +24,32 @@
/// This will throw a [SourceSpanFormatException] if the selector is
/// malformed or if it uses an undefined variable.
BooleanSelectorImpl.parse(String selector)
- : _selector = new Parser(selector).parse();
+ : _selector = Parser(selector).parse();
BooleanSelectorImpl._(this._selector);
Iterable<String> get variables => _selector.variables;
- bool evaluate(semantics) => _selector.accept(new Evaluator(semantics));
+ bool evaluate(semantics) => _selector.accept(Evaluator(semantics));
BooleanSelector intersection(BooleanSelector other) {
if (other == BooleanSelector.all) return this;
if (other == BooleanSelector.none) return other;
return other is BooleanSelectorImpl
- ? new BooleanSelectorImpl._(new AndNode(_selector, other._selector))
- : new IntersectionSelector(this, other);
+ ? BooleanSelectorImpl._(AndNode(_selector, other._selector))
+ : IntersectionSelector(this, other);
}
BooleanSelector union(BooleanSelector other) {
if (other == BooleanSelector.all) return other;
if (other == BooleanSelector.none) return this;
return other is BooleanSelectorImpl
- ? new BooleanSelectorImpl._(new OrNode(_selector, other._selector))
- : new UnionSelector(this, other);
+ ? BooleanSelectorImpl._(OrNode(_selector, other._selector))
+ : UnionSelector(this, other);
}
void validate(bool isDefined(String variable)) {
- _selector.accept(new Validator(isDefined));
+ _selector.accept(Validator(isDefined));
}
String toString() => _selector.toString();
diff --git a/lib/src/intersection_selector.dart b/lib/src/intersection_selector.dart
index fd72d66..ef6bfdd 100644
--- a/lib/src/intersection_selector.dart
+++ b/lib/src/intersection_selector.dart
@@ -21,10 +21,9 @@
_selector1.evaluate(semantics) && _selector2.evaluate(semantics);
BooleanSelector intersection(BooleanSelector other) =>
- new IntersectionSelector(this, other);
+ IntersectionSelector(this, other);
- BooleanSelector union(BooleanSelector other) =>
- new UnionSelector(this, other);
+ BooleanSelector union(BooleanSelector other) => UnionSelector(this, other);
void validate(bool isDefined(String variable)) {
_selector1.validate(isDefined);
diff --git a/lib/src/parser.dart b/lib/src/parser.dart
index 74d7f31..91a2663 100644
--- a/lib/src/parser.dart
+++ b/lib/src/parser.dart
@@ -18,7 +18,7 @@
/// The scanner that tokenizes the selector.
final Scanner _scanner;
- Parser(String selector) : _scanner = new Scanner(selector);
+ Parser(String selector) : _scanner = Scanner(selector);
/// Parses the selector.
///
@@ -27,7 +27,7 @@
var selector = _conditional();
if (_scanner.peek().type != TokenType.endOfFile) {
- throw new SourceSpanFormatException(
+ throw SourceSpanFormatException(
"Expected end of input.", _scanner.peek().span);
}
@@ -45,12 +45,11 @@
var whenTrue = _conditional();
if (!_scanner.scan(TokenType.colon)) {
- throw new SourceSpanFormatException(
- 'Expected ":".', _scanner.peek().span);
+ throw SourceSpanFormatException('Expected ":".', _scanner.peek().span);
}
var whenFalse = _conditional();
- return new ConditionalNode(condition, whenTrue, whenFalse);
+ return ConditionalNode(condition, whenTrue, whenFalse);
}
/// Parses a logical or:
@@ -60,7 +59,7 @@
Node _or() {
var left = _and();
if (!_scanner.scan(TokenType.or)) return left;
- return new OrNode(left, _or());
+ return OrNode(left, _or());
}
/// Parses a logical and:
@@ -70,7 +69,7 @@
Node _and() {
var left = _simpleExpression();
if (!_scanner.scan(TokenType.and)) return left;
- return new AndNode(left, _and());
+ return AndNode(left, _and());
}
/// Parses a simple expression:
@@ -84,21 +83,21 @@
switch (token.type) {
case TokenType.not:
var child = _simpleExpression();
- return new NotNode(child, token.span.expand(child.span));
+ return NotNode(child, token.span.expand(child.span));
case TokenType.leftParen:
var child = _conditional();
if (!_scanner.scan(TokenType.rightParen)) {
- throw new SourceSpanFormatException(
+ throw SourceSpanFormatException(
'Expected ")".', _scanner.peek().span);
}
return child;
case TokenType.identifier:
- return new VariableNode((token as IdentifierToken).name, token.span);
+ return VariableNode((token as IdentifierToken).name, token.span);
default:
- throw new SourceSpanFormatException("Expected expression.", token.span);
+ throw SourceSpanFormatException("Expected expression.", token.span);
}
}
}
diff --git a/lib/src/scanner.dart b/lib/src/scanner.dart
index 2c24e3c..729c483 100644
--- a/lib/src/scanner.dart
+++ b/lib/src/scanner.dart
@@ -9,20 +9,19 @@
/// A regular expression matching both whitespace and single-line comments.
///
/// This will only match if consumes at least one character.
-final _whitespaceAndSingleLineComments =
- new RegExp(r"([ \t\n]+|//[^\n]*(\n|$))+");
+final _whitespaceAndSingleLineComments = RegExp(r"([ \t\n]+|//[^\n]*(\n|$))+");
/// A regular expression matching the body of a multi-line comment, after `/*`
/// but before `*/` or a nested `/*`.
///
/// This will only match if it consumes at least one character.
-final _multiLineCommentBody = new RegExp(r"([^/*]|/[^*]|\*[^/])+");
+final _multiLineCommentBody = RegExp(r"([^/*]|/[^*]|\*[^/])+");
/// A regular expression matching a hyphenated identifier.
///
/// This is like a standard Dart identifier, except that it can also contain
/// hyphens.
-final _hyphenatedIdentifier = new RegExp(r"[a-zA-Z_-][a-zA-Z0-9_-]*");
+final _hyphenatedIdentifier = RegExp(r"[a-zA-Z_-][a-zA-Z0-9_-]*");
/// A scanner that converts a boolean selector string into a stream of tokens.
class Scanner {
@@ -35,7 +34,7 @@
/// Whether the scanner has emitted a [TokenType.endOfFile] token.
bool _endOfFileEmitted = false;
- Scanner(String selector) : _scanner = new SpanScanner(selector);
+ Scanner(String selector) : _scanner = SpanScanner(selector);
/// Returns the next token that will be returned by [next].
///
@@ -70,11 +69,11 @@
/// Scan and return the next token in the stream.
Token _getNext() {
- if (_endOfFileEmitted) throw new StateError("No more tokens.");
+ if (_endOfFileEmitted) throw StateError("No more tokens.");
_consumeWhitespace();
if (_scanner.isDone) {
- return new Token(TokenType.endOfFile, _scanner.spanFrom(_scanner.state));
+ return Token(TokenType.endOfFile, _scanner.spanFrom(_scanner.state));
}
switch (_scanner.peekChar()) {
@@ -104,7 +103,7 @@
Token _scanOperator(TokenType type) {
var start = _scanner.state;
_scanner.readChar();
- return new Token(type, _scanner.spanFrom(start));
+ return Token(type, _scanner.spanFrom(start));
}
/// Scans a `||` operator and returns the appropriate token.
@@ -113,7 +112,7 @@
Token _scanOr() {
var start = _scanner.state;
_scanner.expect("||");
- return new Token(TokenType.or, _scanner.spanFrom(start));
+ return Token(TokenType.or, _scanner.spanFrom(start));
}
/// Scans a `&&` operator and returns the appropriate token.
@@ -122,13 +121,13 @@
Token _scanAnd() {
var start = _scanner.state;
_scanner.expect("&&");
- return new Token(TokenType.and, _scanner.spanFrom(start));
+ return Token(TokenType.and, _scanner.spanFrom(start));
}
/// Scans and returns an identifier token.
Token _scanIdentifier() {
_scanner.expect(_hyphenatedIdentifier, name: "expression");
- return new IdentifierToken(_scanner.lastMatch[0], _scanner.lastSpan);
+ return IdentifierToken(_scanner.lastMatch[0], _scanner.lastSpan);
}
/// Consumes all whitespace and comments immediately following the cursor's
diff --git a/lib/src/token.dart b/lib/src/token.dart
index 1daa0fc..908d8a9 100644
--- a/lib/src/token.dart
+++ b/lib/src/token.dart
@@ -35,31 +35,31 @@
/// An enumeration of types of tokens.
class TokenType {
/// A `(` character.
- static const leftParen = const TokenType._("left paren");
+ static const leftParen = TokenType._("left paren");
/// A `)` character.
- static const rightParen = const TokenType._("right paren");
+ static const rightParen = TokenType._("right paren");
/// A `||` sequence.
- static const or = const TokenType._("or");
+ static const or = TokenType._("or");
/// A `&&` sequence.
- static const and = const TokenType._("and");
+ static const and = TokenType._("and");
/// A `!` character.
- static const not = const TokenType._("not");
+ static const not = TokenType._("not");
/// A `?` character.
- static const questionMark = const TokenType._("question mark");
+ static const questionMark = TokenType._("question mark");
/// A `:` character.
- static const colon = const TokenType._("colon");
+ static const colon = TokenType._("colon");
/// A named identifier.
- static const identifier = const TokenType._("identifier");
+ static const identifier = TokenType._("identifier");
/// The end of the selector.
- static const endOfFile = const TokenType._("end of file");
+ static const endOfFile = TokenType._("end of file");
/// The name of the token type.
final String name;
diff --git a/lib/src/union_selector.dart b/lib/src/union_selector.dart
index a6be5fe..a3a9b0a 100644
--- a/lib/src/union_selector.dart
+++ b/lib/src/union_selector.dart
@@ -19,10 +19,9 @@
_selector1.evaluate(semantics) || _selector2.evaluate(semantics);
BooleanSelector intersection(BooleanSelector other) =>
- new IntersectionSelector(this, other);
+ IntersectionSelector(this, other);
- BooleanSelector union(BooleanSelector other) =>
- new UnionSelector(this, other);
+ BooleanSelector union(BooleanSelector other) => UnionSelector(this, other);
void validate(bool isDefined(String variable)) {
_selector1.validate(isDefined);
diff --git a/lib/src/validator.dart b/lib/src/validator.dart
index f4d78cf..deea1ef 100644
--- a/lib/src/validator.dart
+++ b/lib/src/validator.dart
@@ -7,7 +7,7 @@
import 'ast.dart';
import 'visitor.dart';
-typedef bool _IsDefined(String variable);
+typedef _IsDefined = bool Function(String variable);
/// An AST visitor that ensures that all variables are valid.
class Validator extends RecursiveVisitor {
@@ -17,6 +17,6 @@
void visitVariable(VariableNode node) {
if (_isDefined(node.name)) return;
- throw new SourceSpanFormatException("Undefined variable.", node.span);
+ throw SourceSpanFormatException("Undefined variable.", node.span);
}
}
diff --git a/pubspec.yaml b/pubspec.yaml
index 27961af..2f5cfba 100644
--- a/pubspec.yaml
+++ b/pubspec.yaml
@@ -1,16 +1,16 @@
name: boolean_selector
-version: 1.0.3
+version: 1.0.5-dev
description: A flexible syntax for boolean expressions.
author: Dart Team <misc@dartlang.org>
homepage: https://github.com/dart-lang/boolean_selector
environment:
- sdk: '>=1.8.0 <2.0.0'
+ sdk: '>=2.0.0 <3.0.0'
dependencies:
- collection: '^1.5.0'
- source_span: '^1.0.0'
+ source_span: ^1.0.0
string_scanner: '>=0.1.1 <2.0.0'
dev_dependencies:
- test: '^0.12.0'
+ pedantic: ^1.0.0
+ test: ^1.2.0
diff --git a/test/equality_test.dart b/test/equality_test.dart
index 7ee527b..4470cfd 100644
--- a/test/equality_test.dart
+++ b/test/equality_test.dart
@@ -36,17 +36,17 @@
});
test("redundant parens don't matter", () {
- expect(new BooleanSelector.parse("foo && (bar && baz)"),
- equals(new BooleanSelector.parse("foo && (bar && baz)")));
+ expect(BooleanSelector.parse("foo && (bar && baz)"),
+ equals(BooleanSelector.parse("foo && (bar && baz)")));
});
test("meaningful parens do matter", () {
- expect(new BooleanSelector.parse("(foo && bar) || baz"),
- equals(new BooleanSelector.parse("foo && bar || baz")));
+ expect(BooleanSelector.parse("(foo && bar) || baz"),
+ equals(BooleanSelector.parse("foo && bar || baz")));
});
}
void _expectEqualsSelf(String selector) {
- expect(new BooleanSelector.parse(selector),
- equals(new BooleanSelector.parse(selector)));
+ expect(
+ BooleanSelector.parse(selector), equals(BooleanSelector.parse(selector)));
}
diff --git a/test/evaluate_test.dart b/test/evaluate_test.dart
index 16c73e2..d6961ec 100644
--- a/test/evaluate_test.dart
+++ b/test/evaluate_test.dart
@@ -36,9 +36,12 @@
});
test("with a semantics function", () {
- _expectEval("foo", false, semantics: (variable) => variable.contains("a"));
- _expectEval("bar", true, semantics: (variable) => variable.contains("a"));
- _expectEval("baz", true, semantics: (variable) => variable.contains("a"));
+ _expectEval("foo", false,
+ semantics: (String variable) => variable.contains("a"));
+ _expectEval("bar", true,
+ semantics: (String variable) => variable.contains("a"));
+ _expectEval("baz", true,
+ semantics: (String variable) => variable.contains("a"));
});
}
@@ -54,6 +57,6 @@
///
/// By default, "true" is true and all other variables are "false".
bool _eval(String expression, {semantics}) {
- var selector = new BooleanSelector.parse(expression);
+ var selector = BooleanSelector.parse(expression);
return selector.evaluate(semantics ?? ["true"]);
}
diff --git a/test/parser_test.dart b/test/parser_test.dart
index 9e801f2..43af40f 100644
--- a/test/parser_test.dart
+++ b/test/parser_test.dart
@@ -8,16 +8,16 @@
import 'package:boolean_selector/src/parser.dart';
/// A matcher that asserts that a value is a [ConditionalNode].
-Matcher _isConditionalNode = new isInstanceOf<ConditionalNode>();
+final _isConditionalNode = TypeMatcher<ConditionalNode>();
/// A matcher that asserts that a value is an [OrNode].
-Matcher _isOrNode = new isInstanceOf<OrNode>();
+final _isOrNode = TypeMatcher<OrNode>();
/// A matcher that asserts that a value is an [AndNode].
-Matcher _isAndNode = new isInstanceOf<AndNode>();
+final _isAndNode = TypeMatcher<AndNode>();
/// A matcher that asserts that a value is a [NotNode].
-Matcher _isNotNode = new isInstanceOf<NotNode>();
+final _isNotNode = TypeMatcher<NotNode>();
void main() {
group("parses a conditional expression", () {
@@ -249,7 +249,7 @@
}
/// Parses [selector] and returns its root node.
-dynamic _parse(String selector) => new Parser(selector).parse();
+dynamic _parse(String selector) => Parser(selector).parse();
/// A matcher that asserts that a value is a [VariableNode] with the given
/// [name].
@@ -263,4 +263,4 @@
reason: 'Expected toString of "$selector" to be "$result".');
}
-String _toString(String selector) => new Parser(selector).parse().toString();
+String _toString(String selector) => Parser(selector).parse().toString();
diff --git a/test/scanner_test.dart b/test/scanner_test.dart
index 2ecda8d..fafe31a 100644
--- a/test/scanner_test.dart
+++ b/test/scanner_test.dart
@@ -10,14 +10,14 @@
void main() {
group("peek()", () {
test("returns the next token without consuming it", () {
- var scanner = new Scanner("( )");
+ var scanner = Scanner("( )");
expect(scanner.peek().type, equals(TokenType.leftParen));
expect(scanner.peek().type, equals(TokenType.leftParen));
expect(scanner.peek().type, equals(TokenType.leftParen));
});
test("returns an end-of-file token at the end of a file", () {
- var scanner = new Scanner("( )");
+ var scanner = Scanner("( )");
scanner.next();
scanner.next();
@@ -28,7 +28,7 @@
});
test("throws a StateError if called after end-of-file was consumed", () {
- var scanner = new Scanner("( )");
+ var scanner = Scanner("( )");
scanner.next();
scanner.next();
scanner.next();
@@ -38,14 +38,14 @@
group("next()", () {
test("consumes and returns the next token", () {
- var scanner = new Scanner("( )");
+ var scanner = Scanner("( )");
expect(scanner.next().type, equals(TokenType.leftParen));
expect(scanner.peek().type, equals(TokenType.rightParen));
expect(scanner.next().type, equals(TokenType.rightParen));
});
test("returns an end-of-file token at the end of a file", () {
- var scanner = new Scanner("( )");
+ var scanner = Scanner("( )");
scanner.next();
scanner.next();
@@ -56,7 +56,7 @@
});
test("throws a StateError if called after end-of-file was consumed", () {
- var scanner = new Scanner("( )");
+ var scanner = Scanner("( )");
scanner.next();
scanner.next();
scanner.next();
@@ -66,19 +66,19 @@
group("scan()", () {
test("consumes a matching token and returns true", () {
- var scanner = new Scanner("( )");
+ var scanner = Scanner("( )");
expect(scanner.scan(TokenType.leftParen), isTrue);
expect(scanner.peek().type, equals(TokenType.rightParen));
});
test("doesn't consume a matching token and returns false", () {
- var scanner = new Scanner("( )");
+ var scanner = Scanner("( )");
expect(scanner.scan(TokenType.questionMark), isFalse);
expect(scanner.peek().type, equals(TokenType.leftParen));
});
test("throws a StateError called after end-of-file was consumed", () {
- var scanner = new Scanner("( )");
+ var scanner = Scanner("( )");
scanner.next();
scanner.next();
scanner.next();
@@ -146,7 +146,7 @@
});
test("scans multiple tokens", () {
- var scanner = new Scanner("(foo && bar)");
+ var scanner = Scanner("(foo && bar)");
var token = scanner.next();
expect(token.type, equals(TokenType.leftParen));
@@ -183,34 +183,34 @@
group("ignores", () {
test("a single-line comment", () {
- var scanner = new Scanner("( // &&\n// ||\n)");
+ var scanner = Scanner("( // &&\n// ||\n)");
expect(scanner.next().type, equals(TokenType.leftParen));
expect(scanner.next().type, equals(TokenType.rightParen));
expect(scanner.next().type, equals(TokenType.endOfFile));
});
test("a single-line comment without a trailing newline", () {
- var scanner = new Scanner("( // &&");
+ var scanner = Scanner("( // &&");
expect(scanner.next().type, equals(TokenType.leftParen));
expect(scanner.next().type, equals(TokenType.endOfFile));
});
test("a multi-line comment", () {
- var scanner = new Scanner("( /* && * /\n|| */\n)");
+ var scanner = Scanner("( /* && * /\n|| */\n)");
expect(scanner.next().type, equals(TokenType.leftParen));
expect(scanner.next().type, equals(TokenType.rightParen));
expect(scanner.next().type, equals(TokenType.endOfFile));
});
test("a multi-line nested comment", () {
- var scanner = new Scanner("(/* && /* ? /* || */ : */ ! */)");
+ var scanner = Scanner("(/* && /* ? /* || */ : */ ! */)");
expect(scanner.next().type, equals(TokenType.leftParen));
expect(scanner.next().type, equals(TokenType.rightParen));
expect(scanner.next().type, equals(TokenType.endOfFile));
});
test("Dart's notion of whitespace", () {
- var scanner = new Scanner("( \t \n)");
+ var scanner = Scanner("( \t \n)");
expect(scanner.next().type, equals(TokenType.leftParen));
expect(scanner.next().type, equals(TokenType.rightParen));
expect(scanner.next().type, equals(TokenType.endOfFile));
@@ -264,4 +264,4 @@
}
/// Scans a single token from [selector].
-dynamic _scan(String selector) => new Scanner(selector).next();
+dynamic _scan(String selector) => Scanner(selector).next();
diff --git a/test/to_string_test.dart b/test/to_string_test.dart
index 6333a3d..11dad2a 100644
--- a/test/to_string_test.dart
+++ b/test/to_string_test.dart
@@ -82,5 +82,4 @@
reason: 'Expected toString of "$selector" to be "$result".');
}
-String _toString(String selector) =>
- new BooleanSelector.parse(selector).toString();
+String _toString(String selector) => BooleanSelector.parse(selector).toString();
diff --git a/test/validate_test.dart b/test/validate_test.dart
index 225df8a..d61fd36 100644
--- a/test/validate_test.dart
+++ b/test/validate_test.dart
@@ -6,7 +6,7 @@
import 'package:boolean_selector/boolean_selector.dart';
-var _selector = new BooleanSelector.parse("foo && bar && baz");
+var _selector = BooleanSelector.parse("foo && bar && baz");
void main() {
test("throws if any variables are undefined", () {
diff --git a/test/variables_test.dart b/test/variables_test.dart
index e66f4b8..1cb4740 100644
--- a/test/variables_test.dart
+++ b/test/variables_test.dart
@@ -8,29 +8,29 @@
void main() {
test("a variable reports itself", () {
- expect(new BooleanSelector.parse("foo").variables, equals(["foo"]));
+ expect(BooleanSelector.parse("foo").variables, equals(["foo"]));
});
test("a negation reports its contents", () {
- expect(new BooleanSelector.parse("!foo").variables, equals(["foo"]));
+ expect(BooleanSelector.parse("!foo").variables, equals(["foo"]));
});
test("a parenthesized expression reports its contents", () {
- expect(new BooleanSelector.parse("(foo)").variables, equals(["foo"]));
+ expect(BooleanSelector.parse("(foo)").variables, equals(["foo"]));
});
test("an or reports its contents", () {
- expect(new BooleanSelector.parse("foo || bar").variables,
- equals(["foo", "bar"]));
+ expect(
+ BooleanSelector.parse("foo || bar").variables, equals(["foo", "bar"]));
});
test("an and reports its contents", () {
- expect(new BooleanSelector.parse("foo && bar").variables,
- equals(["foo", "bar"]));
+ expect(
+ BooleanSelector.parse("foo && bar").variables, equals(["foo", "bar"]));
});
test("a conditional reports its contents", () {
- expect(new BooleanSelector.parse("foo ? bar : baz").variables,
+ expect(BooleanSelector.parse("foo ? bar : baz").variables,
equals(["foo", "bar", "baz"]));
});