@@ -38,7 +38,7 @@ class ParserState extends TokenizerState {
3838
3939void _createMessages ({List <Message >? errors, PreprocessorOptions ? options}) {
4040 errors ?? = [];
41- options ?? = PreprocessorOptions (useColors: false , inputFile: 'memory' );
41+ options ?? = const PreprocessorOptions (useColors: false , inputFile: 'memory' );
4242
4343 messages = Messages (options: options, printHandler: errors.add);
4444}
@@ -258,24 +258,18 @@ class _Parser {
258258 ///////////////////////////////////////////////////////////////////
259259 // Basic support methods
260260 ///////////////////////////////////////////////////////////////////
261- int _peek () {
262- return _peekToken.kind;
263- }
261+ int _peek () => _peekToken.kind;
264262
265263 Token _next ({bool unicodeRange = false }) {
266264 final next = _previousToken = _peekToken;
267265 _peekToken = tokenizer.next (unicodeRange: unicodeRange);
268266 return next;
269267 }
270268
271- bool _peekKind (int kind) {
272- return _peekToken.kind == kind;
273- }
269+ bool _peekKind (int kind) => _peekToken.kind == kind;
274270
275271 // Is the next token a legal identifier? This includes pseudo-keywords.
276- bool _peekIdentifier () {
277- return TokenKind .isIdentifier (_peekToken.kind);
278- }
272+ bool _peekIdentifier () => TokenKind .isIdentifier (_peekToken.kind);
279273
280274 /// Marks the parser/tokenizer look ahead to support Less nested selectors.
281275 ParserState get _mark => ParserState (_peekToken, _previousToken, tokenizer);
@@ -792,9 +786,8 @@ class _Parser {
792786 }
793787
794788 var declGroup = processDeclarations (checkBrace: false );
795- if (declGroup.declarations.any ((decl) {
796- return decl is Declaration && decl is ! IncludeMixinAtDeclaration ;
797- })) {
789+ if (declGroup.declarations.any ((decl) =>
790+ decl is Declaration && decl is ! IncludeMixinAtDeclaration )) {
798791 var newDecls = < Declaration > [];
799792 for (var include in productions) {
800793 // If declGroup has items that are declarations then we assume
@@ -2038,40 +2031,31 @@ class _Parser {
20382031 DartStyleExpression ? processOneNumber (Expressions exprs, int part) {
20392032 var value = marginValue (exprs.expressions[0 ]);
20402033 if (value != null ) {
2041- switch (part) {
2042- case _marginPartLeft:
2043- return MarginExpression (exprs.span, left: value);
2044- case _marginPartTop:
2045- return MarginExpression (exprs.span, top: value);
2046- case _marginPartRight:
2047- return MarginExpression (exprs.span, right: value);
2048- case _marginPartBottom:
2049- return MarginExpression (exprs.span, bottom: value);
2050- case _borderPartLeft:
2051- case _borderPartLeftWidth:
2052- return BorderExpression (exprs.span, left: value);
2053- case _borderPartTop:
2054- case _borderPartTopWidth:
2055- return BorderExpression (exprs.span, top: value);
2056- case _borderPartRight:
2057- case _borderPartRightWidth:
2058- return BorderExpression (exprs.span, right: value);
2059- case _borderPartBottom:
2060- case _borderPartBottomWidth:
2061- return BorderExpression (exprs.span, bottom: value);
2062- case _heightPart:
2063- return HeightExpression (exprs.span, value);
2064- case _widthPart:
2065- return WidthExpression (exprs.span, value);
2066- case _paddingPartLeft:
2067- return PaddingExpression (exprs.span, left: value);
2068- case _paddingPartTop:
2069- return PaddingExpression (exprs.span, top: value);
2070- case _paddingPartRight:
2071- return PaddingExpression (exprs.span, right: value);
2072- case _paddingPartBottom:
2073- return PaddingExpression (exprs.span, bottom: value);
2074- }
2034+ return switch (part) {
2035+ _marginPartLeft => MarginExpression (exprs.span, left: value),
2036+ _marginPartTop => MarginExpression (exprs.span, top: value),
2037+ _marginPartRight => MarginExpression (exprs.span, right: value),
2038+ _marginPartBottom => MarginExpression (exprs.span, bottom: value),
2039+ _borderPartLeft ||
2040+ _borderPartLeftWidth =>
2041+ BorderExpression (exprs.span, left: value),
2042+ _borderPartTop ||
2043+ _borderPartTopWidth =>
2044+ BorderExpression (exprs.span, top: value),
2045+ _borderPartRight ||
2046+ _borderPartRightWidth =>
2047+ BorderExpression (exprs.span, right: value),
2048+ _borderPartBottom ||
2049+ _borderPartBottomWidth =>
2050+ BorderExpression (exprs.span, bottom: value),
2051+ _heightPart => HeightExpression (exprs.span, value),
2052+ _widthPart => WidthExpression (exprs.span, value),
2053+ _paddingPartLeft => PaddingExpression (exprs.span, left: value),
2054+ _paddingPartTop => PaddingExpression (exprs.span, top: value),
2055+ _paddingPartRight => PaddingExpression (exprs.span, right: value),
2056+ _paddingPartBottom => PaddingExpression (exprs.span, bottom: value),
2057+ _ => null
2058+ };
20752059 }
20762060 return null ;
20772061 }
0 commit comments