context: function write_ctor( compoundDef ){    var compoundName = compoundDef.firstChildElement('compoundname').toElement().toString();    var ctor =        'const Constructor ' + compoundName + '::p_constructor = \n' +        '{'+        '"' + compoundName + '", 0, KJS::DontDelete|KJS::ReadOnly, &' + compoundName + '::ctorMethod, p_statics, p_enums, p_methods };\n' +        'KJS::JSObject *' + compoundName + '::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 memberName = memberElement.firstChildElement('name').toElement().toString();        var memberArgList = memberElement.elementsByTagName('param');        if ( memberKind == 'function' )        {            if ( memberName.indexOf('operator') == -1 ) // Make sure this is not an operator.            {                if ( memberName.indexOf(compoundName) != -1 ) // This _is_ a ctor                {                    if ( 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 = compoundName + '()';        }        for ( argIdx = 0; argIdx < memberArgList.count(); ++argIdx )        {            var param = memberArgList.item(argIdx).toElement();            var paramVar = param.firstChildElement('declname').toElement().toString();//             ctor += extract_parameter(param, argIdx);            tmpArgs += paramVar + ', ';        }        ctor += extract_parameter_const(methodListList[idx], idx);        var tmpIdx = tmpArgs.lastIndexOf(',');        tmpArgs = tmpArgs.substr(0, tmpIdx);        ctor +=        '        return new KJSEmbed::' + compoundName + 'Binding(exec, ' + compoundName + '(' + tmpArgs + '))\n' +        '    }\n';    }    ctor += '}';    return ctor;}
meta: 1078	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/1078/9169028444f12eef66bc32ee5b9251fb1c1dde51/generatebinding.js/buggy/kjsembed/autobind/values/generatebinding.js