'Add something to this class
@param partName {unicode} The name of the thing to add
@param addType {int} What sort of thing to add; can be one of ADD_CLASS
(add a new child class), ADD_CLASS_MEMBER (a member varaible),
ADD_CLASS_VARIABLE (a member variable), ADD_CLASS_FUNCTION (a
method), ADD_CLASS_PARENT (an object on this class\'s prototype
chain), ADD_CLASS_CONSTRUCTOR (a constructor function)
@param scopeNames {list of unicode} The expression to locate the part
@param args {JSArguments} The arguments to a method when using
ADD_CLASS_FUNCTION
@param doc {list of unicode} The documentation comment for this part
@param path {list of unicode}
@param varCtor {callable} The constructor function to create a variable
for use with ADD_CLASS_MEMBER / ADD_CLASS_VARIABLE; the
signature should match that of JSVariable'

def _addClassPart(self, partName, addType, scopeNames=None, args=None, doc=None, path=None, varCtor=JSVariable):

    log.debug('_addClassPart:    partName:%r,    addType:%r,    scopeNames:%r,    args:%r', partName, addType, scopeNames, args)
    jsclass = None
    fn = None
    if scopeNames:
        jsclass = self._locateScopeForName(scopeNames, attrlist=('classes',))
        if ((jsclass is None) or (not isinstance(jsclass, JSClass))):
            jsclass = self._locateScopeForName(scopeNames, attrlist=('classes', 'functions', 'variables'))
            if isinstance(jsclass, JSFunction):
                jsclass = self._convertFunctionToClass(jsclass)
    else:
        jsclass = self.currentClass
    if ((not jsclass) and scopeNames):
        if (len(scopeNames) > 1):
            toScope = self._findOrCreateScope(scopeNames, attrlist=('classes', 'functions', 'variables'))
        else:
            toScope = self.currentScope
        className = scopeNames[(-1)]
        jsclass = JSClass(className, toScope, self.lineno, self.depth, doc=doc, path=path)
        self.currentScope.classes[jsclass.name] = jsclass
        log.info('CLASS:    %r    on    line    %d    in    %r    at    depth    %d', jsclass.name, jsclass.line, self.currentScope.name, self.depth)
        self.currentScope = jsclass
    if (addType == self.ADD_CLASS_FUNCTION):
        log.info('CLASS_FUNC:    %s(%s)    on    line    %d', partName, args, self.lineno)
        fn = JSFunction(partName, jsclass, args, self.lineno, self.depth, doc=doc)
        fn._class = jsclass
        jsclass.functions[fn.name] = fn
        self.currentScope = fn
    elif (addType == self.ADD_CLASS_MEMBER):
        if (partName not in jsclass.variables):
            log.info('CLASS_MBR    added:    %r', partName)
            v = varCtor(partName, jsclass, self.lineno, self.depth, doc=doc, path=self.path)
            jsclass.variables[partName] = v
        else:
            log.info('CLASS_MBR    already    exists:    %r', partName)
    elif (addType == self.ADD_CLASS_VARIABLE):
        if (partName not in jsclass.variables):
            log.info('CLASS_VBR    added:    %r', partName)
            v = varCtor(partName, jsclass, self.lineno, self.depth, doc=doc, path=self.path)
            jsclass.variables[partName] = v
        else:
            log.info('CLASS_MBR    already    exists:    %r', partName)
    elif (addType == self.ADD_CLASS_PARENT):
        log.info('CLASS_PARENT:    %r', partName)
        jsclass.addClassRef(partName)
    elif (addType == self.ADD_CLASS_CONSTRUCTOR):
        log.info('CLASS_CTOR:    %r', partName)
        jsclass.constructor = partName
    if jsclass:
        self.currentClass = jsclass
        if (addType == self.ADD_CLASS):
            self.currentScope = jsclass
        elif ((addType == self.ADD_CLASS_PARENT) and (partName == 'Object')):
            self.currentScope = jsclass
    return jsclass
