fn gather_elements(&mut self, elements: &[ast::Expression]) -> Result<bool, CompileError> {
        // First determine if we have starred elements:
        let has_stars = elements.iter().any(|e| {
            if let ast::ExpressionType::Starred { .. } = &e.node {
                true
            } else {
                false
            }
        });

        for element in elements {
            if let ast::ExpressionType::Starred { value } = &element.node {
                self.compile_expression(value)?;
            } else {
                self.compile_expression(element)?;
                if has_stars {
                    self.emit(Instruction::BuildTuple {
                        size: 1,
                        unpack: false,
                    });
                }
            }
        }

        Ok(has_stars)
    }
// Given a vector of expr / star expr generate code which gives either
// a list of expressions on the stack, or a list of tuples.
Given a vector of expr / star expr generate code which gives either
a list of expressions on the stack, or a list of tuples.
Given a vector of expr / star expr generate code which gives either a list of expressions on the stack or a list of tuples .
fn gather_elements(&mut self, elements: &[ast::Expression]) -> Result<bool, CompileError> {
        // First determine if we have starred elements:
        let has_stars = elements.iter().any(|e| {
            if let ast::ExpressionType::Starred { .. } = &e.node {
                true
            } else {
                false
            }
        });
        for element in elements {
            if let ast::ExpressionType::Starred { value } = &element.node {
                self.compile_expression(value)?;
            } else {
                self.compile_expression(element)?;
                if has_stars {
                    self.emit(Instruction::BuildTuple {
                        size: 1,
                        unpack: false,
                    });
                }
            }
        }
        Ok(has_stars)
    }
fn gather_elements ( & mut self , elements : & [ ast :: Expression ] ) -> Result < bool , CompileError > { // First determine if we have starred elements: let has_stars = elements . iter ( ) . any ( | e | { if let ast :: ExpressionType :: Starred { .. } = & e . node { true } else { false } } ) ; for element in elements { if let ast :: ExpressionType :: Starred { value } = & element . node { self . compile_expression ( value ) ? ; } else { self . compile_expression ( element ) ? ; if has_stars { self . emit ( Instruction :: BuildTuple { size : 1 , unpack : false , } ) ; } } } Ok ( has_stars ) }
Given a vector of expr / star expr generate code which gives either
a list of expressions on the stack, or a list of tuples.
Given a vector of expr / star expr generate code which gives either a list of expressions on the stack or a list of tuples .
&mut self
elements
&[ast::Expression]