Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions lib/src/deprecation.dart
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,17 @@ enum Deprecation {
String toString() => id;

/// Returns the deprecation with a given ID, or null if none exists.
static Deprecation? fromId(String id) => Deprecation.values
.firstWhereOrNull((deprecation) => deprecation.id == id);
static Deprecation? fromId(String id) => Deprecation.values.firstWhereOrNull(
(deprecation) => deprecation.id == id,
);

/// Returns the set of all deprecations done in or before [version].
static Set<Deprecation> forVersion(Version version) {
var range = VersionRange(max: version, includeMax: true);
return {
for (var deprecation in Deprecation.values)
if (deprecation.deprecatedIn.andThen(range.allows) ?? false) deprecation
if (deprecation.deprecatedIn.andThen(range.allows) ?? false)
deprecation,
};
}
}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ dev_dependencies:
analyzer: ^6.8.0
archive: ^3.1.2
crypto: ^3.0.0
dart_style: ^2.0.0
dart_style: ^3.0.0
dartdoc: ">=8.0.14 <8.3.1" # dart-lang/dartdoc#3947
grinder: ^0.9.0
node_preamble: ^2.0.2
Expand Down
5 changes: 4 additions & 1 deletion tool/grind/generate_deprecations.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'dart:io';
import 'package:crypto/crypto.dart';
import 'package:dart_style/dart_style.dart';
import 'package:grinder/grinder.dart';
import 'package:pub_semver/pub_semver.dart';
import 'package:yaml/yaml.dart';

import 'utils.dart';
Expand Down Expand Up @@ -78,5 +79,7 @@ void deprecations() {
fail("Couldn't find block for generated code in lib/src/deprecation.dart");
}
var newCode = dartText.replaceFirst(_blockRegex, buffer.toString());
dartFile.writeAsStringSync(DartFormatter().format(newCode));
dartFile.writeAsStringSync(DartFormatter(
languageVersion: Version.parse(Platform.version.split(' ').first))
.format(newCode));
}
5 changes: 4 additions & 1 deletion tool/grind/synchronize.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import 'package:crypto/crypto.dart';
import 'package:dart_style/dart_style.dart';
import 'package:grinder/grinder.dart';
import 'package:path/path.dart' as p;
import 'package:pub_semver/pub_semver.dart';
import 'package:source_span/source_span.dart';

import 'package:sass/src/util/nullable.dart';
Expand Down Expand Up @@ -58,7 +59,9 @@ String synchronizeFile(String source) {
parseFile(path: source, featureSet: FeatureSet.latestLanguageVersion())
.unit
.accept(visitor);
return DartFormatter().format(visitor.result);
return DartFormatter(
languageVersion: Version.parse(Platform.version.split(' ').first))
.format(visitor.result);
}

/// The visitor that traverses the asynchronous parse tree and converts it to
Expand Down
Loading