Merge pull request #107 from sass/fixes

More sass-spec fixes.
This commit is contained in:
Natalie Weizenbaum 2017-02-02 15:04:56 -08:00 committed by GitHub
commit 6e4b2223d3
3 changed files with 12 additions and 5 deletions

View File

@ -62,6 +62,12 @@
* Properly handle a backslash followed by a CRLF sequence in a quoted string.
* Fix numbers divided by colors.
* Support slash-separated numbers in arguments to plain CSS functions.
* Error out if a function is passed an unknown named parameter.
## 1.0.0-alpha.8
* Add the `content-exists()` function.

View File

@ -438,8 +438,7 @@ class SassNumber extends Value {
return _multiplyUnits(this.value / other.value, this.numeratorUnits,
this.denominatorUnits, other.denominatorUnits, other.numeratorUnits);
}
if (other is! SassColor) return super.dividedBy(other);
throw new SassScriptException('Undefined operation "$this / $other".');
return super.dividedBy(other);
}
Value unaryPlus() => this;

View File

@ -1351,6 +1351,7 @@ class _PerformVisitor
/// when applied to [arguments].
void _verifyArguments(int positional, Map<String, dynamic> named,
ArgumentDeclaration arguments, FileSpan span) {
var namedUsed = 0;
for (var i = 0; i < arguments.arguments.length; i++) {
var argument = arguments.arguments[i];
if (i < positional) {
@ -1360,8 +1361,9 @@ class _PerformVisitor
"name.",
span);
}
} else if (argument.defaultValue == null &&
!named.containsKey(argument.name)) {
} else if (named.containsKey(argument.name)) {
namedUsed++;
} else if (argument.defaultValue == null) {
throw _exception("Missing argument \$${argument.name}.", span);
}
}
@ -1377,7 +1379,7 @@ class _PerformVisitor
span);
}
if (arguments.arguments.length - positional < named.length) {
if (namedUsed < named.length) {
var unknownNames = normalizedSet(named.keys)
..removeAll(arguments.arguments.map((argument) => argument.name));
throw _exception(