Skip to content

Commit

Permalink
sort directives, use isNotEmpty
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmoo committed Jul 27, 2017
1 parent 102200f commit 3521258
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions example/call_parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ main() {
'}',
errors: errors);

if (!errors.isEmpty) {
if (errors.isNotEmpty) {
print("Got ${errors.length} errors.\n");
for (var error in errors) {
print(error);
Expand All @@ -61,7 +61,7 @@ main() {
'}',
errors: errors);

if (!errors.isEmpty) {
if (errors.isNotEmpty) {
print("Got ${errors.length} errors.\n");
for (var error in errors) {
print(error);
Expand All @@ -75,7 +75,7 @@ main() {
print(' ===================================');
stylesheetError = parseCss('# div1 { color: red; }', errors: errors);

if (!errors.isEmpty) {
if (errors.isNotEmpty) {
print("Detected ${errors.length} problem in checked mode.\n");
for (var error in errors) {
print(error);
Expand All @@ -88,7 +88,7 @@ main() {
print('4. Parse a selector only:');
print(' ======================');
var selectorAst = css.selector('#div .foo', errors: errors);
if (!errors.isEmpty) {
if (errors.isNotEmpty) {
print("Got ${errors.length} errors.\n");
for (var error in errors) {
print(error);
Expand Down
2 changes: 1 addition & 1 deletion lib/parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import 'dart:math' as math;

import 'package:source_span/source_span.dart';

import 'visitor.dart';
import 'src/messages.dart';
import 'src/options.dart';
import 'visitor.dart';

export 'src/messages.dart' show Message;
export 'src/options.dart';
Expand Down
8 changes: 4 additions & 4 deletions lib/src/analyzer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ class ExpandNestedSelectors extends Visitor {
// If any expandedRuleSets and we're back at the top-level rule set then
// there were nested rule set(s).
if (_parentRuleSet == null) {
if (!_expandedRuleSets.isEmpty) {
if (_expandedRuleSets.isNotEmpty) {
// Remember ruleset to replace with these flattened rulesets.
_expansions[node] = _expandedRuleSets;
_expandedRuleSets = [];
Expand Down Expand Up @@ -278,8 +278,8 @@ class ExpandNestedSelectors extends Visitor {
// Substitue the & with the parent selector and only use a combinator
// descendant if & is prefix by a sequence with an empty name e.g.,
// "... + &", "&", "... ~ &", etc.
var hasPrefix = !newSequence.isEmpty &&
!newSequence.last.simpleSelector.name.isEmpty;
var hasPrefix = newSequence.isNotEmpty &&
newSequence.last.simpleSelector.name.isNotEmpty;
newSequence.addAll(
hasPrefix ? _convertToDescendentSequence(parent) : parent);
} else {
Expand Down Expand Up @@ -906,7 +906,7 @@ class AllExtends extends Visitor {

SelectorGroup _currSelectorGroup;
int _currDeclIndex;
List<int> _extendsToRemove = [];
final List<int> _extendsToRemove = [];

void visitRuleSet(RuleSet node) {
var oldSelectorGroup = _currSelectorGroup;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/css_printer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,7 @@ class CssPrinter extends Visitor {

void visitVarUsage(VarUsage node) {
emit('var(${node.name}');
if (!node.defaultValues.isEmpty) {
if (node.defaultValues.isNotEmpty) {
emit(',');
for (var defaultValue in node.defaultValues) {
emit(' ');
Expand Down

0 comments on commit 3521258

Please sign in to comment.