parameters: (self, prop, src, dst)
return_statement: return c
docstring: Generate the code to populate a single property in a type.
  
      src: base::DictionaryValue*
      dst: Type*
docstring_summary: Generate the code to populate a single property in a type.
docstring_tokens: Generate the code to populate a single property in a type .
function: def _GenerateTypePopulateProperty(self, prop, src, dst):
      """Generate the code to populate a single property in a type.
  
      src: base::DictionaryValue*
      dst: Type*
      """
      c = Code()
      value_var = prop.unix_name + '_value'
      c.Append('const base::Value* %(value_var)s = NULL;')
      if prop.optional:
        (c.Sblock(
            'if (%(src)s->GetWithoutPathExpansion("%(key)s", &%(value_var)s)) {')
          .Concat(self._GeneratePopulatePropertyFromValue(
              prop, value_var, dst, 'false')))
        underlying_type = self._type_helper.FollowRef(prop.type_)
        if underlying_type.property_type == PropertyType.ENUM:
          namespace_prefix = ('%s::' % underlying_type.namespace.unix_name
                              if underlying_type.namespace != self._namespace
                              else '')
          (c.Append('} else {')
            .Append('%%(dst)s->%%(name)s = %s%s;' %
               (namespace_prefix,
                self._type_helper.GetEnumNoneValue(prop.type_))))
        c.Eblock('}')
      else:
        (c.Sblock(
            'if (!%(src)s->GetWithoutPathExpansion("%(key)s", &%(value_var)s)) {')
          .Concat(self._GenerateError('"\'%%(key)s\' is required"'))
          .Append('return false;')
          .Eblock('}')
          .Concat(self._GeneratePopulatePropertyFromValue(
              prop, value_var, dst, 'false'))
        )
      c.Append()
      c.Substitute({
        'value_var': value_var,
        'key': prop.name,
        'src': src,
        'dst': dst,
        'name': prop.unix_name
      })
      return c
function_tokens: def _GenerateTypePopulateProperty ( self , prop , src , dst ) : c = Code ( ) value_var = prop . unix_name + '_value' c . Append ( 'const base::Value* %(value_var)s = NULL;' ) if prop . optional : ( c . Sblock ( 'if (%(src)s->GetWithoutPathExpansion("%(key)s", &%(value_var)s)) {' ) . Concat ( self . _GeneratePopulatePropertyFromValue ( prop , value_var , dst , 'false' ) ) ) underlying_type = self . _type_helper . FollowRef ( prop . type_ ) if underlying_type . property_type == PropertyType . ENUM : namespace_prefix = ( '%s::' % underlying_type . namespace . unix_name if underlying_type . namespace != self . _namespace else '' ) ( c . Append ( '} else {' ) . Append ( '%%(dst)s->%%(name)s = %s%s;' % ( namespace_prefix , self . _type_helper . GetEnumNoneValue ( prop . type_ ) ) ) ) c . Eblock ( '}' ) else : ( c . Sblock ( 'if (!%(src)s->GetWithoutPathExpansion("%(key)s", &%(value_var)s)) {' ) . Concat ( self . _GenerateError ( '"\'%%(key)s\' is required"' ) ) . Append ( 'return false;' ) . Eblock ( '}' ) . Concat ( self . _GeneratePopulatePropertyFromValue ( prop , value_var , dst , 'false' ) ) ) c . Append ( ) c . Substitute ( { 'value_var' : value_var , 'key' : prop . name , 'src' : src , 'dst' : dst , 'name' : prop . unix_name } ) return c