Skip to content

Commit

Permalink
Fix broken specs
Browse files Browse the repository at this point in the history
  • Loading branch information
nex3 committed Apr 15, 2021
1 parent 25e6520 commit 481c96b
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 25 deletions.
8 changes: 4 additions & 4 deletions lib/src/ast/selector/pseudo.dart
Expand Up @@ -170,8 +170,8 @@ class PseudoSelector extends SimpleSelector {
var minSpecificity = 0;
var maxSpecificity = 0;
for (var complex in selector.components) {
minSpecificity = math.max(_minSpecificity!, complex.minSpecificity);
maxSpecificity = math.max(_maxSpecificity!, complex.maxSpecificity);
minSpecificity = math.max(minSpecificity, complex.minSpecificity);
maxSpecificity = math.max(maxSpecificity, complex.maxSpecificity);
}
_minSpecificity = minSpecificity;
_maxSpecificity = maxSpecificity;
Expand All @@ -180,8 +180,8 @@ class PseudoSelector extends SimpleSelector {
var minSpecificity = math.pow(super.minSpecificity, 3) as int;
var maxSpecificity = 0;
for (var complex in selector.components) {
minSpecificity = math.min(_minSpecificity!, complex.minSpecificity);
maxSpecificity = math.max(_maxSpecificity!, complex.maxSpecificity);
minSpecificity = math.min(minSpecificity, complex.minSpecificity);
maxSpecificity = math.max(maxSpecificity, complex.maxSpecificity);
}
_minSpecificity = minSpecificity;
_maxSpecificity = maxSpecificity;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/exception.dart
Expand Up @@ -99,7 +99,7 @@ class MultiSpanSassException extends SassException
useColor = true;
}

var buffer = StringBuffer("Error: $message");
var buffer = StringBuffer("Error: $message\n");

span
.highlightMultiple(primaryLabel, secondarySpans,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/extend/extension_store.dart
Expand Up @@ -215,7 +215,7 @@ class ExtensionStore {

for (var simple in component.components) {
_selectors.putIfAbsent(simple, () => {}).add(selector);
if (simple is! PseudoSelector) return;
if (simple is! PseudoSelector) continue;

var selectorInPseudo = simple.selector;
if (selectorInPseudo != null) {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/extend/functions.dart
Expand Up @@ -785,7 +785,7 @@ bool _selectorPseudoIsSuperselector(
return compound2.components.any((pseudo2) {
if (pseudo2 is! PseudoSelector) return false;
if (pseudo2.name != pseudo1.name) return false;
if (pseudo2.argument == pseudo1.argument) return false;
if (pseudo2.argument != pseudo1.argument) return false;
var selector2 = pseudo2.selector;
if (selector2 == null) return false;
return selector1.isSuperselector(selector2);
Expand Down
29 changes: 15 additions & 14 deletions lib/src/parse/stylesheet.dart
Expand Up @@ -1200,16 +1200,12 @@ abstract class StylesheetParser extends Parser {

ContentBlock? content;
if (contentArguments != null || lookingAtChildren()) {
var contentArguments_ = contentArguments ??
ArgumentDeclaration.empty(span: scanner.emptySpan);
var wasInContentBlock = _inContentBlock;
_inContentBlock = true;
content = _withChildren(
_statement,
start,
(children, span) => ContentBlock(
contentArguments ??
ArgumentDeclaration.empty(span: scanner.emptySpan),
children,
span));
content = _withChildren(_statement, start,
(children, span) => ContentBlock(contentArguments_, children, span));
_inContentBlock = wasInContentBlock;
} else {
expectStatementSeparator();
Expand Down Expand Up @@ -1724,8 +1720,7 @@ relase. For details, see http://bit.ly/moz-document.
}

void addSingleExpression(Expression expression, {bool number = false}) {
var singleExpression = singleExpression_;
if (singleExpression != null) {
if (singleExpression_ != null) {
// If we discover we're parsing a list whose first element is a division
// operation, and we're in parentheses, reparse outside of a paren
// context. This ensures that `(1/2 1)` doesn't perform division on its
Expand All @@ -1740,7 +1735,10 @@ relase. For details, see http://bit.ly/moz-document.

var spaceExpressions = spaceExpressions_ ??= [];
resolveOperations();
spaceExpressions.add(singleExpression);

// [singleExpression_] was non-null before, and [resolveOperations]
// can't make it null, it can only change it.
spaceExpressions.add(singleExpression_!);
allowSlash = number;
} else if (!number) {
allowSlash = false;
Expand Down Expand Up @@ -2025,11 +2023,14 @@ relase. For details, see http://bit.ly/moz-document.
}

var commaExpressions = commaExpressions_ ??= [];
var singleExpression = singleExpression_;
if (singleExpression == null) scanner.error("Expected expression.");

if (singleExpression_ == null) scanner.error("Expected expression.");
resolveSpaceExpressions();
commaExpressions.add(singleExpression);

// [resolveSpaceExpressions can modify [singleExpression_], but it
// can't set it to null`.
commaExpressions.add(singleExpression_!);

scanner.readChar();
allowSlash = true;
singleExpression_ = null;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/visitor/async_evaluate.dart
Expand Up @@ -2232,7 +2232,7 @@ class _EvaluateVisitor
argument.name,
value.withoutSlash(),
evaluated.namedNodes.andGet(argument.name) ??
_expressionNode(argument.defaultValue!));
argument.defaultValue.andThen(_expressionNode));
}

SassArgumentList? argumentList;
Expand Down
4 changes: 2 additions & 2 deletions lib/src/visitor/evaluate.dart
Expand Up @@ -5,7 +5,7 @@
// DO NOT EDIT. This file was generated from async_evaluate.dart.
// See tool/grind/synchronize.dart for details.
//
// Checksum: d0e1d0b2e493163e931c957d869473aa57c5b46b
// Checksum: 01a7ae41ae622e64443597ea82b27b7aeb73d260
//
// ignore_for_file: unused_import

Expand Down Expand Up @@ -2219,7 +2219,7 @@ class _EvaluateVisitor
argument.name,
value.withoutSlash(),
evaluated.namedNodes.andGet(argument.name) ??
_expressionNode(argument.defaultValue!));
argument.defaultValue.andThen(_expressionNode));
}

SassArgumentList? argumentList;
Expand Down
2 changes: 1 addition & 1 deletion lib/src/visitor/serialize.dart
Expand Up @@ -390,7 +390,7 @@ class _SerializeVisitor
}

minimumIndentation =
math.min(minimumIndentation, node.value.span.start.column);
math.min(minimumIndentation, node.name.span.start.column);
_writeWithIndent(value, minimumIndentation);
}

Expand Down

0 comments on commit 481c96b

Please sign in to comment.