Skip to content

Commit 4cc80c4

Browse files
authored
Update sass_api to 15.4.0 (#277)
1 parent 364b644 commit 4cc80c4

File tree

6 files changed

+23
-23
lines changed

6 files changed

+23
-23
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 2.3.2
2+
3+
* Update to be compatible with the latest version of the Dart Sass AST.
4+
15
## 2.3.1
26

37
### Color Function Migrator

lib/src/migrators/color.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ class _ColorMigrationVisitor extends MigrationVisitor {
167167
{required String channel, bool negate = false, String? space}) sync* {
168168
yield Patch(node.nameSpan, 'adjust');
169169
switch (node.arguments) {
170-
case ArgumentInvocation(positional: [_, var adjustment]):
170+
case ArgumentList(positional: [_, var adjustment]):
171171
yield patchBefore(adjustment, '\$$channel: ${negate ? '-' : ''}');
172172
if (negate && adjustment.needsParens) {
173173
yield patchBefore(adjustment, '(');
@@ -177,7 +177,7 @@ class _ColorMigrationVisitor extends MigrationVisitor {
177177
yield patchAfter(adjustment, ', \$space: $space');
178178
}
179179

180-
case ArgumentInvocation(
180+
case ArgumentList(
181181
named: {'amount': var adjustment} || {'degrees': var adjustment}
182182
):
183183
var start = adjustment.span.start.offset - 1;

lib/src/migrators/division.dart

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -165,11 +165,10 @@ class _DivisionMigrationVisitor extends MigrationVisitor {
165165
return '$namespace.';
166166
}
167167

168-
/// Allows division within this argument invocation.
168+
/// Allows division within this argument list.
169169
@override
170-
void visitArgumentInvocation(ArgumentInvocation invocation,
171-
{bool inCalcContext = false}) {
172-
_withContext(() => super.visitArgumentInvocation(invocation),
170+
void visitArgumentList(ArgumentList arguments, {bool inCalcContext = false}) {
171+
_withContext(() => super.visitArgumentList(arguments),
173172
isDivisionAllowed: true, inCalcContext: inCalcContext);
174173
}
175174

@@ -195,7 +194,7 @@ class _DivisionMigrationVisitor extends MigrationVisitor {
195194
void visitFunctionExpression(FunctionExpression node) {
196195
if (_tryColorFunction(node)) return;
197196
var validCalcs = _calcFunctions.difference(currentScope.allFunctionNames);
198-
visitArgumentInvocation(node.arguments,
197+
visitArgumentList(node.arguments,
199198
inCalcContext:
200199
node.namespace == null && validCalcs.contains(node.name));
201200
}
@@ -274,15 +273,12 @@ class _DivisionMigrationVisitor extends MigrationVisitor {
274273
}
275274

276275
var channels = switch (node.arguments) {
277-
ArgumentInvocation(
276+
ArgumentList(
278277
positional: [ListExpression arg],
279278
named: Map(isEmpty: true)
280279
) =>
281280
arg,
282-
ArgumentInvocation(
283-
positional: [],
284-
named: {r'$channels': ListExpression arg}
285-
) =>
281+
ArgumentList(positional: [], named: {r'$channels': ListExpression arg}) =>
286282
arg,
287283
_ => null,
288284
};

lib/src/util/scoped_ast_visitor.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,9 @@ abstract class ScopedAstVisitor
6262
@override
6363
void visitCallableDeclaration(CallableDeclaration node) {
6464
scoped(() {
65-
for (var argument in node.arguments.arguments) {
66-
currentScope.variables[argument.name] = MemberDeclaration(argument);
67-
if (argument.defaultValue case var defaultValue?) {
65+
for (var parameter in node.parameters.parameters) {
66+
currentScope.variables[parameter.name] = MemberDeclaration(parameter);
67+
if (parameter.defaultValue case var defaultValue?) {
6868
visitExpression(defaultValue);
6969
}
7070
}

lib/src/utils.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,13 +157,13 @@ void emitWarning(String message, [FileSpan? context]) {
157157
}
158158
}
159159

160-
/// Returns the only argument in [invocation], or null if [invocation] does not
160+
/// Returns the only argument in [arguments], or null if [arguments] does not
161161
/// contain exactly one argument.
162-
Expression? getOnlyArgument(ArgumentInvocation invocation) {
163-
if (invocation.positional.length == 0 && invocation.named.length == 1) {
164-
return invocation.named.values.first;
165-
} else if (invocation.positional.length == 1 && invocation.named.isEmpty) {
166-
return invocation.positional.first;
162+
Expression? getOnlyArgument(ArgumentList arguments) {
163+
if (arguments.positional.length == 0 && arguments.named.length == 1) {
164+
return arguments.named.values.first;
165+
} else if (arguments.positional.length == 1 && arguments.named.isEmpty) {
166+
return arguments.positional.first;
167167
} else {
168168
return null;
169169
}

pubspec.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: sass_migrator
2-
version: 2.3.1
2+
version: 2.3.2
33
description: A tool for running migrations on Sass files
44
homepage: https://github.com/sass/migrator
55

@@ -17,7 +17,7 @@ dependencies:
1717
node_interop: ^2.0.2
1818
node_io: ^2.3.0
1919
path: ^1.8.0
20-
sass_api: ^14.4.0
20+
sass_api: ^15.4.0
2121
source_span: ^1.8.1
2222
stack_trace: ^1.10.0
2323
string_scanner: ^1.1.0

0 commit comments

Comments
 (0)