refactor mixin args
This commit is contained in:
parent
0cbdc67f06
commit
4b15b27119
@ -62,7 +62,7 @@ impl Mixin {
|
||||
scope: &Scope,
|
||||
super_selector: &Selector,
|
||||
) -> SassResult<Mixin> {
|
||||
for (idx, arg) in self.args.0.iter().enumerate() {
|
||||
for (idx, arg) in self.args.0.iter_mut().enumerate() {
|
||||
if arg.is_variadic {
|
||||
let span = args.span();
|
||||
self.scope.insert_var(
|
||||
@ -74,14 +74,12 @@ impl Mixin {
|
||||
)?;
|
||||
break;
|
||||
}
|
||||
let val = match args.get_positional(idx, scope, super_selector) {
|
||||
let val = match args.get(idx, arg.name.clone(), &scope, super_selector) {
|
||||
Some(v) => v?,
|
||||
None => match args.get_named(arg.name.clone(), scope, super_selector) {
|
||||
Some(v) => v?,
|
||||
None => match &arg.default {
|
||||
None => match arg.default.as_mut() {
|
||||
Some(v) => Value::from_tokens(
|
||||
&mut v.iter().cloned().peekmore(),
|
||||
scope,
|
||||
&mut std::mem::take(v).into_iter().peekmore(),
|
||||
&scope,
|
||||
super_selector,
|
||||
)?,
|
||||
None => {
|
||||
@ -90,7 +88,6 @@ impl Mixin {
|
||||
)
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
self.scope.insert_var(&arg.name, val)?;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user