Skip to content

Commit 3d3e925

Browse files
authored
Fix --quiet-deps for @content blocks (#2474)
Closes #2418
1 parent 777708c commit 3d3e925

File tree

9 files changed

+43
-19
lines changed

9 files changed

+43
-19
lines changed

CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
1-
## 1.83.1-dev
1+
## 1.83.1
2+
3+
* Fix a bug where `--quiet-deps` would get deactivated for `@content` blocks,
4+
even when those blocks were entirely contained within dependencies.
25

36
* Include deprecation IDs in deprecation warnings to make it easier to determine
47
what to pass to `--silence-deprecation` or `--fatal-deprecation`.

lib/src/visitor/async_evaluate.dart

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,8 +1211,7 @@ final class _EvaluateVisitor
12111211
if (siblings.last != _parent &&
12121212
// Reproduce this condition from [_warn] so that we don't add anything to
12131213
// [interleavedRules] for declarations in dependencies.
1214-
!(_quietDeps &&
1215-
(_inDependency || (_currentCallable?.inDependency ?? false)))) {
1214+
!(_quietDeps && _inDependency)) {
12161215
loop:
12171216
for (var sibling in siblings.skip(siblings.indexOf(_parent) + 1)) {
12181217
switch (sibling) {
@@ -2946,7 +2945,9 @@ final class _EvaluateVisitor
29462945
if (name != "@content") name += "()";
29472946

29482947
var oldCallable = _currentCallable;
2948+
var oldInDependency = _inDependency;
29492949
_currentCallable = callable;
2950+
_inDependency = callable.inDependency;
29502951
var result = await _withStackFrame(name, nodeWithSpan, () {
29512952
// Add an extra closure() call so that modifications to the environment
29522953
// don't affect the underlying environment closure.
@@ -3014,6 +3015,7 @@ final class _EvaluateVisitor
30143015
});
30153016
});
30163017
_currentCallable = oldCallable;
3018+
_inDependency = oldInDependency;
30173019
return result;
30183020
}
30193021

@@ -3873,10 +3875,7 @@ final class _EvaluateVisitor
38733875

38743876
/// Emits a warning with the given [message] about the given [span].
38753877
void _warn(String message, FileSpan span, [Deprecation? deprecation]) {
3876-
if (_quietDeps &&
3877-
(_inDependency || (_currentCallable?.inDependency ?? false))) {
3878-
return;
3879-
}
3878+
if (_quietDeps && _inDependency) return;
38803879

38813880
if (!_warningsEmitted.add((message, span))) return;
38823881
var trace = _stackTrace(span);

lib/src/visitor/evaluate.dart

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
// DO NOT EDIT. This file was generated from async_evaluate.dart.
66
// See tool/grind/synchronize.dart for details.
77
//
8-
// Checksum: e47d81d6a53ba17bf1f6bf37e431c47fc82195e5
8+
// Checksum: 548e54482bead470a6c7931a9d3e098da8b600d6
99
//
1010
// ignore_for_file: unused_import
1111

@@ -1211,8 +1211,7 @@ final class _EvaluateVisitor
12111211
if (siblings.last != _parent &&
12121212
// Reproduce this condition from [_warn] so that we don't add anything to
12131213
// [interleavedRules] for declarations in dependencies.
1214-
!(_quietDeps &&
1215-
(_inDependency || (_currentCallable?.inDependency ?? false)))) {
1214+
!(_quietDeps && _inDependency)) {
12161215
loop:
12171216
for (var sibling in siblings.skip(siblings.indexOf(_parent) + 1)) {
12181217
switch (sibling) {
@@ -2924,7 +2923,9 @@ final class _EvaluateVisitor
29242923
if (name != "@content") name += "()";
29252924

29262925
var oldCallable = _currentCallable;
2926+
var oldInDependency = _inDependency;
29272927
_currentCallable = callable;
2928+
_inDependency = callable.inDependency;
29282929
var result = _withStackFrame(name, nodeWithSpan, () {
29292930
// Add an extra closure() call so that modifications to the environment
29302931
// don't affect the underlying environment closure.
@@ -2991,6 +2992,7 @@ final class _EvaluateVisitor
29912992
});
29922993
});
29932994
_currentCallable = oldCallable;
2995+
_inDependency = oldInDependency;
29942996
return result;
29952997
}
29962998

@@ -3837,10 +3839,7 @@ final class _EvaluateVisitor
38373839

38383840
/// Emits a warning with the given [message] about the given [span].
38393841
void _warn(String message, FileSpan span, [Deprecation? deprecation]) {
3840-
if (_quietDeps &&
3841-
(_inDependency || (_currentCallable?.inDependency ?? false))) {
3842-
return;
3843-
}
3842+
if (_quietDeps && _inDependency) return;
38443843

38453844
if (!_warningsEmitted.add((message, span))) return;
38463845
var trace = _stackTrace(span);

pkg/sass-parser/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 0.4.9-dev
1+
## 0.4.9
22

33
* No user-visible changes.
44

pkg/sass-parser/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sass-parser",
3-
"version": "0.4.9-dev",
3+
"version": "0.4.9",
44
"description": "A PostCSS-compatible wrapper of the official Sass parser",
55
"repository": "sass/sass",
66
"author": "Google Inc.",

pkg/sass_api/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## 15.0.1-dev
1+
## 15.0.1
22

33
* No user-visible changes.
44

pkg/sass_api/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ name: sass_api
22
# Note: Every time we add a new Sass AST node, we need to bump the *major*
33
# version because it's a breaking change for anyone who's implementing the
44
# visitor interface(s).
5-
version: 15.0.1-dev
5+
version: 15.0.1
66
description: Additional APIs for Dart Sass.
77
homepage: https://github.com/sass/dart-sass
88

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: sass
2-
version: 1.83.1-dev
2+
version: 1.83.1
33
description: A Sass implementation in Dart.
44
homepage: https://github.com/sass/dart-sass
55

test/cli/shared.dart

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,6 +487,29 @@ void sharedTests(
487487
expect(sass.stderr, emitsDone);
488488
await sass.shouldExit(0);
489489
});
490+
491+
// Regression test for sass/dart-sass#2418
492+
test("doesn't emit runner warnings in content blocks from local @include",
493+
() async {
494+
await d.file("test.scss", """
495+
@use 'other';
496+
@include other.foo;
497+
""").create();
498+
await d.dir("dir", [
499+
d.file("_other.scss", """
500+
@mixin bar {@content}
501+
@mixin foo {
502+
@include bar {
503+
#{blue} {x: y}
504+
}
505+
}
506+
""")
507+
]).create();
508+
509+
var sass = await runSass(["--quiet-deps", "-I", "dir", "test.scss"]);
510+
expect(sass.stderr, emitsDone);
511+
await sass.shouldExit(0);
512+
});
490513
});
491514

492515
group("silences warnings through @import", () {

0 commit comments

Comments
 (0)