22// MIT-style license that can be found in the LICENSE file or at
33// https://opensource.org/licenses/MIT.
44
5+ // DO NOT EDIT. This file was generated from async_evaluate.dart.
6+ // See tool/synchronize.dart for details.
7+ //
8+ // Checksum: ef8fa3966d7580d8511d8d8430a8f65cd9cb9018
9+
510import 'dart:math' as math;
611
712import 'package:charcode/charcode.dart' ;
@@ -13,9 +18,9 @@ import 'package:tuple/tuple.dart';
1318import '../ast/css.dart' ;
1419import '../ast/sass.dart' ;
1520import '../ast/selector.dart' ;
21+ import '../environment.dart' ;
1622import '../callable.dart' ;
1723import '../color_names.dart' ;
18- import '../environment.dart' ;
1924import '../exception.dart' ;
2025import '../extend/extender.dart' ;
2126import '../importer.dart' ;
@@ -29,7 +34,7 @@ import 'interface/statement.dart';
2934import 'interface/expression.dart' ;
3035
3136/// A function that takes a callback with no arguments.
32- typedef _ScopeCallback (callback ());
37+ typedef void _ScopeCallback (void callback ());
3338
3439/// The URL used in stack traces when no source URL is available.
3540final _noSourceUrl = Uri .parse ("-" );
@@ -301,12 +306,12 @@ class _EvaluateVisitor
301306 }
302307
303308 Value visitAtRootRule (AtRootRule node) {
304- var query = node.query == null
305- ? AtRootQuery .defaultQuery
306- : _adjustParseError (
307- node.query.span,
308- () => new AtRootQuery .parse (
309- _performInterpolation (node.query, warnForColor : true )));
309+ var query = AtRootQuery .defaultQuery;
310+ if (node.query != null ) {
311+ var resolved = _performInterpolation (node.query, warnForColor : true );
312+ query = _adjustParseError (
313+ node.query.span, () => new AtRootQuery .parse (resolved));
314+ }
310315
311316 var parent = _parent;
312317 var included = < CssParentNode > [];
@@ -384,7 +389,7 @@ class _EvaluateVisitor
384389 /// [_parent] to [newParent] .
385390 _ScopeCallback _scopeForAtRoot (CssParentNode newParent, AtRootQuery query,
386391 List <CssParentNode > included) {
387- var scope = (callback ()) {
392+ var scope = (void callback ()) {
388393 // We can't use [_withParent] here because it'll add the node to the tree
389394 // in the wrong place.
390395 var oldParent = _parent;
@@ -623,11 +628,13 @@ class _EvaluateVisitor
623628 }
624629
625630 Value visitIfRule (IfRule node) {
626- var clause = node.clauses
627- .firstWhere ((pair) => pair.item1.accept (this ).isTruthy,
628- orElse: () => null )
629- ? .item2 ??
630- node.lastClause;
631+ var clause = node.lastClause;
632+ for (var pair in node.clauses) {
633+ if (pair.item1.accept (this ).isTruthy) {
634+ clause = pair.item2;
635+ break ;
636+ }
637+ }
631638 if (clause == null ) return null ;
632639
633640 return _environment.scope (
@@ -802,18 +809,16 @@ class _EvaluateVisitor
802809 throw _exception ("Mixin doesn't accept a content block." , node.span);
803810 }
804811
805- Value callback () {
806- _environment.asMixin (() {
807- for (var statement in mixin .declaration.children) {
808- statement.accept (this );
809- }
810- });
811- return null ;
812- }
813-
814812 var environment = node.children == null ? null : _environment.closure ();
815813 _runUserDefinedCallable (node.arguments, mixin , node.span, () {
816- _environment.withContent (node.children, environment, callback);
814+ _environment.withContent (node.children, environment, () {
815+ _environment.asMixin (() {
816+ for (var statement in mixin .declaration.children) {
817+ statement.accept (this );
818+ }
819+ });
820+ return null ;
821+ });
817822 });
818823
819824 return null ;
@@ -876,11 +881,13 @@ class _EvaluateVisitor
876881
877882 /// Evaluates [interpolation] and parses the result as a list of media
878883 /// queries.
879- List <CssMediaQuery > _visitMediaQueries (Interpolation interpolation) =>
880- _adjustParseError (
881- interpolation.span,
882- () => CssMediaQuery .parseList (
883- _performInterpolation (interpolation, warnForColor: true )));
884+ List <CssMediaQuery > _visitMediaQueries (Interpolation interpolation) {
885+ var resolved = _performInterpolation (interpolation, warnForColor: true );
886+
887+ // TODO(nweiz): Remove this type argument when sdk#31398 is fixed.
888+ return _adjustParseError <List <CssMediaQuery >>(
889+ interpolation.span, () => CssMediaQuery .parseList (resolved));
890+ }
884891
885892 /// Returns a list of queries that selects for platforms that match both
886893 /// [queries1] and [queries2] .
@@ -1176,7 +1183,7 @@ class _EvaluateVisitor
11761183 SassColor visitColorExpression (ColorExpression node) => node.value;
11771184
11781185 SassList visitListExpression (ListExpression node) => new SassList (
1179- node.contents.map ((expression) => expression.accept (this )),
1186+ node.contents.map ((Expression expression) => expression.accept (this )),
11801187 node.separator,
11811188 brackets: node.hasBrackets);
11821189
@@ -1375,7 +1382,7 @@ class _EvaluateVisitor
13751382 Tuple3 <List <Value >, Map <String , Value >, ListSeparator > _evaluateArguments (
13761383 ArgumentInvocation arguments, FileSpan span) {
13771384 var positional = arguments.positional
1378- .map ((expression) => expression.accept (this ))
1385+ .map ((Expression expression) => expression.accept (this ))
13791386 .toList ();
13801387 var named = normalizedMapMap <String , Expression , Value >(arguments.named,
13811388 value: (_, expression) => expression.accept (this ));
0 commit comments