mirror of
https://github.com/danog/dart-sass.git
synced 2024-11-27 04:34:59 +01:00
Fix analysis.
This commit is contained in:
parent
13e3bd7707
commit
f09d2c01b2
@ -387,8 +387,8 @@ class Parser {
|
||||
if (first == $plus || first == $minus) _scanner.readChar();
|
||||
|
||||
num number = 0;
|
||||
var first = _scanner.peekChar();
|
||||
if (!isDigit(first) && first != $dot) _scanner.error("Expected number.");
|
||||
var second = _scanner.peekChar();
|
||||
if (!isDigit(second) && second != $dot) _scanner.error("Expected number.");
|
||||
|
||||
while (isDigit(_scanner.peekChar())) {
|
||||
number *= 10;
|
||||
@ -469,7 +469,7 @@ class Parser {
|
||||
}
|
||||
}
|
||||
|
||||
return buffer.interpolation(_scanner.spanFrom(start));
|
||||
return new StringExpression(buffer.interpolation(_scanner.spanFrom(start)));
|
||||
}
|
||||
|
||||
Expression _hexColor() => throw new UnimplementedError();
|
||||
|
@ -6,11 +6,10 @@ import 'package:charcode/charcode.dart';
|
||||
|
||||
import '../../ast/css/node.dart';
|
||||
import '../../util/character.dart';
|
||||
import '../../utils.dart';
|
||||
import '../../value.dart';
|
||||
import '../css.dart';
|
||||
|
||||
String toCss(AstNode node) {
|
||||
String toCss(CssNode node) {
|
||||
var visitor = new _SerializeCssVisitor();
|
||||
node.accept(visitor);
|
||||
var result = visitor._buffer.toString();
|
||||
@ -68,10 +67,11 @@ class _SerializeCssVisitor extends CssVisitor {
|
||||
_buffer.writeCharCode($semicolon);
|
||||
}
|
||||
|
||||
void visitBoolean(SassBoolean value) => value.value.toString();
|
||||
void visitBoolean(SassBoolean value) =>
|
||||
_buffer.write(value.value.toString());
|
||||
|
||||
void visitIdentifier(SassIdentifier value) =>
|
||||
value.text.replaceAll("\n", " ");
|
||||
_buffer.write(value.text.replaceAll("\n", " "));
|
||||
|
||||
void visitList(SassList value) {
|
||||
if (value.contents.isEmpty) throw "() isn't a valid CSS value";
|
||||
@ -152,13 +152,6 @@ class _SerializeCssVisitor extends CssVisitor {
|
||||
return doubleQuote ? '"$buffer"' : "'$buffer'";
|
||||
}
|
||||
|
||||
num _round(num number) {
|
||||
if (number is double && (number.isInfinite || number.isNaN)) return number;
|
||||
if (almostEquals(number % 1, 0.0)) return number.round();
|
||||
return (number * 10 * SassNumber.precision).round() /
|
||||
(10 * SassNumber.precision);
|
||||
}
|
||||
|
||||
void _writeIndentation() {
|
||||
for (var i = 0; i < _indentation; i++) {
|
||||
_buffer.writeCharCode($space);
|
||||
|
@ -43,16 +43,17 @@ class PerformVisitor extends StatementVisitor {
|
||||
|
||||
void visitDeclaration(Declaration node) {
|
||||
var name = _performInterpolation(node.name);
|
||||
var value = _performExpression(node.value);
|
||||
var cssValue = _performExpression(node.value);
|
||||
var value = cssValue.value;
|
||||
|
||||
// Don't abort for an empty list because converting it to CSS will throw an
|
||||
// error that we want to user to see.
|
||||
if (value.value.isBlank &&
|
||||
!(value.value is SassList && value.value.contents.isEmpty)) {
|
||||
if (value.isBlank &&
|
||||
!(value is SassList && value.contents.isEmpty)) {
|
||||
return;
|
||||
}
|
||||
|
||||
_addChild(new CssDeclaration(name, value, span: node.span));
|
||||
_addChild(new CssDeclaration(name, cssValue, span: node.span));
|
||||
}
|
||||
|
||||
void visitStyleRule(StyleRule node) {
|
||||
|
Loading…
Reference in New Issue
Block a user