use inspect for builtin function error messages
This commit is contained in:
parent
1055060c2d
commit
70cc7afdaf
@ -38,10 +38,7 @@ fn inner_hsl(name: &'static str, mut args: CallArgs, parser: &mut Parser<'_>) ->
|
|||||||
Some(Value::Dimension(n, _)) => n / Number::from(100),
|
Some(Value::Dimension(n, _)) => n / Number::from(100),
|
||||||
Some(v) => {
|
Some(v) => {
|
||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!("$lightness: {} is not a number.", v.inspect(args.span())?),
|
||||||
"$lightness: {} is not a number.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -53,10 +50,7 @@ fn inner_hsl(name: &'static str, mut args: CallArgs, parser: &mut Parser<'_>) ->
|
|||||||
Some(Value::Dimension(n, _)) => n / Number::from(100),
|
Some(Value::Dimension(n, _)) => n / Number::from(100),
|
||||||
Some(v) => {
|
Some(v) => {
|
||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!("$saturation: {} is not a number.", v.inspect(args.span())?),
|
||||||
"$saturation: {} is not a number.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -68,7 +62,7 @@ fn inner_hsl(name: &'static str, mut args: CallArgs, parser: &mut Parser<'_>) ->
|
|||||||
Some(Value::Dimension(n, _)) => n,
|
Some(Value::Dimension(n, _)) => n,
|
||||||
Some(v) => {
|
Some(v) => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$hue: {} is not a number.", v.to_css_string(args.span())?),
|
format!("$hue: {} is not a number.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -108,7 +102,7 @@ fn inner_hsl(name: &'static str, mut args: CallArgs, parser: &mut Parser<'_>) ->
|
|||||||
}
|
}
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$hue: {} is not a number.", v.to_css_string(args.span())?),
|
format!("$hue: {} is not a number.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -212,7 +206,7 @@ fn inner_hsl(name: &'static str, mut args: CallArgs, parser: &mut Parser<'_>) ->
|
|||||||
}
|
}
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$alpha: {} is not a number.", v.to_css_string(args.span())?),
|
format!("$alpha: {} is not a number.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -237,7 +231,7 @@ fn hue(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
match parser.arg(&mut args, 0, "color")? {
|
match parser.arg(&mut args, 0, "color")? {
|
||||||
Value::Color(c) => Ok(Value::Dimension(c.hue(), Unit::Deg)),
|
Value::Color(c) => Ok(Value::Dimension(c.hue(), Unit::Deg)),
|
||||||
v => Err((
|
v => Err((
|
||||||
format!("$color: {} is not a color.", v.to_css_string(args.span())?),
|
format!("$color: {} is not a color.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into()),
|
.into()),
|
||||||
@ -249,7 +243,7 @@ fn saturation(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value>
|
|||||||
match parser.arg(&mut args, 0, "color")? {
|
match parser.arg(&mut args, 0, "color")? {
|
||||||
Value::Color(c) => Ok(Value::Dimension(c.saturation(), Unit::Percent)),
|
Value::Color(c) => Ok(Value::Dimension(c.saturation(), Unit::Percent)),
|
||||||
v => Err((
|
v => Err((
|
||||||
format!("$color: {} is not a color.", v.to_css_string(args.span())?),
|
format!("$color: {} is not a color.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into()),
|
.into()),
|
||||||
@ -261,7 +255,7 @@ fn lightness(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
match parser.arg(&mut args, 0, "color")? {
|
match parser.arg(&mut args, 0, "color")? {
|
||||||
Value::Color(c) => Ok(Value::Dimension(c.lightness(), Unit::Percent)),
|
Value::Color(c) => Ok(Value::Dimension(c.lightness(), Unit::Percent)),
|
||||||
v => Err((
|
v => Err((
|
||||||
format!("$color: {} is not a color.", v.to_css_string(args.span())?),
|
format!("$color: {} is not a color.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into()),
|
.into()),
|
||||||
@ -274,7 +268,7 @@ fn adjust_hue(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value>
|
|||||||
Value::Color(c) => c,
|
Value::Color(c) => c,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$color: {} is not a color.", v.to_css_string(args.span())?),
|
format!("$color: {} is not a color.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -302,7 +296,7 @@ fn lighten(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
Value::Color(c) => c,
|
Value::Color(c) => c,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$color: {} is not a color.", v.to_css_string(args.span())?),
|
format!("$color: {} is not a color.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -330,7 +324,7 @@ fn darken(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
Value::Color(c) => c,
|
Value::Color(c) => c,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$color: {} is not a color.", v.to_css_string(args.span())?),
|
format!("$color: {} is not a color.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -389,7 +383,7 @@ fn saturate(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
}
|
}
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$color: {} is not a color.", v.to_css_string(args.span())?),
|
format!("$color: {} is not a color.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -404,7 +398,7 @@ fn desaturate(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value>
|
|||||||
Value::Color(c) => c,
|
Value::Color(c) => c,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$color: {} is not a color.", v.to_css_string(args.span())?),
|
format!("$color: {} is not a color.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -438,7 +432,7 @@ fn grayscale(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
}
|
}
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$color: {} is not a color.", v.to_css_string(args.span())?),
|
format!("$color: {} is not a color.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -453,7 +447,7 @@ fn complement(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value>
|
|||||||
Value::Color(c) => c,
|
Value::Color(c) => c,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$color: {} is not a color.", v.to_css_string(args.span())?),
|
format!("$color: {} is not a color.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -493,7 +487,7 @@ fn invert(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
)
|
)
|
||||||
.into()),
|
.into()),
|
||||||
v => Err((
|
v => Err((
|
||||||
format!("$color: {} is not a color.", v.to_css_string(args.span())?),
|
format!("$color: {} is not a color.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into()),
|
.into()),
|
||||||
|
@ -10,7 +10,7 @@ fn alpha(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
match parser.arg(&mut args, 0, "color")? {
|
match parser.arg(&mut args, 0, "color")? {
|
||||||
Value::Color(c) => Ok(Value::Dimension(c.alpha(), Unit::None)),
|
Value::Color(c) => Ok(Value::Dimension(c.alpha(), Unit::None)),
|
||||||
v => Err((
|
v => Err((
|
||||||
format!("$color: {} is not a color.", v.to_css_string(args.span())?),
|
format!("$color: {} is not a color.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into()),
|
.into()),
|
||||||
@ -26,7 +26,7 @@ fn opacity(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
QuoteKind::None,
|
QuoteKind::None,
|
||||||
)),
|
)),
|
||||||
v => Err((
|
v => Err((
|
||||||
format!("$color: {} is not a color.", v.to_css_string(args.span())?),
|
format!("$color: {} is not a color.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into()),
|
.into()),
|
||||||
@ -39,7 +39,7 @@ fn opacify(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
Value::Color(c) => c,
|
Value::Color(c) => c,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$color: {} is not a color.", v.to_css_string(args.span())?),
|
format!("$color: {} is not a color.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -49,10 +49,7 @@ fn opacify(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
Value::Dimension(n, u) => bound!(args, "amount", n, u, 0, 1),
|
Value::Dimension(n, u) => bound!(args, "amount", n, u, 0, 1),
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!("$amount: {} is not a number.", v.inspect(args.span())?),
|
||||||
"$amount: {} is not a number.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -67,7 +64,7 @@ fn fade_in(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
Value::Color(c) => c,
|
Value::Color(c) => c,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$color: {} is not a color.", v.to_css_string(args.span())?),
|
format!("$color: {} is not a color.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -77,10 +74,7 @@ fn fade_in(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
Value::Dimension(n, u) => bound!(args, "amount", n, u, 0, 1),
|
Value::Dimension(n, u) => bound!(args, "amount", n, u, 0, 1),
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!("$amount: {} is not a number.", v.inspect(args.span())?),
|
||||||
"$amount: {} is not a number.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -95,7 +89,7 @@ fn transparentize(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Val
|
|||||||
Value::Color(c) => c,
|
Value::Color(c) => c,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$color: {} is not a color.", v.to_css_string(args.span())?),
|
format!("$color: {} is not a color.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -105,10 +99,7 @@ fn transparentize(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Val
|
|||||||
Value::Dimension(n, u) => bound!(args, "amount", n, u, 0, 1),
|
Value::Dimension(n, u) => bound!(args, "amount", n, u, 0, 1),
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!("$amount: {} is not a number.", v.inspect(args.span())?),
|
||||||
"$amount: {} is not a number.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -123,7 +114,7 @@ fn fade_out(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
Value::Color(c) => c,
|
Value::Color(c) => c,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$color: {} is not a color.", v.to_css_string(args.span())?),
|
format!("$color: {} is not a color.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -133,10 +124,7 @@ fn fade_out(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
Value::Dimension(n, u) => bound!(args, "amount", n, u, 0, 1),
|
Value::Dimension(n, u) => bound!(args, "amount", n, u, 0, 1),
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!("$amount: {} is not a number.", v.inspect(args.span())?),
|
||||||
"$amount: {} is not a number.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
|
@ -19,11 +19,7 @@ macro_rules! opt_rgba {
|
|||||||
Value::Null => None,
|
Value::Null => None,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!("${}: {} is not a number.", $arg, v.inspect($args.span())?),
|
||||||
"${}: {} is not a number.",
|
|
||||||
$arg,
|
|
||||||
v.to_css_string($args.span())?
|
|
||||||
),
|
|
||||||
$args.span(),
|
$args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -41,11 +37,7 @@ macro_rules! opt_hsl {
|
|||||||
Value::Null => None,
|
Value::Null => None,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!("${}: {} is not a number.", $arg, v.inspect($args.span())?),
|
||||||
"${}: {} is not a number.",
|
|
||||||
$arg,
|
|
||||||
v.to_css_string($args.span())?
|
|
||||||
),
|
|
||||||
$args.span(),
|
$args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -67,7 +59,7 @@ fn change_color(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value
|
|||||||
Value::Color(c) => c,
|
Value::Color(c) => c,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$color: {} is not a color.", v.to_css_string(args.span())?),
|
format!("$color: {} is not a color.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -93,7 +85,7 @@ fn change_color(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value
|
|||||||
Value::Null => None,
|
Value::Null => None,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$hue: {} is not a number.", v.to_css_string(args.span())?),
|
format!("$hue: {} is not a number.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -126,7 +118,7 @@ fn adjust_color(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value
|
|||||||
Value::Color(c) => c,
|
Value::Color(c) => c,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$color: {} is not a color.", v.to_css_string(args.span())?),
|
format!("$color: {} is not a color.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -152,7 +144,7 @@ fn adjust_color(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value
|
|||||||
Value::Null => None,
|
Value::Null => None,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$hue: {} is not a number.", v.to_css_string(args.span())?),
|
format!("$hue: {} is not a number.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -196,7 +188,7 @@ fn scale_color(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value>
|
|||||||
Value::Color(c) => c,
|
Value::Color(c) => c,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$color: {} is not a color.", v.to_css_string(span)?),
|
format!("$color: {} is not a color.", v.inspect(span)?),
|
||||||
span,
|
span,
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -214,7 +206,7 @@ fn scale_color(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value>
|
|||||||
format!(
|
format!(
|
||||||
"${}: Expected {} to have unit \"%\".",
|
"${}: Expected {} to have unit \"%\".",
|
||||||
$arg,
|
$arg,
|
||||||
v.to_css_string($args.span())?
|
v.inspect($args.span())?
|
||||||
),
|
),
|
||||||
$args.span(),
|
$args.span(),
|
||||||
)
|
)
|
||||||
@ -223,11 +215,7 @@ fn scale_color(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value>
|
|||||||
Value::Null => None,
|
Value::Null => None,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!("${}: {} is not a number.", $arg, v.inspect($args.span())?),
|
||||||
"${}: {} is not a number.",
|
|
||||||
$arg,
|
|
||||||
v.to_css_string($args.span())?
|
|
||||||
),
|
|
||||||
$args.span(),
|
$args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -306,7 +294,7 @@ fn ie_hex_str(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value>
|
|||||||
Value::Color(c) => c,
|
Value::Color(c) => c,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$color: {} is not a color.", v.to_css_string(args.span())?),
|
format!("$color: {} is not a color.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
|
@ -56,7 +56,7 @@ fn inner_rgb(name: &'static str, mut args: CallArgs, parser: &mut Parser<'_>) ->
|
|||||||
}
|
}
|
||||||
Some(v) => {
|
Some(v) => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$blue: {} is not a number.", v.to_css_string(args.span())?),
|
format!("$blue: {} is not a number.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -82,7 +82,7 @@ fn inner_rgb(name: &'static str, mut args: CallArgs, parser: &mut Parser<'_>) ->
|
|||||||
}
|
}
|
||||||
Some(v) => {
|
Some(v) => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$green: {} is not a number.", v.to_css_string(args.span())?),
|
format!("$green: {} is not a number.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -107,7 +107,7 @@ fn inner_rgb(name: &'static str, mut args: CallArgs, parser: &mut Parser<'_>) ->
|
|||||||
}
|
}
|
||||||
Some(v) => {
|
Some(v) => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$red: {} is not a number.", v.to_css_string(args.span())?),
|
format!("$red: {} is not a number.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -135,7 +135,7 @@ fn inner_rgb(name: &'static str, mut args: CallArgs, parser: &mut Parser<'_>) ->
|
|||||||
}
|
}
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$color: {} is not a color.", v.to_css_string(args.span())?),
|
format!("$color: {} is not a color.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -169,7 +169,7 @@ fn inner_rgb(name: &'static str, mut args: CallArgs, parser: &mut Parser<'_>) ->
|
|||||||
}
|
}
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$alpha: {} is not a number.", v.to_css_string(args.span())?),
|
format!("$alpha: {} is not a number.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -213,7 +213,7 @@ fn inner_rgb(name: &'static str, mut args: CallArgs, parser: &mut Parser<'_>) ->
|
|||||||
}
|
}
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$red: {} is not a number.", v.to_css_string(args.span())?),
|
format!("$red: {} is not a number.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -254,7 +254,7 @@ fn inner_rgb(name: &'static str, mut args: CallArgs, parser: &mut Parser<'_>) ->
|
|||||||
}
|
}
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$green: {} is not a number.", v.to_css_string(args.span())?),
|
format!("$green: {} is not a number.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -294,7 +294,7 @@ fn inner_rgb(name: &'static str, mut args: CallArgs, parser: &mut Parser<'_>) ->
|
|||||||
}
|
}
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$blue: {} is not a number.", v.to_css_string(args.span())?),
|
format!("$blue: {} is not a number.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -331,7 +331,7 @@ fn inner_rgb(name: &'static str, mut args: CallArgs, parser: &mut Parser<'_>) ->
|
|||||||
}
|
}
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$alpha: {} is not a number.", v.to_css_string(args.span())?),
|
format!("$alpha: {} is not a number.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -356,7 +356,7 @@ fn red(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
match parser.arg(&mut args, 0, "color")? {
|
match parser.arg(&mut args, 0, "color")? {
|
||||||
Value::Color(c) => Ok(Value::Dimension(c.red(), Unit::None)),
|
Value::Color(c) => Ok(Value::Dimension(c.red(), Unit::None)),
|
||||||
v => Err((
|
v => Err((
|
||||||
format!("$color: {} is not a color.", v.to_css_string(args.span())?),
|
format!("$color: {} is not a color.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into()),
|
.into()),
|
||||||
@ -368,7 +368,7 @@ fn green(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
match parser.arg(&mut args, 0, "color")? {
|
match parser.arg(&mut args, 0, "color")? {
|
||||||
Value::Color(c) => Ok(Value::Dimension(c.green(), Unit::None)),
|
Value::Color(c) => Ok(Value::Dimension(c.green(), Unit::None)),
|
||||||
v => Err((
|
v => Err((
|
||||||
format!("$color: {} is not a color.", v.to_css_string(args.span())?),
|
format!("$color: {} is not a color.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into()),
|
.into()),
|
||||||
@ -380,7 +380,7 @@ fn blue(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
match parser.arg(&mut args, 0, "color")? {
|
match parser.arg(&mut args, 0, "color")? {
|
||||||
Value::Color(c) => Ok(Value::Dimension(c.blue(), Unit::None)),
|
Value::Color(c) => Ok(Value::Dimension(c.blue(), Unit::None)),
|
||||||
v => Err((
|
v => Err((
|
||||||
format!("$color: {} is not a color.", v.to_css_string(args.span())?),
|
format!("$color: {} is not a color.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into()),
|
.into()),
|
||||||
@ -393,7 +393,7 @@ fn mix(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
Value::Color(c) => c,
|
Value::Color(c) => c,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$color1: {} is not a color.", v.to_css_string(args.span())?),
|
format!("$color1: {} is not a color.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -404,7 +404,7 @@ fn mix(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
Value::Color(c) => c,
|
Value::Color(c) => c,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$color2: {} is not a color.", v.to_css_string(args.span())?),
|
format!("$color2: {} is not a color.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
|
@ -26,7 +26,7 @@ fn nth(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
Value::Dimension(num, _) => num,
|
Value::Dimension(num, _) => num,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$n: {} is not a number.", v.to_css_string(args.span())?),
|
format!("$n: {} is not a number.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -83,7 +83,7 @@ fn set_nth(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
Value::Dimension(num, _) => num,
|
Value::Dimension(num, _) => num,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$n: {} is not a number.", v.to_css_string(args.span())?),
|
format!("$n: {} is not a number.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -146,10 +146,7 @@ fn append(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
},
|
},
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!("$separator: {} is not a string.", v.inspect(args.span())?),
|
||||||
"$separator: {} is not a string.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -199,10 +196,7 @@ fn join(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
},
|
},
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!("$separator: {} is not a string.", v.inspect(args.span())?),
|
||||||
"$separator: {} is not a string.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
|
@ -16,7 +16,7 @@ fn map_get(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
Value::List(v, ..) if v.is_empty() => SassMap::new(),
|
Value::List(v, ..) if v.is_empty() => SassMap::new(),
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$map: {} is not a map.", v.to_css_string(args.span())?),
|
format!("$map: {} is not a map.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -33,7 +33,7 @@ fn map_has_key(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value>
|
|||||||
Value::List(v, ..) if v.is_empty() => SassMap::new(),
|
Value::List(v, ..) if v.is_empty() => SassMap::new(),
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$map: {} is not a map.", v.to_css_string(args.span())?),
|
format!("$map: {} is not a map.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -49,7 +49,7 @@ fn map_keys(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
Value::List(v, ..) if v.is_empty() => SassMap::new(),
|
Value::List(v, ..) if v.is_empty() => SassMap::new(),
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$map: {} is not a map.", v.to_css_string(args.span())?),
|
format!("$map: {} is not a map.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -69,7 +69,7 @@ fn map_values(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value>
|
|||||||
Value::List(v, ..) if v.is_empty() => SassMap::new(),
|
Value::List(v, ..) if v.is_empty() => SassMap::new(),
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$map: {} is not a map.", v.to_css_string(args.span())?),
|
format!("$map: {} is not a map.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -89,7 +89,7 @@ fn map_merge(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
Value::List(v, ..) if v.is_empty() => SassMap::new(),
|
Value::List(v, ..) if v.is_empty() => SassMap::new(),
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$map1: {} is not a map.", v.to_css_string(args.span())?),
|
format!("$map1: {} is not a map.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -100,7 +100,7 @@ fn map_merge(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
Value::List(v, ..) if v.is_empty() => SassMap::new(),
|
Value::List(v, ..) if v.is_empty() => SassMap::new(),
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$map2: {} is not a map.", v.to_css_string(args.span())?),
|
format!("$map2: {} is not a map.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -116,7 +116,7 @@ fn map_remove(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value>
|
|||||||
Value::List(v, ..) if v.is_empty() => SassMap::new(),
|
Value::List(v, ..) if v.is_empty() => SassMap::new(),
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$map: {} is not a map.", v.to_css_string(args.span())?),
|
format!("$map: {} is not a map.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
|
@ -21,7 +21,7 @@ fn percentage(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value>
|
|||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!(
|
||||||
"$number: Expected {} to have no units.",
|
"$number: Expected {} to have no units.",
|
||||||
v.to_css_string(args.span())?
|
v.inspect(args.span())?
|
||||||
),
|
),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
@ -29,10 +29,7 @@ fn percentage(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value>
|
|||||||
}
|
}
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!("$number: {} is not a number.", v.inspect(args.span())?),
|
||||||
"$number: {} is not a number.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -46,10 +43,7 @@ fn round(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
match parser.arg(&mut args, 0, "number")? {
|
match parser.arg(&mut args, 0, "number")? {
|
||||||
Value::Dimension(n, u) => Ok(Value::Dimension(n.round(), u)),
|
Value::Dimension(n, u) => Ok(Value::Dimension(n.round(), u)),
|
||||||
v => Err((
|
v => Err((
|
||||||
format!(
|
format!("$number: {} is not a number.", v.inspect(args.span())?),
|
||||||
"$number: {} is not a number.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into()),
|
.into()),
|
||||||
@ -61,10 +55,7 @@ fn ceil(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
match parser.arg(&mut args, 0, "number")? {
|
match parser.arg(&mut args, 0, "number")? {
|
||||||
Value::Dimension(n, u) => Ok(Value::Dimension(n.ceil(), u)),
|
Value::Dimension(n, u) => Ok(Value::Dimension(n.ceil(), u)),
|
||||||
v => Err((
|
v => Err((
|
||||||
format!(
|
format!("$number: {} is not a number.", v.inspect(args.span())?),
|
||||||
"$number: {} is not a number.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into()),
|
.into()),
|
||||||
@ -76,10 +67,7 @@ fn floor(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
match parser.arg(&mut args, 0, "number")? {
|
match parser.arg(&mut args, 0, "number")? {
|
||||||
Value::Dimension(n, u) => Ok(Value::Dimension(n.floor(), u)),
|
Value::Dimension(n, u) => Ok(Value::Dimension(n.floor(), u)),
|
||||||
v => Err((
|
v => Err((
|
||||||
format!(
|
format!("$number: {} is not a number.", v.inspect(args.span())?),
|
||||||
"$number: {} is not a number.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into()),
|
.into()),
|
||||||
@ -91,10 +79,7 @@ fn abs(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
match parser.arg(&mut args, 0, "number")? {
|
match parser.arg(&mut args, 0, "number")? {
|
||||||
Value::Dimension(n, u) => Ok(Value::Dimension(n.abs(), u)),
|
Value::Dimension(n, u) => Ok(Value::Dimension(n.abs(), u)),
|
||||||
v => Err((
|
v => Err((
|
||||||
format!(
|
format!("$number: {} is not a number.", v.inspect(args.span())?),
|
||||||
"$number: {} is not a number.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into()),
|
.into()),
|
||||||
@ -107,10 +92,7 @@ fn comparable(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value>
|
|||||||
Value::Dimension(_, u) => u,
|
Value::Dimension(_, u) => u,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!("$number1: {} is not a number.", v.inspect(args.span())?),
|
||||||
"$number1: {} is not a number.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -120,10 +102,7 @@ fn comparable(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value>
|
|||||||
Value::Dimension(_, u) => u,
|
Value::Dimension(_, u) => u,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!("$number2: {} is not a number.", v.inspect(args.span())?),
|
||||||
"$number2: {} is not a number.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -148,7 +127,7 @@ fn random(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
}
|
}
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$limit: {} is not a number.", v.to_css_string(args.span())?),
|
format!("$limit: {} is not a number.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
|
@ -43,10 +43,7 @@ fn feature_exists(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Val
|
|||||||
_ => Value::False,
|
_ => Value::False,
|
||||||
}),
|
}),
|
||||||
v => Err((
|
v => Err((
|
||||||
format!(
|
format!("$feature: {} is not a string.", v.inspect(args.span())?),
|
||||||
"$feature: {} is not a string.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into()),
|
.into()),
|
||||||
@ -59,10 +56,7 @@ fn unit(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
Value::Dimension(_, u) => u.to_string(),
|
Value::Dimension(_, u) => u.to_string(),
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!("$number: {} is not a number.", v.inspect(args.span())?),
|
||||||
"$number: {} is not a number.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -108,7 +102,7 @@ fn variable_exists(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Va
|
|||||||
.var_exists(&s.into(), parser.global_scope),
|
.var_exists(&s.into(), parser.global_scope),
|
||||||
)),
|
)),
|
||||||
v => Err((
|
v => Err((
|
||||||
format!("$name: {} is not a string.", v.to_css_string(args.span())?),
|
format!("$name: {} is not a string.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into()),
|
.into()),
|
||||||
@ -122,7 +116,7 @@ fn global_variable_exists(mut args: CallArgs, parser: &mut Parser<'_>) -> SassRe
|
|||||||
parser.global_scope.var_exists_no_global(&s.into()),
|
parser.global_scope.var_exists_no_global(&s.into()),
|
||||||
)),
|
)),
|
||||||
v => Err((
|
v => Err((
|
||||||
format!("$name: {} is not a string.", v.to_css_string(args.span())?),
|
format!("$name: {} is not a string.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into()),
|
.into()),
|
||||||
@ -136,7 +130,7 @@ fn mixin_exists(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value
|
|||||||
parser.scopes.last().mixin_exists(&s, parser.global_scope),
|
parser.scopes.last().mixin_exists(&s, parser.global_scope),
|
||||||
)),
|
)),
|
||||||
v => Err((
|
v => Err((
|
||||||
format!("$name: {} is not a string.", v.to_css_string(args.span())?),
|
format!("$name: {} is not a string.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into()),
|
.into()),
|
||||||
@ -150,7 +144,7 @@ fn function_exists(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Va
|
|||||||
parser.scopes.last().fn_exists(&s, parser.global_scope),
|
parser.scopes.last().fn_exists(&s, parser.global_scope),
|
||||||
)),
|
)),
|
||||||
v => Err((
|
v => Err((
|
||||||
format!("$name: {} is not a string.", v.to_css_string(args.span())?),
|
format!("$name: {} is not a string.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into()),
|
.into()),
|
||||||
@ -163,7 +157,7 @@ fn get_function(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value
|
|||||||
Value::String(s, _) => s,
|
Value::String(s, _) => s,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$name: {} is not a string.", v.to_css_string(args.span())?),
|
format!("$name: {} is not a string.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -177,10 +171,7 @@ fn get_function(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value
|
|||||||
Value::Null => None,
|
Value::Null => None,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!("$module: {} is not a string.", v.inspect(args.span())?),
|
||||||
"$module: {} is not a string.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -219,7 +210,7 @@ fn call(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!(
|
||||||
"$function: {} is not a function reference.",
|
"$function: {} is not a function reference.",
|
||||||
v.to_css_string(args.span())?
|
v.inspect(args.span())?
|
||||||
),
|
),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
|
@ -23,10 +23,7 @@ fn to_upper_case(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Valu
|
|||||||
Ok(Value::String(i, q))
|
Ok(Value::String(i, q))
|
||||||
}
|
}
|
||||||
v => Err((
|
v => Err((
|
||||||
format!(
|
format!("$string: {} is not a string.", v.inspect(args.span())?),
|
||||||
"$string: {} is not a string.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into()),
|
.into()),
|
||||||
@ -41,10 +38,7 @@ fn to_lower_case(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Valu
|
|||||||
Ok(Value::String(i, q))
|
Ok(Value::String(i, q))
|
||||||
}
|
}
|
||||||
v => Err((
|
v => Err((
|
||||||
format!(
|
format!("$string: {} is not a string.", v.inspect(args.span())?),
|
||||||
"$string: {} is not a string.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into()),
|
.into()),
|
||||||
@ -59,10 +53,7 @@ fn str_length(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value>
|
|||||||
Unit::None,
|
Unit::None,
|
||||||
)),
|
)),
|
||||||
v => Err((
|
v => Err((
|
||||||
format!(
|
format!("$string: {} is not a string.", v.inspect(args.span())?),
|
||||||
"$string: {} is not a string.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into()),
|
.into()),
|
||||||
@ -74,10 +65,7 @@ fn quote(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
match parser.arg(&mut args, 0, "string")? {
|
match parser.arg(&mut args, 0, "string")? {
|
||||||
Value::String(i, _) => Ok(Value::String(i, QuoteKind::Quoted)),
|
Value::String(i, _) => Ok(Value::String(i, QuoteKind::Quoted)),
|
||||||
v => Err((
|
v => Err((
|
||||||
format!(
|
format!("$string: {} is not a string.", v.inspect(args.span())?),
|
||||||
"$string: {} is not a string.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into()),
|
.into()),
|
||||||
@ -89,10 +77,7 @@ fn unquote(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
match parser.arg(&mut args, 0, "string")? {
|
match parser.arg(&mut args, 0, "string")? {
|
||||||
i @ Value::String(..) => Ok(i.unquote()),
|
i @ Value::String(..) => Ok(i.unquote()),
|
||||||
v => Err((
|
v => Err((
|
||||||
format!(
|
format!("$string: {} is not a string.", v.inspect(args.span())?),
|
||||||
"$string: {} is not a string.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into()),
|
.into()),
|
||||||
@ -105,10 +90,7 @@ fn str_slice(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
Value::String(s, q) => (s, q),
|
Value::String(s, q) => (s, q),
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!("$string: {} is not a string.", v.inspect(args.span())?),
|
||||||
"$string: {} is not a string.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -131,7 +113,7 @@ fn str_slice(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!(
|
||||||
"$start: Expected {} to have no units.",
|
"$start: Expected {} to have no units.",
|
||||||
v.to_css_string(args.span())?
|
v.inspect(args.span())?
|
||||||
),
|
),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
@ -139,10 +121,7 @@ fn str_slice(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
}
|
}
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!("$start-at: {} is not a number.", v.inspect(args.span())?),
|
||||||
"$start-at: {} is not a number.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -164,7 +143,7 @@ fn str_slice(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!(
|
||||||
"$end: Expected {} to have no units.",
|
"$end: Expected {} to have no units.",
|
||||||
v.to_css_string(args.span())?
|
v.inspect(args.span())?
|
||||||
),
|
),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
@ -173,10 +152,7 @@ fn str_slice(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
Value::Null => str_len,
|
Value::Null => str_len,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!("$end-at: {} is not a number.", v.inspect(args.span())?),
|
||||||
"$end-at: {} is not a number.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -207,10 +183,7 @@ fn str_index(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
Value::String(i, _) => i,
|
Value::String(i, _) => i,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!("$string: {} is not a string.", v.inspect(args.span())?),
|
||||||
"$string: {} is not a string.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -221,10 +194,7 @@ fn str_index(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value> {
|
|||||||
Value::String(i, _) => i,
|
Value::String(i, _) => i,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!("$substring: {} is not a string.", v.inspect(args.span())?),
|
||||||
"$substring: {} is not a string.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -243,10 +213,7 @@ fn str_insert(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value>
|
|||||||
Value::String(i, q) => (i, q),
|
Value::String(i, q) => (i, q),
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!("$string: {} is not a string.", v.inspect(args.span())?),
|
||||||
"$string: {} is not a string.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -257,10 +224,7 @@ fn str_insert(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value>
|
|||||||
Value::String(i, _) => i,
|
Value::String(i, _) => i,
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!("$insert: {} is not a string.", v.inspect(args.span())?),
|
||||||
"$insert: {} is not a string.",
|
|
||||||
v.to_css_string(args.span())?
|
|
||||||
),
|
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
@ -276,7 +240,7 @@ fn str_insert(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value>
|
|||||||
return Err((
|
return Err((
|
||||||
format!(
|
format!(
|
||||||
"$index: Expected {} to have no units.",
|
"$index: Expected {} to have no units.",
|
||||||
v.to_css_string(args.span())?
|
v.inspect(args.span())?
|
||||||
),
|
),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
@ -284,7 +248,7 @@ fn str_insert(mut args: CallArgs, parser: &mut Parser<'_>) -> SassResult<Value>
|
|||||||
}
|
}
|
||||||
v => {
|
v => {
|
||||||
return Err((
|
return Err((
|
||||||
format!("$index: {} is not a number.", v.to_css_string(args.span())?),
|
format!("$index: {} is not a number.", v.inspect(args.span())?),
|
||||||
args.span(),
|
args.span(),
|
||||||
)
|
)
|
||||||
.into())
|
.into())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user