Skip to content

Commit

Permalink
Fix dartdoc errors
Browse files Browse the repository at this point in the history
Also fix a couple places where our external API wasn't quite right.
  • Loading branch information
nex3 committed Jul 30, 2021
1 parent a28c656 commit 9f3133a
Show file tree
Hide file tree
Showing 15 changed files with 42 additions and 21 deletions.
9 changes: 8 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,18 @@
## 1.36.1
## 1.37.0

### Dart API

* **Potentially breaking bug fix:** `SassNumber.asSlash`,
`SassNumber.withSlash()`, and `SassNumber.withoutSlash()` have been marked as
`@internal`. They were never intended to be used outside the `sass` package.

* **Potentially breaking bug fix:** `SassException` has been marked as `@sealed`
to formally indicate that it's not intended to be extended outside of the
`sass` package.

* Add a `Value.withListContents()` method that returns a new Sass list with the
same list separator and brackets as the current value, interpreted as a list.

## 1.36.0

### Dart API
Expand Down
12 changes: 6 additions & 6 deletions lib/sass.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ export 'src/warn.dart' show warn;
/// correspond to which in the resulting CSS. [SingleMapping.targetUrl] will be
/// `null`. It's up to the caller to save this mapping to disk and add a source
/// map comment to [CompileResult.css] pointing to it. Users using the
/// [SourceMap] API should be sure to add the [`source_maps`][] package to their
/// pubspec.
/// [SingleMapping] API should be sure to add the [`source_maps`][] package to
/// their pubspec.
///
/// [`source_maps`]: https://pub.dartlang.org/packages/source_maps
///
Expand Down Expand Up @@ -168,8 +168,8 @@ CompileResult compileToResult(String path,
/// correspond to which in the resulting CSS. [SingleMapping.targetUrl] will be
/// `null`. It's up to the caller to save this mapping to disk and add a source
/// map comment to [CompileResult.css] pointing to it. Users using the
/// [SourceMap] API should be sure to add the [`source_maps`][] package to their
/// pubspec.
/// [SingleMapping] API should be sure to add the [`source_maps`][] package to
/// their pubspec.
///
/// [`source_maps`]: https://pub.dartlang.org/packages/source_maps
///
Expand Down Expand Up @@ -290,7 +290,7 @@ Future<CompileResult> compileStringToResultAsync(String source,
/// sections of the source file(s) correspond to which in the resulting CSS.
/// It's called immediately before this method returns, and only if compilation
/// succeeds. Note that [SingleMapping.targetUrl] will always be `null`. Users
/// using the [SourceMap] API should be sure to add the [`source_maps`][]
/// using the [SingleMapping] API should be sure to add the [`source_maps`][]
/// package to their pubspec.
///
/// [`source_maps`]: https://pub.dartlang.org/packages/source_maps
Expand Down Expand Up @@ -341,7 +341,7 @@ String compile(
/// sections of the source file(s) correspond to which in the resulting CSS.
/// It's called immediately before this method returns, and only if compilation
/// succeeds. Note that [SingleMapping.targetUrl] will always be `null`. Users
/// using the [SourceMap] API should be sure to add the [`source_maps`][]
/// using the [SingleMapping] API should be sure to add the [`source_maps`][]
/// package to their pubspec.
///
/// [`source_maps`]: https://pub.dartlang.org/packages/source_maps
Expand Down
1 change: 1 addition & 0 deletions lib/src/ast/sass/at_root_query.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import 'package:collection/collection.dart';

import '../../exception.dart';
import '../../logger.dart';
import '../../parse/at_root_query.dart';
import '../css.dart';
Expand Down
1 change: 1 addition & 0 deletions lib/src/ast/sass/expression.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// MIT-style license that can be found in the LICENSE file or at
// https://opensource.org/licenses/MIT.

import '../../exception.dart';
import '../../logger.dart';
import '../../parse/scss.dart';
import '../../visitor/interface/expression.dart';
Expand Down
5 changes: 3 additions & 2 deletions lib/src/ast/sass/statement/stylesheet.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ import 'dart:collection';

import 'package:source_span/source_span.dart';

import '../../../visitor/interface/statement.dart';
import '../../../exception.dart';
import '../../../logger.dart';
import '../../../parse/css.dart';
import '../../../parse/sass.dart';
import '../../../parse/scss.dart';
import '../../../syntax.dart';
import '../../../visitor/interface/statement.dart';
import '../statement.dart';
import 'parent.dart';
import 'forward_rule.dart';
import 'loud_comment.dart';
import 'parent.dart';
import 'silent_comment.dart';
import 'use_rule.dart';
import 'variable_declaration.dart';
Expand Down
1 change: 1 addition & 0 deletions lib/src/ast/sass/statement/use_rule.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import 'package:source_span/source_span.dart';

import '../../../exception.dart';
import '../../../logger.dart';
import '../../../parse/scss.dart';
import '../../../visitor/interface/statement.dart';
Expand Down
1 change: 1 addition & 0 deletions lib/src/ast/sass/statement/variable_declaration.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import 'package:source_span/source_span.dart';

import '../../../exception.dart';
import '../../../logger.dart';
import '../../../parse/scss.dart';
import '../../../utils.dart';
Expand Down
5 changes: 3 additions & 2 deletions lib/src/callable.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'package:meta/meta.dart';

import 'callable/async.dart';
import 'callable/built_in.dart';
import 'exception.dart';
import 'value.dart';

export 'callable/async.dart';
Expand Down Expand Up @@ -41,8 +42,8 @@ export 'callable/user_defined.dart';
/// * When manipulating values like lists, strings, and numbers that have
/// metadata (comma versus space separated, bracketed versus unbracketed,
/// quoted versus unquoted, units), the output metadata should match the input
/// metadata. For lists, the [Value.changeList] method can be used to do this
/// automatically.
/// metadata. For lists, the [Value.withListContents] method can be used to do
/// this automatically.
///
/// * When in doubt, lists should default to comma-separated, strings should
/// default to quoted, and number should default to unitless.
Expand Down
1 change: 1 addition & 0 deletions lib/src/callable/async.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import 'dart:async';

import 'package:meta/meta.dart';

import '../exception.dart';
import '../value.dart';
import 'async_built_in.dart';

Expand Down
4 changes: 2 additions & 2 deletions lib/src/functions/list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ final _setNth = _function("set-nth", r"$list, $n, $value", (arguments) {
var value = arguments[2];
var newList = list.asList.toList();
newList[list.sassIndexToListIndex(index, "n")] = value;
return arguments[0].changeListContents(newList);
return arguments[0].withListContents(newList);
});

final _join = _function(
Expand Down Expand Up @@ -99,7 +99,7 @@ final _append =
}

var newList = [...list.asList, value];
return list.changeListContents(newList, separator: separator);
return list.withListContents(newList, separator: separator);
});

final _zip = _function("zip", r"$lists...", (arguments) {
Expand Down
3 changes: 2 additions & 1 deletion lib/src/importer/package.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class PackageImporter extends Importer {
/// package.
///
/// [`PackageConfig`]: https://pub.dev/documentation/package_config/latest/package_config.package_config/PackageConfig-class.html
PackageImporter(this._packageConfig);
PackageImporter(PackageConfig packageConfig)
: _packageConfig = packageConfig;

Uri? canonicalize(Uri url) {
if (url.scheme == 'file') return _filesystemImporter.canonicalize(url);
Expand Down
2 changes: 1 addition & 1 deletion lib/src/node/value/list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ final Function listConstructor = createClass('SassList',
'setValue': (_NodeSassList thisArg, int index, Object value) {
var mutable = thisArg.dartValue.asList.toList();
mutable[index] = unwrapValue(value);
thisArg.dartValue = thisArg.dartValue.changeListContents(mutable);
thisArg.dartValue = thisArg.dartValue.withListContents(mutable);
},
'getSeparator': (_NodeSassList thisArg) =>
thisArg.dartValue.separator == ListSeparator.comma,
Expand Down
5 changes: 1 addition & 4 deletions lib/src/value.dart
Original file line number Diff line number Diff line change
Expand Up @@ -307,10 +307,7 @@ abstract class Value {

/// Returns a new list containing [contents] that defaults to this value's
/// separator and brackets.
///
/// @nodoc
@internal
SassList changeListContents(Iterable<Value> contents,
SassList withListContents(Iterable<Value> contents,
{ListSeparator? separator, bool? brackets}) {
return SassList(contents, separator ?? this.separator,
brackets: brackets ?? hasBrackets);
Expand Down
11 changes: 10 additions & 1 deletion lib/src/value/number.dart
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ abstract class SassNumber extends Value {

/// The representation of this number as two slash-separated numbers, if it
/// has one.
///
/// @nodoc
@internal
final Tuple2<SassNumber, SassNumber>? asSlash;

/// Whether [this] is an integer, according to [fuzzyEquals].
Expand Down Expand Up @@ -259,10 +262,16 @@ abstract class SassNumber extends Value {
SassNumber withValue(num value);

/// Returns a copy of [this] without [asSlash] set.
///
/// @nodoc
@internal
SassNumber withoutSlash() => asSlash == null ? this : withValue(value);

/// Returns a copy of [this] with [this.asSlash] set to a tuple containing
/// Returns a copy of [this] with [asSlash] set to a tuple containing
/// [numerator] and [denominator].
///
/// @nodoc
@internal
SassNumber withSlash(SassNumber numerator, SassNumber denominator);

SassNumber assertNumber([String? name]) => this;
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: sass
version: 1.36.0
version: 1.37.0
description: A Sass implementation in Dart.
author: Sass Team
homepage: https://github.com/sass/dart-sass
Expand Down

0 comments on commit 9f3133a

Please sign in to comment.