parameters: (self, lower)
docstring: Lower the generator's next() function (which takes the
          passed-by-reference generator structure and returns the next
          yielded value).
docstring_summary: Lower the generator's next() function (which takes the
          passed-by-reference generator structure and returns the next
          yielded value).
docstring_tokens: Lower the generator s next () function ( which takes the passed - by - reference generator structure and returns the next yielded value ) .
function: def lower_next_func(self, lower):
          """
          Lower the generator's next() function (which takes the
          passed-by-reference generator structure and returns the next
          yielded value).
          """
          lower.setup_function(self.gendesc)
          lower.debug_print("# lower_next_func: {0}".format(self.gendesc.unique_name))
          assert self.gendesc.argtypes[0] == self.gentype
          builder = lower.builder
          function = lower.function
  
          # Extract argument values and other information from generator struct
          genptr, = self.call_conv.get_arguments(function)
          self.arg_packer.load_into(builder,
                                    self.get_args_ptr(builder, genptr),
                                    lower.fnargs)
  
          self.resume_index_ptr = self.get_resume_index_ptr(builder, genptr)
          self.gen_state_ptr = self.get_state_ptr(builder, genptr)
  
          prologue = function.append_basic_block("generator_prologue")
  
          # Lower the generator's Python code
          entry_block_tail = lower.lower_function_body()
  
          # Add block for StopIteration on entry
          stop_block = function.append_basic_block("stop_iteration")
          builder.position_at_end(stop_block)
          self.call_conv.return_stop_iteration(builder)
  
          # Add prologue switch to resume blocks
          builder.position_at_end(prologue)
          # First Python block is also the resume point on first next() call
          first_block = self.resume_blocks[0] = lower.blkmap[lower.firstblk]
  
          # Create front switch to resume points
          switch = builder.switch(builder.load(self.resume_index_ptr),
                                  stop_block)
          for index, block in self.resume_blocks.items():
              switch.add_case(index, block)
  
          # Close tail of entry block
          builder.position_at_end(entry_block_tail)
          builder.branch(prologue)
function_tokens: def lower_next_func ( self , lower ) : lower . setup_function ( self . gendesc ) lower . debug_print ( "# lower_next_func: {0}" . format ( self . gendesc . unique_name ) ) assert self . gendesc . argtypes [ 0 ] == self . gentype builder = lower . builder function = lower . function # Extract argument values and other information from generator struct genptr , = self . call_conv . get_arguments ( function ) self . arg_packer . load_into ( builder , self . get_args_ptr ( builder , genptr ) , lower . fnargs ) self . resume_index_ptr = self . get_resume_index_ptr ( builder , genptr ) self . gen_state_ptr = self . get_state_ptr ( builder , genptr ) prologue = function . append_basic_block ( "generator_prologue" ) # Lower the generator's Python code entry_block_tail = lower . lower_function_body ( ) # Add block for StopIteration on entry stop_block = function . append_basic_block ( "stop_iteration" ) builder . position_at_end ( stop_block ) self . call_conv . return_stop_iteration ( builder ) # Add prologue switch to resume blocks builder . position_at_end ( prologue ) # First Python block is also the resume point on first next() call first_block = self . resume_blocks [ 0 ] = lower . blkmap [ lower . firstblk ] # Create front switch to resume points switch = builder . switch ( builder . load ( self . resume_index_ptr ) , stop_block ) for index , block in self . resume_blocks . items ( ) : switch . add_case ( index , block ) # Close tail of entry block builder . position_at_end ( entry_block_tail ) builder . branch ( prologue )