rename Value::Function to Value::FunctionRef

This commit is contained in:
Connor Skees 2020-07-03 12:58:09 -04:00
parent 235836a4e0
commit b473717861
3 changed files with 10 additions and 10 deletions

View File

@ -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> {
let func = match parser.arg(&mut args, 0, "function")? {
Value::Function(f) => f,
Value::FunctionRef(f) => f,
v => {
return Err((
format!(

View File

@ -160,7 +160,7 @@ impl<'a, 'b: 'a> ValueVisitor<'a, 'b> {
v => panic!("{:?}", v),
};
Ok(match left {
Value::Map(..) | Value::Function(..) => {
Value::Map(..) | Value::FunctionRef(..) => {
return Err((
format!("{} isn't a valid CSS value.", left.inspect(self.span)?),
self.span,
@ -223,7 +223,7 @@ impl<'a, 'b: 'a> ValueVisitor<'a, 'b> {
format!("{}{}{}", num, unit, right.to_css_string(self.span)?),
QuoteKind::None,
),
Value::Map(..) | Value::Function(..) => {
Value::Map(..) | Value::FunctionRef(..) => {
return Err((
format!("{} isn't a valid CSS value.", right.inspect(self.span)?),
self.span,
@ -329,7 +329,7 @@ impl<'a, 'b: 'a> ValueVisitor<'a, 'b> {
format!("{}{}-{}", num, unit, right.to_css_string(self.span)?),
QuoteKind::None,
),
Value::Map(..) | Value::Function(..) => {
Value::Map(..) | Value::FunctionRef(..) => {
return Err((
format!("{} isn't a valid CSS value.", right.inspect(self.span)?),
self.span,
@ -517,7 +517,7 @@ impl<'a, 'b: 'a> ValueVisitor<'a, 'b> {
QuoteKind::None,
),
Value::Null => Value::String(format!("{}{}/", num, unit), QuoteKind::None),
Value::Map(..) | Value::Function(..) => {
Value::Map(..) | Value::FunctionRef(..) => {
return Err((
format!("{} isn't a valid CSS value.", right.inspect(self.span)?),
self.span,

View File

@ -36,7 +36,7 @@ pub(crate) enum Value {
Map(SassMap),
ArgList(Vec<Spanned<Value>>),
/// Returned by `get-function()`
Function(SassFunction),
FunctionRef(SassFunction),
}
fn visit_quoted_string(buf: &mut String, force_double_quote: bool, string: &str) {
@ -130,7 +130,7 @@ impl Value {
}
_ => Cow::owned(format!("{}{}", num, unit)),
},
Self::Map(..) | Self::Function(..) => {
Self::Map(..) | Self::FunctionRef(..) => {
return Err((
format!("{} isn't a valid CSS value.", self.inspect(span)?),
span,
@ -222,7 +222,7 @@ impl Value {
Self::String(..) | Self::Important => "string",
Self::Dimension(..) => "number",
Self::List(..) => "list",
Self::Function(..) => "function",
Self::FunctionRef(..) => "function",
Self::ArgList(..) => "arglist",
Self::True | Self::False => "bool",
Self::Null => "null",
@ -277,7 +277,7 @@ impl Value {
.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::Map(map) => Cow::owned(format!(
"({})",