From c1a3653f5dae0d149f56396b3e190cde67b53e12 Mon Sep 17 00:00:00 2001 From: Jennifer Thakar Date: Tue, 9 Mar 2021 14:36:48 -0800 Subject: [PATCH 1/2] Update dependencies to null-safe versions This also replaces package_resolver with package_config, since package_resolver is archived and is incompatible with null-safe Dart packages. --- lib/sass.dart | 38 ++++++------- lib/src/async_compile.dart | 2 - lib/src/async_import_cache.dart | 20 ++++--- lib/src/compile.dart | 4 +- lib/src/import_cache.dart | 22 ++++---- lib/src/importer/package.dart | 16 +++--- lib/src/sync_package_resolver.dart | 2 - lib/src/sync_package_resolver/node.dart | 15 ------ pubspec.yaml | 71 ++++++++++++++----------- test/cli/dart_test.dart | 4 +- test/cli/node_test.dart | 7 ++- test/dart_api_test.dart | 30 +++++------ test/double_check_test.dart | 2 +- 13 files changed, 107 insertions(+), 126 deletions(-) delete mode 100644 lib/src/sync_package_resolver.dart delete mode 100644 lib/src/sync_package_resolver/node.dart diff --git a/lib/sass.dart b/lib/sass.dart index e45a610dd..855f20f74 100644 --- a/lib/sass.dart +++ b/lib/sass.dart @@ -5,6 +5,7 @@ /// We strongly recommend importing this library with the prefix `sass`. library sass; +import 'package:package_config/package_config_types.dart'; import 'package:source_maps/source_maps.dart'; import 'src/async_import_cache.dart'; @@ -14,7 +15,6 @@ import 'src/exception.dart'; import 'src/import_cache.dart'; import 'src/importer.dart'; import 'src/logger.dart'; -import 'src/sync_package_resolver.dart'; import 'src/syntax.dart'; import 'src/visitor/serialize.dart'; @@ -48,11 +48,11 @@ export 'src/warn.dart' show warn; /// * Each load path specified in the `SASS_PATH` environment variable, which /// should be semicolon-separated on Windows and colon-separated elsewhere. /// -/// * `package:` resolution using [packageResolver], which is a -/// [`SyncPackageResolver`][] from the `package_resolver` package. Note that +/// * `package:` resolution using [packageConfig], which is a +/// [`PackageConfig`][] from the `package_resolver` package. Note that /// this is a shorthand for adding a [PackageImporter] to [importers]. /// -/// [`SyncPackageResolver`]: https://www.dartdocs.org/documentation/package_resolver/latest/package_resolver/SyncPackageResolver-class.html +/// [`PackageConfig`]: https://pub.dev/documentation/package_config/latest/package_config.package_config/PackageConfig-class.html /// /// Dart functions that can be called from Sass may be passed using [functions]. /// Each [Callable] defines a top-level function that will be invoked when the @@ -90,7 +90,7 @@ String compile(String path, Logger logger, Iterable importers, Iterable loadPaths, - SyncPackageResolver packageResolver, + PackageConfig packageConfig, Iterable functions, OutputStyle style, void sourceMap(SingleMapping map), @@ -99,9 +99,7 @@ String compile(String path, var result = c.compile(path, logger: logger, importCache: ImportCache(importers, - logger: logger, - loadPaths: loadPaths, - packageResolver: packageResolver), + logger: logger, loadPaths: loadPaths, packageConfig: packageConfig), functions: functions, style: style, sourceMap: sourceMap != null, @@ -132,11 +130,11 @@ String compile(String path, /// * Each load path specified in the `SASS_PATH` environment variable, which /// should be semicolon-separated on Windows and colon-separated elsewhere. /// -/// * `package:` resolution using [packageResolver], which is a -/// [`SyncPackageResolver`][] from the `package_resolver` package. Note that +/// * `package:` resolution using [packageConfig], which is a +/// [`PackageConfig`][] from the `package_resolver` package. Note that /// this is a shorthand for adding a [PackageImporter] to [importers]. /// -/// [`SyncPackageResolver`]: https://www.dartdocs.org/documentation/package_resolver/latest/package_resolver/SyncPackageResolver-class.html +/// [`PackageConfig`]: https://pub.dev/documentation/package_config/latest/package_config.package_config/PackageConfig-class.html /// /// Dart functions that can be called from Sass may be passed using [functions]. /// Each [Callable] defines a top-level function that will be invoked when the @@ -178,7 +176,7 @@ String compileString(String source, bool color = false, Logger logger, Iterable importers, - SyncPackageResolver packageResolver, + PackageConfig packageConfig, Iterable loadPaths, Iterable functions, OutputStyle style, @@ -192,9 +190,7 @@ String compileString(String source, syntax: syntax ?? (indented ? Syntax.sass : Syntax.scss), logger: logger, importCache: ImportCache(importers, - logger: logger, - packageResolver: packageResolver, - loadPaths: loadPaths), + logger: logger, packageConfig: packageConfig, loadPaths: loadPaths), functions: functions, style: style, importer: importer, @@ -214,7 +210,7 @@ Future compileAsync(String path, {bool color = false, Logger logger, Iterable importers, - SyncPackageResolver packageResolver, + PackageConfig packageConfig, Iterable loadPaths, Iterable functions, OutputStyle style, @@ -223,9 +219,7 @@ Future compileAsync(String path, var result = await c.compileAsync(path, logger: logger, importCache: AsyncImportCache(importers, - logger: logger, - loadPaths: loadPaths, - packageResolver: packageResolver), + logger: logger, loadPaths: loadPaths, packageConfig: packageConfig), functions: functions, style: style, sourceMap: sourceMap != null); @@ -243,7 +237,7 @@ Future compileStringAsync(String source, bool color = false, Logger logger, Iterable importers, - SyncPackageResolver packageResolver, + PackageConfig packageConfig, Iterable loadPaths, Iterable functions, OutputStyle style, @@ -257,9 +251,7 @@ Future compileStringAsync(String source, syntax: syntax ?? (indented ? Syntax.sass : Syntax.scss), logger: logger, importCache: AsyncImportCache(importers, - logger: logger, - packageResolver: packageResolver, - loadPaths: loadPaths), + logger: logger, packageConfig: packageConfig, loadPaths: loadPaths), functions: functions, style: style, importer: importer, diff --git a/lib/src/async_compile.dart b/lib/src/async_compile.dart index b1996b646..64d4fe151 100644 --- a/lib/src/async_compile.dart +++ b/lib/src/async_compile.dart @@ -15,7 +15,6 @@ import 'importer.dart'; import 'importer/node.dart'; import 'io.dart'; import 'logger.dart'; -import 'sync_package_resolver.dart'; import 'syntax.dart'; import 'utils.dart'; import 'visitor/async_evaluate.dart'; @@ -77,7 +76,6 @@ Future compileStringAsync(String source, NodeImporter nodeImporter, Iterable importers, Iterable loadPaths, - SyncPackageResolver packageResolver, AsyncImporter importer, Iterable functions, OutputStyle style, diff --git a/lib/src/async_import_cache.dart b/lib/src/async_import_cache.dart index 58e5a1b6d..d26c685ad 100644 --- a/lib/src/async_import_cache.dart +++ b/lib/src/async_import_cache.dart @@ -3,6 +3,7 @@ // https://opensource.org/licenses/MIT. import 'package:collection/collection.dart'; +import 'package:package_config/package_config_types.dart'; import 'package:path/path.dart' as p; import 'package:tuple/tuple.dart'; @@ -11,7 +12,6 @@ import 'importer.dart'; import 'importer/utils.dart'; import 'io.dart'; import 'logger.dart'; -import 'sync_package_resolver.dart'; import 'utils.dart'; // ignore: unused_import /// An in-memory cache of parsed stylesheets that have been imported by Sass. @@ -52,16 +52,14 @@ class AsyncImportCache { /// * Each load path specified in the `SASS_PATH` environment variable, which /// should be semicolon-separated on Windows and colon-separated elsewhere. /// - /// * `package:` resolution using [packageResolver], which is a - /// [`SyncPackageResolver`][] from the `package_resolver` package. Note that + /// * `package:` resolution using [packageConfig], which is a + /// [`PackageConfig`][] from the `package_config` package. Note that /// this is a shorthand for adding a [PackageImporter] to [importers]. /// - /// [`SyncPackageResolver`]: https://www.dartdocs.org/documentation/package_resolver/latest/package_resolver/SyncPackageResolver-class.html + /// [`PackageConfig`]: https://pub.dev/documentation/package_config/latest/package_config.package_config/PackageConfig-class.html AsyncImportCache(Iterable importers, - {Iterable loadPaths, - SyncPackageResolver packageResolver, - Logger logger}) - : _importers = _toImporters(importers, loadPaths, packageResolver), + {Iterable loadPaths, PackageConfig packageConfig, Logger logger}) + : _importers = _toImporters(importers, loadPaths, packageConfig), _logger = logger ?? const Logger.stderr(), _canonicalizeCache = {}, _importCache = {}, @@ -75,10 +73,10 @@ class AsyncImportCache { _importCache = {}, _resultsCache = {}; - /// Converts the user's [importers], [loadPaths], and [packageResolver] + /// Converts the user's [importers], [loadPaths], and [packageConfig] /// options into a single list of importers. static List _toImporters(Iterable importers, - Iterable loadPaths, SyncPackageResolver packageResolver) { + Iterable loadPaths, PackageConfig packageConfig) { var sassPath = getEnvironmentVariable('SASS_PATH'); return [ ...?importers, @@ -87,7 +85,7 @@ class AsyncImportCache { if (sassPath != null) for (var path in sassPath.split(isWindows ? ';' : ':')) FilesystemImporter(path), - if (packageResolver != null) PackageImporter(packageResolver) + if (packageConfig != null) PackageImporter(packageConfig) ]; } diff --git a/lib/src/compile.dart b/lib/src/compile.dart index d2b495657..72e2655d9 100644 --- a/lib/src/compile.dart +++ b/lib/src/compile.dart @@ -5,7 +5,7 @@ // DO NOT EDIT. This file was generated from async_compile.dart. // See tool/grind/synchronize.dart for details. // -// Checksum: b2cd6037efa37e300daa45ebed20cb4b61526161 +// Checksum: ef27d750f1d5305373fe9e712cf99697a21e0689 // // ignore_for_file: unused_import @@ -25,7 +25,6 @@ import 'importer.dart'; import 'importer/node.dart'; import 'io.dart'; import 'logger.dart'; -import 'sync_package_resolver.dart'; import 'syntax.dart'; import 'utils.dart'; import 'visitor/evaluate.dart'; @@ -87,7 +86,6 @@ CompileResult compileString(String source, NodeImporter nodeImporter, Iterable importers, Iterable loadPaths, - SyncPackageResolver packageResolver, Importer importer, Iterable functions, OutputStyle style, diff --git a/lib/src/import_cache.dart b/lib/src/import_cache.dart index 96c5d628a..57b726abf 100644 --- a/lib/src/import_cache.dart +++ b/lib/src/import_cache.dart @@ -5,11 +5,12 @@ // DO NOT EDIT. This file was generated from async_import_cache.dart. // See tool/grind/synchronize.dart for details. // -// Checksum: 6ac1ee07d6b46134f1616d82782180f1cc3b6d81 +// Checksum: 31432610e32afefcc7adcda592b811ec50e9b47f // // ignore_for_file: unused_import import 'package:collection/collection.dart'; +import 'package:package_config/package_config_types.dart'; import 'package:path/path.dart' as p; import 'package:tuple/tuple.dart'; @@ -18,7 +19,6 @@ import 'importer.dart'; import 'importer/utils.dart'; import 'io.dart'; import 'logger.dart'; -import 'sync_package_resolver.dart'; import 'utils.dart'; // ignore: unused_import /// An in-memory cache of parsed stylesheets that have been imported by Sass. @@ -58,16 +58,14 @@ class ImportCache { /// * Each load path specified in the `SASS_PATH` environment variable, which /// should be semicolon-separated on Windows and colon-separated elsewhere. /// - /// * `package:` resolution using [packageResolver], which is a - /// [`SyncPackageResolver`][] from the `package_resolver` package. Note that + /// * `package:` resolution using [packageConfig], which is a + /// [`PackageConfig`][] from the `package_config` package. Note that /// this is a shorthand for adding a [PackageImporter] to [importers]. /// - /// [`SyncPackageResolver`]: https://www.dartdocs.org/documentation/package_resolver/latest/package_resolver/SyncPackageResolver-class.html + /// [`PackageConfig`]: https://pub.dev/documentation/package_config/latest/package_config.package_config/PackageConfig-class.html ImportCache(Iterable importers, - {Iterable loadPaths, - SyncPackageResolver packageResolver, - Logger logger}) - : _importers = _toImporters(importers, loadPaths, packageResolver), + {Iterable loadPaths, PackageConfig packageConfig, Logger logger}) + : _importers = _toImporters(importers, loadPaths, packageConfig), _logger = logger ?? const Logger.stderr(), _canonicalizeCache = {}, _importCache = {}, @@ -81,10 +79,10 @@ class ImportCache { _importCache = {}, _resultsCache = {}; - /// Converts the user's [importers], [loadPaths], and [packageResolver] + /// Converts the user's [importers], [loadPaths], and [packageConfig] /// options into a single list of importers. static List _toImporters(Iterable importers, - Iterable loadPaths, SyncPackageResolver packageResolver) { + Iterable loadPaths, PackageConfig packageConfig) { var sassPath = getEnvironmentVariable('SASS_PATH'); return [ ...?importers, @@ -93,7 +91,7 @@ class ImportCache { if (sassPath != null) for (var path in sassPath.split(isWindows ? ';' : ':')) FilesystemImporter(path), - if (packageResolver != null) PackageImporter(packageResolver) + if (packageConfig != null) PackageImporter(packageConfig) ]; } diff --git a/lib/src/importer/package.dart b/lib/src/importer/package.dart index 79eded476..770968750 100644 --- a/lib/src/importer/package.dart +++ b/lib/src/importer/package.dart @@ -3,9 +3,9 @@ // https://opensource.org/licenses/MIT. import 'package:meta/meta.dart'; +import 'package:package_config/package_config_types.dart'; import '../importer.dart'; -import '../sync_package_resolver.dart'; /// A filesystem importer to use when resolving the results of `package:` URLs. /// @@ -17,24 +17,24 @@ final _filesystemImporter = FilesystemImporter('.'); @sealed class PackageImporter extends Importer { /// The resolver that converts `package:` imports to `file:`. - final SyncPackageResolver _packageResolver; + final PackageConfig _packageConfig; /// Creates an importer that loads stylesheets from `package:` URLs according - /// to [packageResolver], which is a [SyncPackageResolver][] from the - /// `package_resolver` package. + /// to [packageConfig], which is a [PackageConfig][] from the `package_config` + /// package. /// - /// [SyncPackageResolver]: https://www.dartdocs.org/documentation/package_resolver/latest/package_resolver/SyncPackageResolver-class.html - PackageImporter(this._packageResolver); + /// [`PackageConfig`]: https://pub.dev/documentation/package_config/latest/package_config.package_config/PackageConfig-class.html + PackageImporter(this._packageConfig); Uri canonicalize(Uri url) { if (url.scheme == 'file') return _filesystemImporter.canonicalize(url); if (url.scheme != 'package') return null; - var resolved = _packageResolver.resolveUri(url); + var resolved = _packageConfig.resolve(url); if (resolved == null) throw "Unknown package."; if (resolved.scheme.isNotEmpty && resolved.scheme != 'file') { - throw "Unsupported URL ${resolved}."; + throw "Unsupported URL $resolved."; } return _filesystemImporter.canonicalize(resolved); diff --git a/lib/src/sync_package_resolver.dart b/lib/src/sync_package_resolver.dart deleted file mode 100644 index f61ae7be2..000000000 --- a/lib/src/sync_package_resolver.dart +++ /dev/null @@ -1,2 +0,0 @@ -export 'package:package_resolver/package_resolver.dart' - if (dart.library.js) 'sync_package_resolver/node.dart'; diff --git a/lib/src/sync_package_resolver/node.dart b/lib/src/sync_package_resolver/node.dart deleted file mode 100644 index c0984dced..000000000 --- a/lib/src/sync_package_resolver/node.dart +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -class SyncPackageResolver { - static final _error = - UnsupportedError('SyncPackageResolver is not supported in JS.'); - - static Future get current => throw _error; - - Uri resolveUri(Object packageUri) => throw _error; - - factory SyncPackageResolver.config(Map configMap) => - throw _error; -} diff --git a/pubspec.yaml b/pubspec.yaml index edd4de456..e083a4e8a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -12,37 +12,44 @@ environment: sdk: '>=2.6.0 <3.0.0' dependencies: - args: ">=1.4.0 <3.0.0" - async: ">=1.10.0 <3.0.0" - charcode: "^1.1.0" - cli_repl: ">=0.1.3 <0.3.0" - collection: "^1.8.0" - meta: "^1.1.7" - node_interop: "^1.1.0" - js: "^0.6.0" - package_resolver: "^1.0.0" - path: "^1.6.0" - source_maps: "^0.10.5" - source_span: "^1.6.0" - stack_trace: ">=0.9.0 <2.0.0" - stream_transform: ">=0.0.20 <3.0.0" - string_scanner: ">=0.1.5 <2.0.0" - term_glyph: "^1.0.0" - tuple: "^1.0.0" - watcher: ">=0.9.6 <2.0.0" + args: ^2.0.0 + async: ^2.5.0 + charcode: ^1.2.0 + cli_repl: ^0.2.1-nullsafety + collection: ^1.15.0 + meta: ^1.3.0 + node_interop: #"^2.0.0" + git: + url: git://github.com/Awjin/node-interop + path: node_interop + ref: null-safe-interop + js: ^0.6.3 + path: ^1.8.0 + source_maps: ^0.10.10 + source_span: ^1.8.1 + stack_trace: ^1.10.0 + stream_transform: ^2.0.0 + string_scanner: ^1.1.0 + term_glyph: ^1.2.0 + tuple: ^2.0.0-nullsafety.0 + watcher: ^1.0.0 + +publish_to: none dev_dependencies: - archive: ">=1.0.0 <3.0.0" - analyzer: "^0.40.0" - cli_pkg: "^1.1.0" - crypto: ">=0.9.2 <3.0.0" - dart_style: "^1.2.0" - grinder: "^0.8.0" - node_preamble: "^1.1.0" - pedantic: "^1.0.0" - pub_semver: "^1.0.0" - stream_channel: ">=1.0.0 <3.0.0" - test_descriptor: "^1.1.0" - test_process: "^1.0.0-rc.1" - test: ">=0.12.42 <2.0.0" - yaml: "^2.0.0" + archive: ^3.1.2 + analyzer: ^1.1.0 + cli_pkg: #"^1.2.0" + git: {url: git://github.com/google/dart_cli_pkg, ref: nnbd2021} + crypto: ^3.0.0 + dart_style: #"^2.0.0" + git: {url: git://github.com/dart-lang/dart_style, ref: bump} + grinder: ^0.9.0-nullsafety.0 + node_preamble: ^2.0.0 + pedantic: ^1.11.0 + pub_semver: ^2.0.0 + stream_channel: ^2.1.0 + test_descriptor: ^2.0.0 + test_process: ^2.0.0 + test: ^1.16.7 + yaml: ^3.1.0 diff --git a/test/cli/dart_test.dart b/test/cli/dart_test.dart index 639d08865..5e1f654d2 100644 --- a/test/cli/dart_test.dart +++ b/test/cli/dart_test.dart @@ -4,6 +4,8 @@ @TestOn('vm') +import 'dart:convert'; + import 'package:cli_pkg/testing.dart' as pkg; import 'package:test/test.dart'; import 'package:test_descriptor/test_descriptor.dart' as d; @@ -30,4 +32,4 @@ void ensureSnapshotUpToDate() => pkg.ensureExecutableUpToDate("sass"); Future runSass(Iterable arguments, {Map environment}) => pkg.start("sass", arguments, - environment: environment, workingDirectory: d.sandbox); + environment: environment, workingDirectory: d.sandbox, encoding: utf8); diff --git a/test/cli/node_test.dart b/test/cli/node_test.dart index e27bb4fc5..7d1e4f751 100644 --- a/test/cli/node_test.dart +++ b/test/cli/node_test.dart @@ -5,6 +5,8 @@ @TestOn('vm') @Tags(['node']) +import 'dart:convert'; + import 'package:cli_pkg/testing.dart' as pkg; import 'package:test_process/test_process.dart'; import 'package:test_descriptor/test_descriptor.dart' as d; @@ -31,4 +33,7 @@ void main() { Future runSass(Iterable arguments, {Map environment}) => pkg.start("sass", arguments, - environment: environment, workingDirectory: d.sandbox, node: true); + environment: environment, + workingDirectory: d.sandbox, + encoding: utf8, + node: true); diff --git a/test/dart_api_test.dart b/test/dart_api_test.dart index 7d628b4f4..5ccb36961 100644 --- a/test/dart_api_test.dart +++ b/test/dart_api_test.dart @@ -4,7 +4,7 @@ @TestOn('vm') -import 'package:package_resolver/package_resolver.dart'; +import 'package:package_config/package_config.dart'; import 'package:path/path.dart' as p; import 'package:test/test.dart'; import 'package:test_descriptor/test_descriptor.dart' as d; @@ -93,10 +93,10 @@ void main() { await d .file("test.scss", '@import "package:fake_package/test";') .create(); - var resolver = SyncPackageResolver.config( - {"fake_package": p.toUri(d.path('subdir'))}); + var config = + PackageConfig([Package('fake_package', p.toUri(d.path('subdir/')))]); - var css = compile(d.path("test.scss"), packageResolver: resolver); + var css = compile(d.path("test.scss"), packageConfig: config); expect(css, equals("a {\n b: 3;\n}")); }); @@ -109,10 +109,10 @@ void main() { await d .file("test.scss", '@import "package:fake_package/test";') .create(); - var resolver = SyncPackageResolver.config( - {"fake_package": p.toUri(d.path('subdir'))}); + var config = + PackageConfig([Package('fake_package', p.toUri(d.path('subdir/')))]); - var css = compile(d.path("test.scss"), packageResolver: resolver); + var css = compile(d.path("test.scss"), packageConfig: config); expect(css, equals("a {\n b: 3;\n}")); }); @@ -120,9 +120,9 @@ void main() { await d .file("test.scss", '@import "package:fake_package/test_aux";') .create(); - var resolver = SyncPackageResolver.config({}); - expect(() => compile(d.path("test.scss"), packageResolver: resolver), + expect( + () => compile(d.path("test.scss"), packageConfig: PackageConfig([])), throwsA(const TypeMatcher())); }); }); @@ -166,9 +166,9 @@ void main() { expect(css, equals("a {\n b: from-importer;\n}")); }); - test("importers take precedence over packageResolver", () async { + test("importers take precedence over packageConfig", () async { await d.dir("package", - [d.file("other.scss", "a {b: from-package-resolver}")]).create(); + [d.file("other.scss", "a {b: from-package-config}")]).create(); await d.dir( "importer", [d.file("other.scss", "a {b: from-importer}")]).create(); await d @@ -177,11 +177,11 @@ void main() { var css = compile(d.path("test.scss"), importers: [ - PackageImporter(SyncPackageResolver.config( - {"fake_package": p.toUri(d.path('importer'))})) + PackageImporter(PackageConfig( + [Package('fake_package', p.toUri(d.path('importer/')))])) ], - packageResolver: SyncPackageResolver.config( - {"fake_package": p.toUri(d.path('package'))})); + packageConfig: PackageConfig( + [Package('fake_package', p.toUri(d.path('package/')))])); expect(css, equals("a {\n b: from-importer;\n}")); }); }); diff --git a/test/double_check_test.dart b/test/double_check_test.dart index b18502cdb..23983a27f 100644 --- a/test/double_check_test.dart +++ b/test/double_check_test.dart @@ -44,7 +44,7 @@ void main() { var changelogVersion = firstLine.substring(3); var pubspec = loadYaml(File("pubspec.yaml").readAsStringSync(), - sourceUrl: "pubspec.yaml") as Map; + sourceUrl: Uri(path: "pubspec.yaml")) as Map; expect(pubspec, containsPair("version", isA())); var pubspecVersion = pubspec["version"] as String; From 7d60afcaf543bcf595a02e3ad5344ef8d4e70b0b Mon Sep 17 00:00:00 2001 From: Jennifer Thakar Date: Tue, 9 Mar 2021 17:04:09 -0800 Subject: [PATCH 2/2] Add some migrator comments to the Sass AST --- lib/src/ast/sass/argument_declaration.dart | 2 +- lib/src/ast/sass/argument_invocation.dart | 2 +- lib/src/ast/sass/at_root_query.dart | 2 +- lib/src/ast/sass/configured_variable.dart | 2 +- lib/src/ast/sass/expression/binary_operation.dart | 4 ++-- lib/src/ast/sass/expression/color.dart | 2 +- lib/src/ast/sass/expression/list.dart | 2 +- lib/src/ast/sass/expression/map.dart | 2 +- lib/src/ast/sass/expression/parenthesized.dart | 2 +- lib/src/ast/sass/expression/string.dart | 8 ++++---- lib/src/ast/sass/expression/unary_operation.dart | 4 ++-- lib/src/ast/sass/expression/value.dart | 2 +- lib/src/ast/sass/interpolation.dart | 2 +- lib/src/ast/sass/statement/at_root_rule.dart | 2 +- lib/src/ast/sass/statement/at_rule.dart | 2 +- lib/src/ast/sass/statement/callable_declaration.dart | 2 +- lib/src/ast/sass/statement/content_block.dart | 2 +- lib/src/ast/sass/statement/use_rule.dart | 2 +- lib/src/ast/sass/statement/while_rule.dart | 2 +- lib/src/ast/sass/supports_condition/declaration.dart | 4 ++-- 20 files changed, 26 insertions(+), 26 deletions(-) diff --git a/lib/src/ast/sass/argument_declaration.dart b/lib/src/ast/sass/argument_declaration.dart index 9f08ae07f..7e1197b82 100644 --- a/lib/src/ast/sass/argument_declaration.dart +++ b/lib/src/ast/sass/argument_declaration.dart @@ -25,7 +25,7 @@ class ArgumentDeclaration implements SassNode { /// Returns [span] expanded to include an identifier immediately before the /// declaration, if possible. - FileSpan get spanWithName { + FileSpan/*!*/ get spanWithName { var text = span.file.getText(0); // Move backwards through and whitspace between the name and the arguments. diff --git a/lib/src/ast/sass/argument_invocation.dart b/lib/src/ast/sass/argument_invocation.dart index b18fcb07f..4c31447a6 100644 --- a/lib/src/ast/sass/argument_invocation.dart +++ b/lib/src/ast/sass/argument_invocation.dart @@ -27,7 +27,7 @@ class ArgumentInvocation implements SassNode { bool get isEmpty => positional.isEmpty && named.isEmpty && rest == null; ArgumentInvocation( - Iterable positional, Map named, this.span, + Iterable positional, Map named, this.span, {this.rest, this.keywordRest}) : positional = List.unmodifiable(positional), named = Map.unmodifiable(named) { diff --git a/lib/src/ast/sass/at_root_query.dart b/lib/src/ast/sass/at_root_query.dart index 3c4e7f73a..8041a855e 100644 --- a/lib/src/ast/sass/at_root_query.dart +++ b/lib/src/ast/sass/at_root_query.dart @@ -54,7 +54,7 @@ class AtRootQuery { AtRootQueryParser(contents, url: url, logger: logger).parse(); /// Returns whether [this] excludes [node]. - bool excludes(CssParentNode node) { + bool excludes(CssParentNode/*!*/ node) { if (_all) return !include; if (node is CssStyleRule) return excludesStyleRules; if (node is CssMediaRule) return excludesName("media"); diff --git a/lib/src/ast/sass/configured_variable.dart b/lib/src/ast/sass/configured_variable.dart index 302c4dde2..13d73e892 100644 --- a/lib/src/ast/sass/configured_variable.dart +++ b/lib/src/ast/sass/configured_variable.dart @@ -13,7 +13,7 @@ class ConfiguredVariable implements SassNode { final String name; /// The variable's value. - final Expression expression; + final Expression/*!*/ expression; /// Whether the variable can be further configured by outer modules. /// diff --git a/lib/src/ast/sass/expression/binary_operation.dart b/lib/src/ast/sass/expression/binary_operation.dart index b1608288b..3ebb587ff 100644 --- a/lib/src/ast/sass/expression/binary_operation.dart +++ b/lib/src/ast/sass/expression/binary_operation.dart @@ -15,10 +15,10 @@ class BinaryOperationExpression implements Expression { final BinaryOperator operator; /// The left-hand operand. - final Expression left; + final Expression /*!*/ left; /// The right-hand operand. - final Expression right; + final Expression /*!*/ right; /// Whether this is a [BinaryOperator.dividedBy] operation that may be /// interpreted as slash-separated numbers. diff --git a/lib/src/ast/sass/expression/color.dart b/lib/src/ast/sass/expression/color.dart index 49f1d62ae..ac9e9b13e 100644 --- a/lib/src/ast/sass/expression/color.dart +++ b/lib/src/ast/sass/expression/color.dart @@ -11,7 +11,7 @@ import '../expression.dart'; /// A color literal. class ColorExpression implements Expression { /// The value of this color. - final SassColor value; + final SassColor/*!*/ value; FileSpan get span => value.originalSpan; diff --git a/lib/src/ast/sass/expression/list.dart b/lib/src/ast/sass/expression/list.dart index ac5a61aa5..4d24186c5 100644 --- a/lib/src/ast/sass/expression/list.dart +++ b/lib/src/ast/sass/expression/list.dart @@ -24,7 +24,7 @@ class ListExpression implements Expression { final FileSpan span; - ListExpression(Iterable contents, ListSeparator separator, + ListExpression(Iterable contents, ListSeparator separator, {bool brackets = false, FileSpan span}) : this._(List.unmodifiable(contents), separator, brackets, span); diff --git a/lib/src/ast/sass/expression/map.dart b/lib/src/ast/sass/expression/map.dart index 6dcdc06df..1e6e1d574 100644 --- a/lib/src/ast/sass/expression/map.dart +++ b/lib/src/ast/sass/expression/map.dart @@ -18,7 +18,7 @@ class MapExpression implements Expression { final FileSpan span; - MapExpression(Iterable> pairs, this.span) + MapExpression(Iterable> pairs, this.span) : pairs = List.unmodifiable(pairs); T accept(ExpressionVisitor visitor) => visitor.visitMapExpression(this); diff --git a/lib/src/ast/sass/expression/parenthesized.dart b/lib/src/ast/sass/expression/parenthesized.dart index 72a91708d..050cf4772 100644 --- a/lib/src/ast/sass/expression/parenthesized.dart +++ b/lib/src/ast/sass/expression/parenthesized.dart @@ -10,7 +10,7 @@ import '../expression.dart'; /// An expression wrapped in parentheses. class ParenthesizedExpression implements Expression { /// The internal expression. - final Expression expression; + final Expression/*!*/ expression; final FileSpan span; diff --git a/lib/src/ast/sass/expression/string.dart b/lib/src/ast/sass/expression/string.dart index 5504cfe2c..b2bb131da 100644 --- a/lib/src/ast/sass/expression/string.dart +++ b/lib/src/ast/sass/expression/string.dart @@ -26,7 +26,7 @@ class StringExpression implements Expression { /// Returns Sass source for a quoted string that, when evaluated, will have /// [text] as its contents. - static String quoteText(String text) => + static String/*!*/ quoteText(String text) => StringExpression.plain(text, null, quotes: true) .asInterpolation(static: true) .asPlain; @@ -51,9 +51,9 @@ class StringExpression implements Expression { Interpolation asInterpolation({bool static = false, int quote}) { if (!hasQuotes) return text; - quote ??= hasQuotes ? _bestQuote() : null; + quote ??= _bestQuote(); var buffer = InterpolationBuffer(); - if (quote != null) buffer.writeCharCode(quote); + buffer.writeCharCode(quote); for (var value in text.contents) { assert(value is Expression || value is String); if (value is Expression) { @@ -85,7 +85,7 @@ class StringExpression implements Expression { } } } - if (quote != null) buffer.writeCharCode(quote); + buffer.writeCharCode(quote); return buffer.interpolation(text.span); } diff --git a/lib/src/ast/sass/expression/unary_operation.dart b/lib/src/ast/sass/expression/unary_operation.dart index c3ac12642..b7756075d 100644 --- a/lib/src/ast/sass/expression/unary_operation.dart +++ b/lib/src/ast/sass/expression/unary_operation.dart @@ -11,10 +11,10 @@ import '../expression.dart'; /// A unary operator, as in `+$var` or `not fn()`. class UnaryOperationExpression implements Expression { /// The operator being invoked. - final UnaryOperator operator; + final UnaryOperator/*!*/ operator; /// The operand. - final Expression operand; + final Expression/*!*/ operand; final FileSpan span; diff --git a/lib/src/ast/sass/expression/value.dart b/lib/src/ast/sass/expression/value.dart index 1ef46e52e..91ad9ed69 100644 --- a/lib/src/ast/sass/expression/value.dart +++ b/lib/src/ast/sass/expression/value.dart @@ -14,7 +14,7 @@ import '../expression.dart'; /// constructed dynamically, as for the `call()` function. class ValueExpression implements Expression { /// The embedded value. - final Value value; + final Value/*!*/ value; final FileSpan span; diff --git a/lib/src/ast/sass/interpolation.dart b/lib/src/ast/sass/interpolation.dart index 2fd68f181..598d1ede6 100644 --- a/lib/src/ast/sass/interpolation.dart +++ b/lib/src/ast/sass/interpolation.dart @@ -33,7 +33,7 @@ class Interpolation implements SassNode { return first is String ? first : ''; } - Interpolation(Iterable contents, this.span) + Interpolation(Iterable contents, this.span) : contents = List.unmodifiable(contents) { for (var i = 0; i < this.contents.length; i++) { if (this.contents[i] is! String && this.contents[i] is! Expression) { diff --git a/lib/src/ast/sass/statement/at_root_rule.dart b/lib/src/ast/sass/statement/at_root_rule.dart index dc433a9ae..a108c2d5d 100644 --- a/lib/src/ast/sass/statement/at_root_rule.dart +++ b/lib/src/ast/sass/statement/at_root_rule.dart @@ -19,7 +19,7 @@ class AtRootRule extends ParentStatement { final FileSpan span; - AtRootRule(Iterable children, this.span, {this.query}) + AtRootRule(Iterable children, this.span, {this.query}) : super(List.unmodifiable(children)); T accept(StatementVisitor visitor) => visitor.visitAtRootRule(this); diff --git a/lib/src/ast/sass/statement/at_rule.dart b/lib/src/ast/sass/statement/at_rule.dart index d35a45210..cee4f2adc 100644 --- a/lib/src/ast/sass/statement/at_rule.dart +++ b/lib/src/ast/sass/statement/at_rule.dart @@ -19,7 +19,7 @@ class AtRule extends ParentStatement { final FileSpan span; - AtRule(this.name, this.span, {this.value, Iterable children}) + AtRule(this.name, this.span, {this.value, Iterable children}) : super(children == null ? null : List.unmodifiable(children)); T accept(StatementVisitor visitor) => visitor.visitAtRule(this); diff --git a/lib/src/ast/sass/statement/callable_declaration.dart b/lib/src/ast/sass/statement/callable_declaration.dart index f26bb8a82..d657767ec 100644 --- a/lib/src/ast/sass/statement/callable_declaration.dart +++ b/lib/src/ast/sass/statement/callable_declaration.dart @@ -26,7 +26,7 @@ abstract class CallableDeclaration extends ParentStatement { final FileSpan span; CallableDeclaration( - this.name, this.arguments, Iterable children, this.span, + this.name, this.arguments, Iterable children, this.span, {SilentComment comment}) : comment = comment, super(List.unmodifiable(children)); diff --git a/lib/src/ast/sass/statement/content_block.dart b/lib/src/ast/sass/statement/content_block.dart index 85881d7ed..e288865e3 100644 --- a/lib/src/ast/sass/statement/content_block.dart +++ b/lib/src/ast/sass/statement/content_block.dart @@ -11,7 +11,7 @@ import 'callable_declaration.dart'; /// An anonymous block of code that's invoked for a [ContentRule]. class ContentBlock extends CallableDeclaration { - ContentBlock(ArgumentDeclaration arguments, Iterable children, + ContentBlock(ArgumentDeclaration arguments, Iterable children, FileSpan span) : super(null /* name */, arguments, children, span); diff --git a/lib/src/ast/sass/statement/use_rule.dart b/lib/src/ast/sass/statement/use_rule.dart index 3a582c089..33932e418 100644 --- a/lib/src/ast/sass/statement/use_rule.dart +++ b/lib/src/ast/sass/statement/use_rule.dart @@ -31,7 +31,7 @@ class UseRule implements Statement { {Iterable configuration}) : configuration = configuration == null ? const [] - : List.unmodifiable(configuration) { + : List.unmodifiable(configuration) { for (var variable in this.configuration) { if (variable.isGuarded) { throw ArgumentError.value(variable, "configured variable", diff --git a/lib/src/ast/sass/statement/while_rule.dart b/lib/src/ast/sass/statement/while_rule.dart index 69cff0889..fde074d12 100644 --- a/lib/src/ast/sass/statement/while_rule.dart +++ b/lib/src/ast/sass/statement/while_rule.dart @@ -20,7 +20,7 @@ class WhileRule extends ParentStatement { final FileSpan span; WhileRule(this.condition, Iterable children, this.span) - : super(List.unmodifiable(children)); + : super(List.unmodifiable(children)); T accept(StatementVisitor visitor) => visitor.visitWhileRule(this); diff --git a/lib/src/ast/sass/supports_condition/declaration.dart b/lib/src/ast/sass/supports_condition/declaration.dart index 21db700ae..ccd43fc29 100644 --- a/lib/src/ast/sass/supports_condition/declaration.dart +++ b/lib/src/ast/sass/supports_condition/declaration.dart @@ -11,10 +11,10 @@ import '../supports_condition.dart'; /// supported. class SupportsDeclaration implements SupportsCondition { /// The name of the declaration being tested. - final Expression name; + final Expression/*!*/ name; /// The value of the declaration being tested. - final Expression value; + final Expression/*!*/ value; final FileSpan span;