rename Value::Function
to Value::FunctionRef
This commit is contained in:
parent
235836a4e0
commit
b473717861
@ -209,12 +209,12 @@ fn get_function(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
Ok(Value::Function(func))
|
Ok(Value::FunctionRef(func))
|
||||||
}
|
}
|
||||||
|
|
||||||
fn call(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
fn call(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
||||||
let func = match parser.arg(&mut args, 0, "function")? {
|
let func = match parser.arg(&mut args, 0, "function")? {
|
||||||
Value::Function(f) => f,
|
Value::FunctionRef(f) => f,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!(
|
||||||
|
@ -160,7 +160,7 @@ impl<'a, 'b: 'a> ValueVisitor<'a, 'b> {
|
|||||||
v => panic!("{:?}", v),
|
v => panic!("{:?}", v),
|
||||||
};
|
};
|
||||||
Ok(match left {
|
Ok(match left {
|
||||||
Value::Map(..) | Value::Function(..) => {
|
Value::Map(..) | Value::FunctionRef(..) => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("{} isn't a valid CSS value.", left.inspect(self.span)?),
|
format!("{} isn't a valid CSS value.", left.inspect(self.span)?),
|
||||||
self.span,
|
self.span,
|
||||||
@ -223,7 +223,7 @@ impl<'a, 'b: 'a> ValueVisitor<'a, 'b> {
|
|||||||
format!("{}{}{}", num, unit, right.to_css_string(self.span)?),
|
format!("{}{}{}", num, unit, right.to_css_string(self.span)?),
|
||||||
QuoteKind::None,
|
QuoteKind::None,
|
||||||
),
|
),
|
||||||
Value::Map(..) | Value::Function(..) => {
|
Value::Map(..) | Value::FunctionRef(..) => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("{} isn't a valid CSS value.", right.inspect(self.span)?),
|
format!("{} isn't a valid CSS value.", right.inspect(self.span)?),
|
||||||
self.span,
|
self.span,
|
||||||
@ -329,7 +329,7 @@ impl<'a, 'b: 'a> ValueVisitor<'a, 'b> {
|
|||||||
format!("{}{}-{}", num, unit, right.to_css_string(self.span)?),
|
format!("{}{}-{}", num, unit, right.to_css_string(self.span)?),
|
||||||
QuoteKind::None,
|
QuoteKind::None,
|
||||||
),
|
),
|
||||||
Value::Map(..) | Value::Function(..) => {
|
Value::Map(..) | Value::FunctionRef(..) => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("{} isn't a valid CSS value.", right.inspect(self.span)?),
|
format!("{} isn't a valid CSS value.", right.inspect(self.span)?),
|
||||||
self.span,
|
self.span,
|
||||||
@ -517,7 +517,7 @@ impl<'a, 'b: 'a> ValueVisitor<'a, 'b> {
|
|||||||
QuoteKind::None,
|
QuoteKind::None,
|
||||||
),
|
),
|
||||||
Value::Null => Value::String(format!("{}{}/", num, unit), QuoteKind::None),
|
Value::Null => Value::String(format!("{}{}/", num, unit), QuoteKind::None),
|
||||||
Value::Map(..) | Value::Function(..) => {
|
Value::Map(..) | Value::FunctionRef(..) => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("{} isn't a valid CSS value.", right.inspect(self.span)?),
|
format!("{} isn't a valid CSS value.", right.inspect(self.span)?),
|
||||||
self.span,
|
self.span,
|
||||||
|
@ -36,7 +36,7 @@ pub(crate) enum Value {
|
|||||||
Map(SassMap),
|
Map(SassMap),
|
||||||
ArgList(Vec<Spanned<Value>>),
|
ArgList(Vec<Spanned<Value>>),
|
||||||
/// Returned by `get-function()`
|
/// Returned by `get-function()`
|
||||||
Function(SassFunction),
|
FunctionRef(SassFunction),
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_quoted_string(buf: &mut String, force_double_quote: bool, string: &str) {
|
fn visit_quoted_string(buf: &mut String, force_double_quote: bool, string: &str) {
|
||||||
@ -130,7 +130,7 @@ impl Value {
|
|||||||
}
|
}
|
||||||
_ => Cow::owned(format!("{}{}", num, unit)),
|
_ => Cow::owned(format!("{}{}", num, unit)),
|
||||||
},
|
},
|
||||||
Self::Map(..) | Self::Function(..) => {
|
Self::Map(..) | Self::FunctionRef(..) => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("{} isn't a valid CSS value.", self.inspect(span)?),
|
format!("{} isn't a valid CSS value.", self.inspect(span)?),
|
||||||
span,
|
span,
|
||||||
@ -222,7 +222,7 @@ impl Value {
|
|||||||
Self::String(..) | Self::Important => "string",
|
Self::String(..) | Self::Important => "string",
|
||||||
Self::Dimension(..) => "number",
|
Self::Dimension(..) => "number",
|
||||||
Self::List(..) => "list",
|
Self::List(..) => "list",
|
||||||
Self::Function(..) => "function",
|
Self::FunctionRef(..) => "function",
|
||||||
Self::ArgList(..) => "arglist",
|
Self::ArgList(..) => "arglist",
|
||||||
Self::True | Self::False => "bool",
|
Self::True | Self::False => "bool",
|
||||||
Self::Null => "null",
|
Self::Null => "null",
|
||||||
@ -277,7 +277,7 @@ impl Value {
|
|||||||
.join(sep.as_str()),
|
.join(sep.as_str()),
|
||||||
),
|
),
|
||||||
}),
|
}),
|
||||||
Value::Function(f) => Cow::owned(format!("get-function(\"{}\")", f.name())),
|
Value::FunctionRef(f) => Cow::owned(format!("get-function(\"{}\")", f.name())),
|
||||||
Value::Null => Cow::const_str("null"),
|
Value::Null => Cow::const_str("null"),
|
||||||
Value::Map(map) => Cow::owned(format!(
|
Value::Map(map) => Cow::owned(format!(
|
||||||
"({})",
|
"({})",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user