rem: '"' + compoundName + '", 0, KJS::DontDelete|KJS::ReadOnly, &' + compoundData + '::ctorMethod, p_statics, p_enums, p_methods };\n' + 'KJS::JSObject *' + compoundData + '::ctorMethod( KJS::ExecState *exec, const KJS::List &args )\n' + 
add: '"' + compoundName + '", 0, KJS::DontDelete|KJS::ReadOnly, &' + compoundData + '::ctorMethod, p_statics, p_enums, KJSEmbed::' + compoundData + '::p_methods };\n' + 'KJS::JSObject *KJSEmbed::' + compoundData + '::ctorMethod( KJS::ExecState *exec, const KJS::List &args )\n' + 
context: function write_ctor( compoundDef, compoundEnums ){    var compoundName = compoundDef.firstChildElement('compoundname').toElement().toString();    var ctor =        'const Constructor ' + compoundData + '::p_constructor = \n' +        '{'+        '"' + compoundName + '", 0, KJS::DontDelete|KJS::ReadOnly, &' + compoundData + '::ctorMethod, p_statics, p_enums, p_methods };\n' +        'KJS::JSObject *' + compoundData + '::ctorMethod( KJS::ExecState *exec, const KJS::List &args )\n' +        '{\n';    // Generate the ctor bindings    var methodList = compoundDef.elementsByTagName( "memberdef" );    var methodListList = new Array;    for( var idx = 0; idx < methodList.length(); ++idx )    {        var memberElement = methodList.item(idx).toElement();        var memberKind = memberElement.attribute( 'kind' );        var memberProt = memberElement.attribute('prot');        var memberName = memberElement.firstChildElement('name').toElement().toString();        var memberArgList = memberElement.elementsByTagName('param');        if (( memberKind == 'function' ) && // Constructor is a function            ( memberProt == 'public' ) && // Make sure it is public            ( memberName.indexOf('operator') == -1 ) && // Make sure this is not an operator.            ( memberName.indexOf(compoundName) != -1 ) && // This _is_ a ctor            ( memberName.indexOf('~') == -1 )) // This is _not_ a dtor        {            var args = memberArgList.count();            if(!methodListList[args]) {                methodListList[args] = new Array;            }            methodListList[args].push( memberElement );        }    }    for(var idx = 0; idx < methodListList.length; ++idx)    {        if(!methodListList[idx]) continue;        var memberElement = methodListList[idx][0];        var memberArgList = memberElement.elementsByTagName('param');        ctor += '    if (args.size() == ' + memberArgList.count() + ' )\n' +        '    {\n';        var tmpArgs = '';        if ( memberArgList.count() == 0 )        {            tmpArgs =  + '()';            ctor +=             '        return new KJSEmbed::' + compoundName + 'Binding(exec, ' + compoundName + '());\n';        }        else        {            for ( argIdx = 0; argIdx < memberArgList.count(); ++argIdx )            {                var param = memberArgList.item(argIdx).toElement();                var paramVarElement = param.firstChildElement('declname').toElement();                var paramVar = paramVarElement.toString();                if (paramVarElement.isNull())                    paramVar = 'arg' + paramIdx;                tmpArgs += paramVar + ', ';            }            var tmpIdx = tmpArgs.lastIndexOf(',');            tmpArgs = tmpArgs.substr(0, tmpIdx);            var funcCall =            'return new KJSEmbed::' + compoundName + 'Binding(exec, ' + compoundName + '(' + tmpArgs + '));\n';            ctor += construct_parameters(methodListList[idx], idx, funcCall, compoundEnums);        }        ctor += '    }\n';    }    ctor += '    return KJS::throwError(exec, KJS::SyntaxError, "Syntax error in parameter list for ' + compoundName + '");\n'    + '}';    return ctor;}
meta: 1078	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/1078/b9a5f8301280755e3f059f8636150ca9ebeb1a4f/generatebinding.js/buggy/kjsembed/autobind/values/generatebinding.js