parameters: (self, function)
return_statement: return c
docstring: Generates functions for passing a function's result back.
docstring_summary: Generates functions for passing a function's result back.
docstring_tokens: Generates functions for passing a function s result back .
function: def _GenerateFunctionResult(self, function):
      """Generates functions for passing a function's result back.
      """
      c = Code()
  
      c.Sblock('namespace Result {')
      params = function.callback.params
      if not params:
        c.Append('Value* Create();')
      else:
        c.Concat(self._GeneratePropertyStructures(params))
  
        # If there is a single parameter, this is straightforward. However, if
        # the callback parameter is of 'choices', this generates a Create method
        # for each choice. This works because only 1 choice can be returned at a
        # time.
        for param in self._cpp_type_generator.GetExpandedChoicesInParams(params):
          if param.description:
            c.Comment(param.description)
          if param.type_ == PropertyType.ANY:
            c.Comment("Value* Result::Create(Value*) not generated "
                      "because it's redundant.")
            continue
          c.Append('Value* Create(const %s);' % cpp_util.GetParameterDeclaration(
              param, self._cpp_type_generator.GetType(param)))
      c.Eblock('};')
  
      return c
function_tokens: def _GenerateFunctionResult ( self , function ) : c = Code ( ) c . Sblock ( 'namespace Result {' ) params = function . callback . params if not params : c . Append ( 'Value* Create();' ) else : c . Concat ( self . _GeneratePropertyStructures ( params ) ) # If there is a single parameter, this is straightforward. However, if # the callback parameter is of 'choices', this generates a Create method # for each choice. This works because only 1 choice can be returned at a # time. for param in self . _cpp_type_generator . GetExpandedChoicesInParams ( params ) : if param . description : c . Comment ( param . description ) if param . type_ == PropertyType . ANY : c . Comment ( "Value* Result::Create(Value*) not generated " "because it's redundant." ) continue c . Append ( 'Value* Create(const %s);' % cpp_util . GetParameterDeclaration ( param , self . _cpp_type_generator . GetType ( param ) ) ) c . Eblock ( '};' ) return c