@@ -15,6 +15,7 @@ import '../exception.dart';
15
15
import '../interpolation_buffer.dart' ;
16
16
import '../util/character.dart' ;
17
17
import '../utils.dart' ;
18
+ import '../util/multi_span.dart' ;
18
19
import '../util/nullable.dart' ;
19
20
import '../value.dart' ;
20
21
import 'parser.dart' ;
@@ -1832,6 +1833,7 @@ abstract class StylesheetParser extends Parser {
1832
1833
var named = < String , Expression > {};
1833
1834
Expression ? rest;
1834
1835
Expression ? keywordRest;
1836
+ var emittedRestDeprecation = false ;
1835
1837
while (_lookingAtExpression ()) {
1836
1838
var expression = expressionUntilComma (singleEquals: ! mixin );
1837
1839
whitespace (consumeNewlines: true );
@@ -1842,6 +1844,19 @@ abstract class StylesheetParser extends Parser {
1842
1844
error ("Duplicate argument." , expression.span);
1843
1845
}
1844
1846
named[expression.name] = expressionUntilComma (singleEquals: ! mixin );
1847
+
1848
+ if (rest != null && ! emittedRestDeprecation) {
1849
+ emittedRestDeprecation = true ;
1850
+ warnings.add ((
1851
+ deprecation: Deprecation .misplacedRest,
1852
+ message: 'Named arguments must come before rest arguments.\n '
1853
+ 'This will be an error in Dart Sass 2.0.0.' ,
1854
+ span: MultiSpan (
1855
+ scanner.spanFromPosition (expression.span.start.offset),
1856
+ 'named argument' ,
1857
+ {rest.span: 'rest argument' })
1858
+ ));
1859
+ }
1845
1860
} else if (scanner.scanChar ($dot)) {
1846
1861
scanner.expectChar ($dot);
1847
1862
scanner.expectChar ($dot);
@@ -1860,6 +1875,17 @@ abstract class StylesheetParser extends Parser {
1860
1875
);
1861
1876
} else {
1862
1877
positional.add (expression);
1878
+
1879
+ if (rest != null && ! emittedRestDeprecation) {
1880
+ emittedRestDeprecation = true ;
1881
+ warnings.add ((
1882
+ deprecation: Deprecation .misplacedRest,
1883
+ message: 'Positional arguments must come before rest arguments.\n '
1884
+ 'This will be an error in Dart Sass 2.0.0.' ,
1885
+ span: MultiSpan (expression.span, 'positional argument' ,
1886
+ {rest.span: 'rest argument' })
1887
+ ));
1888
+ }
1863
1889
}
1864
1890
1865
1891
whitespace (consumeNewlines: true );
0 commit comments