parameters: (self, function, var)
return_statement: return c
docstring: Generates a check for the correct number of arguments when creating
      Params.
docstring_summary: Generates a check for the correct number of arguments when creating
      Params.
docstring_tokens: Generates a check for the correct number of arguments when creating Params .
function: def _GenerateParamsCheck(self, function, var):
      """Generates a check for the correct number of arguments when creating
      Params.
      """
      c = Code()
      num_required = 0
      for param in function.params:
        if not param.optional:
          num_required += 1
      if num_required == len(function.params):
        c.Sblock('if (%(var)s.GetSize() != %(total)d) {')
      elif not num_required:
        c.Sblock('if (%(var)s.GetSize() > %(total)d) {')
      else:
        c.Sblock('if (%(var)s.GetSize() < %(required)d'
            ' || %(var)s.GetSize() > %(total)d) {')
      (c.Concat(self._GenerateError(
          '"expected %%(total)d arguments, got " '
          '+ base::IntToString(%%(var)s.GetSize())'))
        .Append('return nullptr;')
        .Eblock('}')
        .Substitute({
          'var': var,
          'required': num_required,
          'total': len(function.params),
      }))
      return c
function_tokens: def _GenerateParamsCheck ( self , function , var ) : c = Code ( ) num_required = 0 for param in function . params : if not param . optional : num_required += 1 if num_required == len ( function . params ) : c . Sblock ( 'if (%(var)s.GetSize() != %(total)d) {' ) elif not num_required : c . Sblock ( 'if (%(var)s.GetSize() > %(total)d) {' ) else : c . Sblock ( 'if (%(var)s.GetSize() < %(required)d' ' || %(var)s.GetSize() > %(total)d) {' ) ( c . Concat ( self . _GenerateError ( '"expected %%(total)d arguments, got " ' '+ base::IntToString(%%(var)s.GetSize())' ) ) . Append ( 'return nullptr;' ) . Eblock ( '}' ) . Substitute ( { 'var' : var , 'required' : num_required , 'total' : len ( function . params ) , } ) ) return c