mirror of
https://github.com/danog/dart-sass.git
synced 2025-01-22 05:41:14 +01:00
UnaryOperatorExpression -> UnaryOperationExpression
This commit is contained in:
parent
5d71ac78b9
commit
bcaaa1103f
@ -18,7 +18,7 @@ export 'sass/expression/null.dart';
|
|||||||
export 'sass/expression/number.dart';
|
export 'sass/expression/number.dart';
|
||||||
export 'sass/expression/selector.dart';
|
export 'sass/expression/selector.dart';
|
||||||
export 'sass/expression/string.dart';
|
export 'sass/expression/string.dart';
|
||||||
export 'sass/expression/unary_operator.dart';
|
export 'sass/expression/unary_operation.dart';
|
||||||
export 'sass/expression/variable.dart';
|
export 'sass/expression/variable.dart';
|
||||||
export 'sass/interpolation.dart';
|
export 'sass/interpolation.dart';
|
||||||
export 'sass/media_query.dart';
|
export 'sass/media_query.dart';
|
||||||
|
@ -9,7 +9,7 @@ import '../../../utils.dart';
|
|||||||
import '../../../value.dart';
|
import '../../../value.dart';
|
||||||
import '../../../visitor/interface/expression.dart';
|
import '../../../visitor/interface/expression.dart';
|
||||||
import '../expression.dart';
|
import '../expression.dart';
|
||||||
import 'unary_operator.dart';
|
import 'unary_operation.dart';
|
||||||
|
|
||||||
class ListExpression implements Expression {
|
class ListExpression implements Expression {
|
||||||
final List<Expression> contents;
|
final List<Expression> contents;
|
||||||
@ -54,7 +54,7 @@ class ListExpression implements Expression {
|
|||||||
|
|
||||||
if (separator != ListSeparator.space) return false;
|
if (separator != ListSeparator.space) return false;
|
||||||
|
|
||||||
if (expression is UnaryOperatorExpression) {
|
if (expression is UnaryOperationExpression) {
|
||||||
return expression.operator == UnaryOperator.plus ||
|
return expression.operator == UnaryOperator.plus ||
|
||||||
expression.operator == UnaryOperator.minus;
|
expression.operator == UnaryOperator.minus;
|
||||||
}
|
}
|
||||||
|
@ -8,17 +8,17 @@ import 'package:charcode/charcode.dart';
|
|||||||
import '../../../visitor/interface/expression.dart';
|
import '../../../visitor/interface/expression.dart';
|
||||||
import '../expression.dart';
|
import '../expression.dart';
|
||||||
|
|
||||||
class UnaryOperatorExpression implements Expression {
|
class UnaryOperationExpression implements Expression {
|
||||||
final UnaryOperator operator;
|
final UnaryOperator operator;
|
||||||
|
|
||||||
final Expression operand;
|
final Expression operand;
|
||||||
|
|
||||||
final FileSpan span;
|
final FileSpan span;
|
||||||
|
|
||||||
UnaryOperatorExpression(this.operator, this.operand, this.span);
|
UnaryOperationExpression(this.operator, this.operand, this.span);
|
||||||
|
|
||||||
/*=T*/ accept/*<T>*/(ExpressionVisitor/*<T>*/ visitor) =>
|
/*=T*/ accept/*<T>*/(ExpressionVisitor/*<T>*/ visitor) =>
|
||||||
visitor.visitUnaryOperatorExpression(this);
|
visitor.visitUnaryOperationExpression(this);
|
||||||
|
|
||||||
String toString() {
|
String toString() {
|
||||||
var buffer = new StringBuffer(operator.operator);
|
var buffer = new StringBuffer(operator.operator);
|
@ -773,7 +773,7 @@ abstract class StylesheetParser extends Parser {
|
|||||||
case $lparen:
|
case $lparen:
|
||||||
return _parentheses();
|
return _parentheses();
|
||||||
case $slash:
|
case $slash:
|
||||||
return _unaryOperator();
|
return _unaryOperation();
|
||||||
case $dot:
|
case $dot:
|
||||||
return _number();
|
return _number();
|
||||||
case $lbracket:
|
case $lbracket:
|
||||||
@ -795,14 +795,14 @@ abstract class StylesheetParser extends Parser {
|
|||||||
var next = scanner.peekChar(1);
|
var next = scanner.peekChar(1);
|
||||||
if (isDigit(next) || next == $dot) return _number();
|
if (isDigit(next) || next == $dot) return _number();
|
||||||
|
|
||||||
return _unaryOperator();
|
return _unaryOperation();
|
||||||
|
|
||||||
case $minus:
|
case $minus:
|
||||||
var next = scanner.peekChar(1);
|
var next = scanner.peekChar(1);
|
||||||
if (isDigit(next) || next == $dot) return _number();
|
if (isDigit(next) || next == $dot) return _number();
|
||||||
if (_lookingAtInterpolatedIdentifier()) return _identifierLike();
|
if (_lookingAtInterpolatedIdentifier()) return _identifierLike();
|
||||||
|
|
||||||
return _unaryOperator();
|
return _unaryOperation();
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (first == null) scanner.error("Expected expression.");
|
if (first == null) scanner.error("Expected expression.");
|
||||||
@ -870,7 +870,7 @@ abstract class StylesheetParser extends Parser {
|
|||||||
return new MapExpression(pairs, scanner.spanFrom(start));
|
return new MapExpression(pairs, scanner.spanFrom(start));
|
||||||
}
|
}
|
||||||
|
|
||||||
UnaryOperatorExpression _unaryOperator() {
|
UnaryOperationExpression _unaryOperation() {
|
||||||
var start = scanner.state;
|
var start = scanner.state;
|
||||||
var operator = _unaryOperatorFor(scanner.readChar());
|
var operator = _unaryOperatorFor(scanner.readChar());
|
||||||
if (operator == null) {
|
if (operator == null) {
|
||||||
@ -879,7 +879,7 @@ abstract class StylesheetParser extends Parser {
|
|||||||
|
|
||||||
whitespace();
|
whitespace();
|
||||||
var operand = _singleExpression();
|
var operand = _singleExpression();
|
||||||
return new UnaryOperatorExpression(
|
return new UnaryOperationExpression(
|
||||||
operator, operand, scanner.spanFrom(start));
|
operator, operand, scanner.spanFrom(start));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1054,7 +1054,7 @@ abstract class StylesheetParser extends Parser {
|
|||||||
switch (identifier.asPlain) {
|
switch (identifier.asPlain) {
|
||||||
case "not":
|
case "not":
|
||||||
whitespace();
|
whitespace();
|
||||||
return new UnaryOperatorExpression(
|
return new UnaryOperationExpression(
|
||||||
UnaryOperator.not, _singleExpression(), identifier.span);
|
UnaryOperator.not, _singleExpression(), identifier.span);
|
||||||
|
|
||||||
case "null":
|
case "null":
|
||||||
|
@ -15,6 +15,6 @@ abstract class ExpressionVisitor<T> {
|
|||||||
T visitNumberExpression(NumberExpression node);
|
T visitNumberExpression(NumberExpression node);
|
||||||
T visitSelectorExpression(SelectorExpression node);
|
T visitSelectorExpression(SelectorExpression node);
|
||||||
T visitStringExpression(StringExpression node);
|
T visitStringExpression(StringExpression node);
|
||||||
T visitUnaryOperatorExpression(UnaryOperatorExpression node);
|
T visitUnaryOperationExpression(UnaryOperationExpression node);
|
||||||
T visitVariableExpression(VariableExpression node);
|
T visitVariableExpression(VariableExpression node);
|
||||||
}
|
}
|
||||||
|
@ -576,7 +576,7 @@ class PerformVisitor implements StatementVisitor, ExpressionVisitor<Value> {
|
|||||||
throw _exception("Undefined variable.", node.span);
|
throw _exception("Undefined variable.", node.span);
|
||||||
}
|
}
|
||||||
|
|
||||||
Value visitUnaryOperatorExpression(UnaryOperatorExpression node) {
|
Value visitUnaryOperationExpression(UnaryOperationExpression node) {
|
||||||
var operand = node.operand.accept(this);
|
var operand = node.operand.accept(this);
|
||||||
switch (node.operator) {
|
switch (node.operator) {
|
||||||
case UnaryOperator.plus:
|
case UnaryOperator.plus:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user