/// Evaluate these sass CallArgs to css CallArgs.
Evaluate these sass CallArgs to css CallArgs.
Evaluate these sass CallArgs to css CallArgs .
pub fn evaluate(&self, scope: ScopeRef) -> Result<css::CallArgs, Error> {
        let positional = Vec::new();
        let named = self.named.iter().try_fold(
            OrderMap::new(),
            |mut acc, (name, arg)| {
                arg.do_evaluate(scope.clone(), true).map(|arg| {
                    acc.insert(name.clone(), arg);
                    acc
                })
            },
        )?;
        let mut result = css::CallArgs { positional, named };
        for arg in &self.positional {
            match is_splat(arg) {
                Some([one]) => match one.do_evaluate(scope.clone(), true)? {
                    css::Value::ArgList(args) => {
                        result.positional.extend(args.positional);
                        for (name, value) in args.named {
                            if let Some(_existing) =
                                result.named.insert(name, value)
                            {
                                return Err(Error::error(
                                    "Duplicate argument.",
                                ));
                            }
                        }
                    }
                    css::Value::Map(map) => {
                        result.add_from_value_map(map)?;
                    }
                    css::Value::List(items, ..) => {
                        for item in items {
                            result.positional.push(item);
                        }
                    }
                    css::Value::Null => (),
                    item => {
                        result.positional.push(item);
                    }
                },
                Some(splat) => {
                    for arg in splat {
                        result
                            .positional
                            .push(arg.do_evaluate(scope.clone(), true)?);
                    }
                }
                None => {
                    result
                        .positional
                        .push(arg.do_evaluate(scope.clone(), true)?);
                }
            }
        }
        Ok(result)
    }
pub fn evaluate ( & self , scope : ScopeRef ) -> Result < css :: CallArgs , Error > { let positional = Vec :: new ( ) ; let named = self . named . iter ( ) . try_fold ( OrderMap :: new ( ) , | mut acc , ( name , arg ) | { arg . do_evaluate ( scope . clone ( ) , true ) . map ( | arg | { acc . insert ( name . clone ( ) , arg ) ; acc } ) } , ) ? ; let mut result = css :: CallArgs { positional , named } ; for arg in & self . positional { match is_splat ( arg ) { Some ( [ one ] ) => match one . do_evaluate ( scope . clone ( ) , true ) ? { css :: Value :: ArgList ( args ) => { result . positional . extend ( args . positional ) ; for ( name , value ) in args . named { if let Some ( _existing ) = result . named . insert ( name , value ) { return Err ( Error :: error ( " " , ) ) ; } } } css :: Value :: Map ( map ) => { result . add_from_value_map ( map ) ? ; } css :: Value :: List ( items , .. ) => { for item in items { result . positional . push ( item ) ; } } css :: Value :: Null => ( ) , item => { result . positional . push ( item ) ; } } , Some ( splat ) => { for arg in splat { result . positional . push ( arg . do_evaluate ( scope . clone ( ) , true ) ? ) ; } } None => { result . positional . push ( arg . do_evaluate ( scope . clone ( ) , true ) ? ) ; } } } Ok ( result ) }
Evaluate these sass CallArgs to css CallArgs.
Evaluate these sass CallArgs to css CallArgs .
&self
scope
ScopeRef