diff --git a/lib/src/ast/sass/statement/function_rule.dart b/lib/src/ast/sass/statement/function_rule.dart index 9242bf858..885bd4ef9 100644 --- a/lib/src/ast/sass/statement/function_rule.dart +++ b/lib/src/ast/sass/statement/function_rule.dart @@ -6,11 +6,8 @@ import 'package:source_span/source_span.dart'; import '../../../util/span.dart'; import '../../../visitor/interface/statement.dart'; -import '../argument_declaration.dart'; import '../declaration.dart'; -import '../statement.dart'; import 'callable_declaration.dart'; -import 'silent_comment.dart'; /// A function declaration. /// @@ -21,10 +18,8 @@ final class FunctionRule extends CallableDeclaration implements SassDeclaration { FileSpan get nameSpan => span.withoutInitialAtRule().initialIdentifier(); - FunctionRule(String name, ArgumentDeclaration arguments, - Iterable children, FileSpan span, - {SilentComment? comment}) - : super(name, arguments, children, span, comment: comment); + FunctionRule(super.name, super.arguments, super.children, super.span, + {super.comment}); T accept(StatementVisitor visitor) => visitor.visitFunctionRule(this); diff --git a/lib/src/ast/sass/statement/if_rule.dart b/lib/src/ast/sass/statement/if_rule.dart index 2a92ac28c..0e611df12 100644 --- a/lib/src/ast/sass/statement/if_rule.dart +++ b/lib/src/ast/sass/statement/if_rule.dart @@ -94,7 +94,7 @@ final class IfClause extends IfRuleClause { /// /// {@category AST} final class ElseClause extends IfRuleClause { - ElseClause(Iterable children) : super(children); + ElseClause(super.children); String toString() => "@else {${children.join(' ')}}"; } diff --git a/lib/src/ast/sass/statement/mixin_rule.dart b/lib/src/ast/sass/statement/mixin_rule.dart index 624eff53e..650e64b65 100644 --- a/lib/src/ast/sass/statement/mixin_rule.dart +++ b/lib/src/ast/sass/statement/mixin_rule.dart @@ -7,12 +7,9 @@ import 'package:source_span/source_span.dart'; import '../../../util/span.dart'; import '../../../visitor/interface/statement.dart'; import '../../../visitor/statement_search.dart'; -import '../argument_declaration.dart'; import '../declaration.dart'; -import '../statement.dart'; import 'callable_declaration.dart'; import 'content_rule.dart'; -import 'silent_comment.dart'; /// A mixin declaration. /// @@ -31,10 +28,8 @@ final class MixinRule extends CallableDeclaration implements SassDeclaration { return startSpan.initialIdentifier(); } - MixinRule(String name, ArgumentDeclaration arguments, - Iterable children, FileSpan span, - {SilentComment? comment}) - : super(name, arguments, children, span, comment: comment); + MixinRule(super.name, super.arguments, super.children, super.span, + {super.comment}); T accept(StatementVisitor visitor) => visitor.visitMixinRule(this); diff --git a/lib/src/ast/selector/complex.dart b/lib/src/ast/selector/complex.dart index 3d97729ca..f6d417901 100644 --- a/lib/src/ast/selector/complex.dart +++ b/lib/src/ast/selector/complex.dart @@ -70,11 +70,10 @@ final class ComplexSelector extends Selector { } ComplexSelector(Iterable> leadingCombinators, - Iterable components, FileSpan span, + Iterable components, super.span, {this.lineBreak = false}) : leadingCombinators = List.unmodifiable(leadingCombinators), - components = List.unmodifiable(components), - super(span) { + components = List.unmodifiable(components) { if (this.leadingCombinators.isEmpty && this.components.isEmpty) { throw ArgumentError( "leadingCombinators and components may not both be empty."); diff --git a/lib/src/ast/selector/compound.dart b/lib/src/ast/selector/compound.dart index c36662cb0..bcc2beb33 100644 --- a/lib/src/ast/selector/compound.dart +++ b/lib/src/ast/selector/compound.dart @@ -3,7 +3,6 @@ // https://opensource.org/licenses/MIT. import 'package:meta/meta.dart'; -import 'package:source_span/source_span.dart'; import '../../extend/functions.dart'; import '../../logger.dart'; @@ -43,9 +42,8 @@ final class CompoundSelector extends Selector { SimpleSelector? get singleSimple => components.length == 1 ? components.first : null; - CompoundSelector(Iterable components, FileSpan span) - : components = List.unmodifiable(components), - super(span) { + CompoundSelector(Iterable components, super.span) + : components = List.unmodifiable(components) { if (this.components.isEmpty) { throw ArgumentError("components may not be empty."); } diff --git a/lib/src/ast/selector/list.dart b/lib/src/ast/selector/list.dart index d432bbfaa..4fc24f7f6 100644 --- a/lib/src/ast/selector/list.dart +++ b/lib/src/ast/selector/list.dart @@ -3,7 +3,6 @@ // https://opensource.org/licenses/MIT. import 'package:meta/meta.dart'; -import 'package:source_span/source_span.dart'; import '../../exception.dart'; import '../../extend/functions.dart'; @@ -49,9 +48,8 @@ final class SelectorList extends Selector { }), ListSeparator.comma); } - SelectorList(Iterable components, FileSpan span) - : components = List.unmodifiable(components), - super(span) { + SelectorList(Iterable components, super.span) + : components = List.unmodifiable(components) { if (this.components.isEmpty) { throw ArgumentError("components may not be empty."); } diff --git a/lib/src/ast/selector/parent.dart b/lib/src/ast/selector/parent.dart index 18e898652..06f013f05 100644 --- a/lib/src/ast/selector/parent.dart +++ b/lib/src/ast/selector/parent.dart @@ -3,7 +3,6 @@ // https://opensource.org/licenses/MIT. import 'package:meta/meta.dart'; -import 'package:source_span/source_span.dart'; import '../../visitor/interface/selector.dart'; import '../selector.dart'; @@ -22,7 +21,7 @@ final class ParentSelector extends SimpleSelector { /// indicating that the parent selector will not be modified. final String? suffix; - ParentSelector(FileSpan span, {this.suffix}) : super(span); + ParentSelector(super.span, {this.suffix}); T accept(SelectorVisitor visitor) => visitor.visitParentSelector(this); diff --git a/lib/src/ast/selector/simple.dart b/lib/src/ast/selector/simple.dart index 0526eed72..d8ae7864d 100644 --- a/lib/src/ast/selector/simple.dart +++ b/lib/src/ast/selector/simple.dart @@ -3,7 +3,6 @@ // https://opensource.org/licenses/MIT. import 'package:meta/meta.dart'; -import 'package:source_span/source_span.dart'; import '../../exception.dart'; import '../../logger.dart'; @@ -35,7 +34,7 @@ abstract base class SimpleSelector extends Selector { /// sequence will contain 1000 simple selectors. int get specificity => 1000; - SimpleSelector(FileSpan span) : super(span); + SimpleSelector(super.span); /// Parses a simple selector from [contents]. /// diff --git a/lib/src/ast/selector/universal.dart b/lib/src/ast/selector/universal.dart index d714dcb6a..937377164 100644 --- a/lib/src/ast/selector/universal.dart +++ b/lib/src/ast/selector/universal.dart @@ -3,7 +3,6 @@ // https://opensource.org/licenses/MIT. import 'package:meta/meta.dart'; -import 'package:source_span/source_span.dart'; import '../../extend/functions.dart'; import '../../visitor/interface/selector.dart'; @@ -23,7 +22,7 @@ final class UniversalSelector extends SimpleSelector { int get specificity => 0; - UniversalSelector(FileSpan span, {this.namespace}) : super(span); + UniversalSelector(super.span, {this.namespace}); T accept(SelectorVisitor visitor) => visitor.visitUniversalSelector(this); diff --git a/lib/src/configuration.dart b/lib/src/configuration.dart index 1a65d236a..2bb069480 100644 --- a/lib/src/configuration.dart +++ b/lib/src/configuration.dart @@ -119,8 +119,7 @@ final class ExplicitConfiguration extends Configuration { /// Creates a base [ExplicitConfiguration] with a [values] map and a /// [nodeWithSpan]. - ExplicitConfiguration(Map values, this.nodeWithSpan) - : super.implicit(values); + ExplicitConfiguration(super.values, this.nodeWithSpan) : super.implicit(); /// Creates an [ExplicitConfiguration] with a [values] map, a [nodeWithSpan] /// and if this is a copy a reference to the [_originalConfiguration]. diff --git a/lib/src/embedded/importer/file.dart b/lib/src/embedded/importer/file.dart index edd0d3537..d6096eb7b 100644 --- a/lib/src/embedded/importer/file.dart +++ b/lib/src/embedded/importer/file.dart @@ -3,7 +3,6 @@ // https://opensource.org/licenses/MIT. import '../../importer.dart'; -import '../compilation_dispatcher.dart'; import '../embedded_sass.pb.dart' hide SourceSpan; import 'base.dart'; @@ -19,8 +18,7 @@ final class FileImporter extends ImporterBase { /// The host-provided ID of the importer to invoke. final int _importerId; - FileImporter(CompilationDispatcher dispatcher, this._importerId) - : super(dispatcher); + FileImporter(super.dispatcher, this._importerId); Uri? canonicalize(Uri url) { if (url.scheme == 'file') return _filesystemImporter.canonicalize(url); diff --git a/lib/src/embedded/importer/host.dart b/lib/src/embedded/importer/host.dart index 66e60848a..25245721b 100644 --- a/lib/src/embedded/importer/host.dart +++ b/lib/src/embedded/importer/host.dart @@ -6,7 +6,6 @@ import '../../exception.dart'; import '../../importer.dart'; import '../../importer/utils.dart'; import '../../util/span.dart'; -import '../compilation_dispatcher.dart'; import '../embedded_sass.pb.dart' hide SourceSpan; import '../utils.dart'; import 'base.dart'; @@ -20,10 +19,9 @@ final class HostImporter extends ImporterBase { /// [canonicalize]. final Set _nonCanonicalSchemes; - HostImporter(CompilationDispatcher dispatcher, this._importerId, - Iterable nonCanonicalSchemes) - : _nonCanonicalSchemes = Set.unmodifiable(nonCanonicalSchemes), - super(dispatcher) { + HostImporter( + super.dispatcher, this._importerId, Iterable nonCanonicalSchemes) + : _nonCanonicalSchemes = Set.unmodifiable(nonCanonicalSchemes) { for (var scheme in _nonCanonicalSchemes) { if (isValidUrlScheme(scheme)) continue; throw SassException( diff --git a/lib/src/exception.dart b/lib/src/exception.dart index 38a1a057e..69dbbe7e5 100644 --- a/lib/src/exception.dart +++ b/lib/src/exception.dart @@ -28,10 +28,9 @@ class SassException extends SourceSpanException { /// compilation, before it failed. final Set loadedUrls; - SassException(String message, FileSpan span, [Iterable? loadedUrls]) + SassException(super.message, FileSpan super.span, [Iterable? loadedUrls]) : loadedUrls = - loadedUrls == null ? const {} : Set.unmodifiable(loadedUrls), - super(message, span); + loadedUrls == null ? const {} : Set.unmodifiable(loadedUrls); /// Converts this to a [MultiSpanSassException] with the additional [span] and /// [label]. @@ -224,9 +223,7 @@ class SassFormatException extends SassException SassFormatException withLoadedUrls(Iterable loadedUrls) => SassFormatException(message, span, loadedUrls); - SassFormatException(String message, FileSpan span, - [Iterable? loadedUrls]) - : super(message, span, loadedUrls); + SassFormatException(super.message, super.span, [super.loadedUrls]); } /// A [SassFormatException] that's also a [MultiSpanFormatException]. @@ -248,10 +245,9 @@ class MultiSpanSassFormatException extends MultiSpanSassException MultiSpanSassFormatException( message, span, primaryLabel, secondarySpans, loadedUrls); - MultiSpanSassFormatException(String message, FileSpan span, - String primaryLabel, Map secondarySpans, - [Iterable? loadedUrls]) - : super(message, span, primaryLabel, secondarySpans, loadedUrls); + MultiSpanSassFormatException( + super.message, super.span, super.primaryLabel, super.secondarySpans, + [super.loadedUrls]); } /// An exception thrown by SassScript. @@ -287,9 +283,8 @@ class MultiSpanSassScriptException extends SassScriptException { final Map secondarySpans; MultiSpanSassScriptException( - String message, this.primaryLabel, Map secondarySpans) - : secondarySpans = Map.unmodifiable(secondarySpans), - super(message); + super.message, this.primaryLabel, Map secondarySpans) + : secondarySpans = Map.unmodifiable(secondarySpans); /// Converts this to a [SassException] with the given primary [span]. MultiSpanSassException withSpan(FileSpan span) => diff --git a/lib/src/extend/functions.dart b/lib/src/extend/functions.dart index 6299c5fcf..01d70d248 100644 --- a/lib/src/extend/functions.dart +++ b/lib/src/extend/functions.dart @@ -9,6 +9,7 @@ /// aren't instance methods on other objects because their APIs aren't a good /// fit—usually because they deal with raw component lists rather than selector /// classes, to reduce allocations. +library; import 'dart:collection'; diff --git a/lib/src/parse/at_root_query.dart b/lib/src/parse/at_root_query.dart index 11eee11f2..a107458c1 100644 --- a/lib/src/parse/at_root_query.dart +++ b/lib/src/parse/at_root_query.dart @@ -5,16 +5,12 @@ import 'package:charcode/charcode.dart'; import '../ast/sass.dart'; -import '../interpolation_map.dart'; -import '../logger.dart'; import 'parser.dart'; /// A parser for `@at-root` queries. class AtRootQueryParser extends Parser { - AtRootQueryParser(String contents, - {Object? url, Logger? logger, InterpolationMap? interpolationMap}) - : super(contents, - url: url, logger: logger, interpolationMap: interpolationMap); + AtRootQueryParser(super.contents, + {super.url, super.logger, super.interpolationMap}); AtRootQuery parse() { return wrapSpanFormatException(() { diff --git a/lib/src/parse/css.dart b/lib/src/parse/css.dart index 6ed9123b7..754a3614a 100644 --- a/lib/src/parse/css.dart +++ b/lib/src/parse/css.dart @@ -7,7 +7,6 @@ import 'package:string_scanner/string_scanner.dart'; import '../ast/sass.dart'; import '../functions.dart'; -import '../logger.dart'; import 'scss.dart'; /// The set of all function names disallowed in plain CSS. @@ -31,8 +30,7 @@ final _disallowedFunctionNames = class CssParser extends ScssParser { bool get plainCss => true; - CssParser(String contents, {Object? url, Logger? logger}) - : super(contents, url: url, logger: logger); + CssParser(super.contents, {super.url, super.logger}); void silentComment() { var start = scanner.state; diff --git a/lib/src/parse/keyframe_selector.dart b/lib/src/parse/keyframe_selector.dart index 71908c3e3..25a690813 100644 --- a/lib/src/parse/keyframe_selector.dart +++ b/lib/src/parse/keyframe_selector.dart @@ -4,17 +4,13 @@ import 'package:charcode/charcode.dart'; -import '../interpolation_map.dart'; -import '../logger.dart'; import '../util/character.dart'; import 'parser.dart'; /// A parser for `@keyframes` block selectors. class KeyframeSelectorParser extends Parser { - KeyframeSelectorParser(String contents, - {Object? url, Logger? logger, InterpolationMap? interpolationMap}) - : super(contents, - url: url, logger: logger, interpolationMap: interpolationMap); + KeyframeSelectorParser(super.contents, + {super.url, super.logger, super.interpolationMap}); List parse() { return wrapSpanFormatException(() { diff --git a/lib/src/parse/media_query.dart b/lib/src/parse/media_query.dart index be86a1994..ce54dae57 100644 --- a/lib/src/parse/media_query.dart +++ b/lib/src/parse/media_query.dart @@ -5,17 +5,13 @@ import 'package:charcode/charcode.dart'; import '../ast/css.dart'; -import '../interpolation_map.dart'; -import '../logger.dart'; import '../utils.dart'; import 'parser.dart'; /// A parser for `@media` queries. class MediaQueryParser extends Parser { - MediaQueryParser(String contents, - {Object? url, Logger? logger, InterpolationMap? interpolationMap}) - : super(contents, - url: url, logger: logger, interpolationMap: interpolationMap); + MediaQueryParser(super.contents, + {super.url, super.logger, super.interpolationMap}); List parse() { return wrapSpanFormatException(() { diff --git a/lib/src/parse/sass.dart b/lib/src/parse/sass.dart index 95fd054c5..78dea3179 100644 --- a/lib/src/parse/sass.dart +++ b/lib/src/parse/sass.dart @@ -7,7 +7,6 @@ import 'package:string_scanner/string_scanner.dart'; import '../ast/sass.dart'; import '../interpolation_buffer.dart'; -import '../logger.dart'; import '../util/character.dart'; import '../value.dart'; import 'stylesheet.dart'; @@ -38,8 +37,7 @@ class SassParser extends StylesheetParser { bool get indented => true; - SassParser(String contents, {Object? url, Logger? logger}) - : super(contents, url: url, logger: logger); + SassParser(super.contents, {super.url, super.logger}); Interpolation styleRuleSelector() { var start = scanner.state; diff --git a/lib/src/parse/scss.dart b/lib/src/parse/scss.dart index cc432e9c8..67b5c0f4b 100644 --- a/lib/src/parse/scss.dart +++ b/lib/src/parse/scss.dart @@ -16,8 +16,7 @@ class ScssParser extends StylesheetParser { bool get indented => false; int get currentIndentation => 0; - ScssParser(String contents, {Object? url, Logger? logger}) - : super(contents, url: url, logger: logger); + ScssParser(super.contents, {super.url, super.logger}); Interpolation styleRuleSelector() => almostAnyValue(); diff --git a/lib/src/parse/selector.dart b/lib/src/parse/selector.dart index 75df8b205..0e5b7a04f 100644 --- a/lib/src/parse/selector.dart +++ b/lib/src/parse/selector.dart @@ -6,8 +6,6 @@ import 'package:charcode/charcode.dart'; import '../ast/css/value.dart'; import '../ast/selector.dart'; -import '../interpolation_map.dart'; -import '../logger.dart'; import '../util/character.dart'; import '../utils.dart'; import 'parser.dart'; @@ -36,16 +34,14 @@ class SelectorParser extends Parser { /// Whether this parser allows placeholder selectors beginning with `%`. final bool _allowPlaceholder; - SelectorParser(String contents, - {Object? url, - Logger? logger, - InterpolationMap? interpolationMap, + SelectorParser(super.contents, + {super.url, + super.logger, + super.interpolationMap, bool allowParent = true, bool allowPlaceholder = true}) : _allowParent = allowParent, - _allowPlaceholder = allowPlaceholder, - super(contents, - url: url, logger: logger, interpolationMap: interpolationMap); + _allowPlaceholder = allowPlaceholder; SelectorList parse() { return wrapSpanFormatException(() { diff --git a/lib/src/parse/stylesheet.dart b/lib/src/parse/stylesheet.dart index 23c53952e..15c568f66 100644 --- a/lib/src/parse/stylesheet.dart +++ b/lib/src/parse/stylesheet.dart @@ -69,8 +69,7 @@ abstract class StylesheetParser extends Parser { @protected SilentComment? lastSilentComment; - StylesheetParser(String contents, {Object? url, Logger? logger}) - : super(contents, url: url, logger: logger); + StylesheetParser(super.contents, {super.url, super.logger}); // ## Statements diff --git a/lib/src/value/argument_list.dart b/lib/src/value/argument_list.dart index f9b4b5014..23de2db7a 100644 --- a/lib/src/value/argument_list.dart +++ b/lib/src/value/argument_list.dart @@ -42,8 +42,6 @@ class SassArgumentList extends SassList { bool get wereKeywordsAccessed => _wereKeywordsAccessed; var _wereKeywordsAccessed = false; - SassArgumentList(Iterable contents, Map keywords, - ListSeparator separator) - : _keywords = Map.unmodifiable(keywords), - super(contents, separator); + SassArgumentList(super.contents, Map keywords, super.separator) + : _keywords = Map.unmodifiable(keywords); } diff --git a/lib/src/value/number/unitless.dart b/lib/src/value/number/unitless.dart index 7272b7c59..a81d1d9a9 100644 --- a/lib/src/value/number/unitless.dart +++ b/lib/src/value/number/unitless.dart @@ -19,8 +19,7 @@ class UnitlessSassNumber extends SassNumber { bool get hasUnits => false; bool get hasComplexUnits => false; - UnitlessSassNumber(double value, [(SassNumber, SassNumber)? asSlash]) - : super.protected(value, asSlash); + UnitlessSassNumber(super.value, [super.asSlash]) : super.protected(); SassNumber withValue(num value) => UnitlessSassNumber(value.toDouble());