Skip to content

Commit

Permalink
Fix dart analyze warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
ntkme committed Oct 25, 2024
1 parent 477b596 commit 1fcdf8d
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 17 deletions.
1 change: 1 addition & 0 deletions lib/src/deprecation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ enum Deprecation {
isFuture = false;

/// Constructs a future deprecation.
// ignore: unused_element
const Deprecation.future(this.id, {this.description})
: _deprecatedIn = null,
_obsoleteIn = null,
Expand Down
14 changes: 7 additions & 7 deletions lib/src/embedded/compilation_dispatcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ final class CompilationDispatcher {

try {
var importers = request.importers.map((importer) =>
_decodeImporter(request, importer) ??
_decodeImporter(importer) ??
(throw mandatoryError("Importer.importer")));

var globalFunctions = request.globalFunctions
Expand All @@ -159,7 +159,7 @@ final class CompilationDispatcher {
color: request.alertColor,
logger: logger,
importers: importers,
importer: _decodeImporter(request, input.importer) ??
importer: _decodeImporter(input.importer) ??
(input.url.startsWith("file:") ? null : sass.Importer.noOp),
functions: globalFunctions,
syntax: syntaxToSyntax(input.syntax),
Expand Down Expand Up @@ -234,7 +234,7 @@ final class CompilationDispatcher {
}

/// Converts [importer] into a [sass.Importer].
sass.Importer? _decodeImporter(InboundMessage_CompileRequest request,
sass.Importer? _decodeImporter(
InboundMessage_CompileRequest_Importer importer) {
switch (importer.whichImporter()) {
case InboundMessage_CompileRequest_Importer_Importer.path:
Expand All @@ -249,13 +249,13 @@ final class CompilationDispatcher {
_checkNoNonCanonicalScheme(importer);
return FileImporter(this, importer.fileImporterId);

case InboundMessage_CompileRequest_Importer_Importer.notSet:
_checkNoNonCanonicalScheme(importer);
return null;

case InboundMessage_CompileRequest_Importer_Importer.nodePackageImporter:
return npi.NodePackageImporter(
importer.nodePackageImporter.entryPointDirectory);

case InboundMessage_CompileRequest_Importer_Importer.notSet:
_checkNoNonCanonicalScheme(importer);
return null;
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/src/functions/color.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1610,7 +1610,7 @@ BuiltInCallable _channelFunction(
warnForDeprecation(
"${global ? '' : 'color.'}$name() is deprecated. Suggestion:\n"
"\n"
'color.channel(\$color, \"$name\", \$space: $space)\n'
'color.channel(\$color, "$name", \$space: $space)\n'
"\n"
"More info: https://sass-lang.com/d/color-functions",
Deprecation.colorFunctions);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/parse/parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ class Parser {
var span = scanner.spanFrom(state);
return _interpolationMap == null
? span
: LazyFileSpan(() => _interpolationMap!.mapSpan(span));
: LazyFileSpan(() => _interpolationMap.mapSpan(span));
}

/// Throws an error associated with [span].
Expand Down
2 changes: 1 addition & 1 deletion lib/src/visitor/async_evaluate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1812,7 +1812,7 @@ final class _EvaluateVisitor
if (result != null) {
isDependency = _inDependency;
} else {
result = await _nodeImporter!.loadAsync(originalUrl, previous, forImport);
result = await _nodeImporter.loadAsync(originalUrl, previous, forImport);
if (result == null) return null;
isDependency = true;
}
Expand Down
4 changes: 2 additions & 2 deletions lib/src/visitor/evaluate.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
// DO NOT EDIT. This file was generated from async_evaluate.dart.
// See tool/grind/synchronize.dart for details.
//
// Checksum: 396c8f169d95c601598b8c3be1f4b948ca22effa
// Checksum: 3986f5db33dd220dcd971a39e8587ca4e52d9a3f
//
// ignore_for_file: unused_import

Expand Down Expand Up @@ -1808,7 +1808,7 @@ final class _EvaluateVisitor
if (result != null) {
isDependency = _inDependency;
} else {
result = _nodeImporter!.load(originalUrl, previous, forImport);
result = _nodeImporter.load(originalUrl, previous, forImport);
if (result == null) return null;
isDependency = true;
}
Expand Down
2 changes: 1 addition & 1 deletion test/util/string_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ void main() {

group("at the very beginning that's", () {
for (var (name, (char, escape)) in chars.pairs) {
test(name, () => expect(char.toCssIdentifier(), equals('$escape')));
test(name, () => expect(char.toCssIdentifier(), equals(escape)));
}
});

Expand Down
8 changes: 4 additions & 4 deletions tool/grind/bump_version.dart
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,14 @@ void _bumpVersion(bool patch, bool dev) {
void addChangelogEntry(String dir, Version version) {
var path = p.join(dir, "CHANGELOG.md");
var text = File(path).readAsStringSync();
if (!dev && text.startsWith("## ${version}-dev\n")) {
if (!dev && text.startsWith("## $version-dev\n")) {
File(path).writeAsStringSync(
text.replaceFirst("## ${version}-dev\n", "## ${version}\n"));
} else if (text.startsWith("## ${version}\n")) {
text.replaceFirst("## $version-dev\n", "## $version\n"));
} else if (text.startsWith("## $version\n")) {
return;
} else {
File(path).writeAsStringSync(
"## ${version}\n\n* No user-visible changes.\n\n$text");
"## $version\n\n* No user-visible changes.\n\n$text");
}
}

Expand Down

0 comments on commit 1fcdf8d

Please sign in to comment.