Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the parsing of supports function in static imports #1514

Merged
merged 1 commit into from Oct 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
29 changes: 24 additions & 5 deletions lib/src/parse/stylesheet.dart
Expand Up @@ -1150,11 +1150,30 @@ abstract class StylesheetParser extends Parser {
} else if (scanner.peekChar() == $lparen) {
supports = _supportsCondition();
} else {
var name = expression();
scanner.expectChar($colon);
whitespace();
var value = expression();
supports = SupportsDeclaration(name, value, scanner.spanFrom(start));
if (_lookingAtInterpolatedIdentifier()) {
var identifier = interpolatedIdentifier();
if (identifier.asPlain?.toLowerCase() == "not") {
error('"not" is not a valid identifier here.', identifier.span);
}

if (scanner.scanChar($lparen)) {
var arguments = _interpolatedDeclarationValue(
allowEmpty: true, allowSemicolon: true);
scanner.expectChar($rparen);
supports = SupportsFunction(
identifier, arguments, scanner.spanFrom(start));
} else {
// Backtrack to parse a variable declaration
scanner.state = start;
}
}
if (supports == null) {
var name = expression();
scanner.expectChar($colon);
whitespace();
var value = expression();
supports = SupportsDeclaration(name, value, scanner.spanFrom(start));
}
}
scanner.expectChar($rparen);
whitespace();
Expand Down