'Add a variable in this scope (possibly as a property)
@param name {unicode} The name of the variable
@param value {JSObject} The value of the variable
@param metadata {dict} Extra metadata about the assignment
@returns {JSObject} The resulting variable (possibly different from
|value| if one with the given |name| exists)'

def addVariable(self, name, value=None, metadata=None):

    v = self.variables.get(name, None)
    if (v is None):
        v = self.members.get(name, None)
    if (v is None):
        log.info('VAR:%s,    line:%d,    type:%r,    scope:%r,    meta:%r', name, value.line, value.type, self.name, metadata)
        v = value
        self.variables[name] = v
    else:
        self._mergeVariables(v, value)
    if metadata:
        if (v.metadata is None):
            v.metadata = metadata
        else:
            v.metadata.update(metadata)
    return v
