/* Production 23, chapter 3.4, CORBA 2.3.1 */ public void init_decl() { /*@bgen(jjtree) init_decl */ ASTinit_decl jjtn000 = new ASTinit_decl(this, IDLParserTreeConstants.JJTINIT_DECL); bool jjtc000 = true; jjtree.openNodeScope(jjtn000);String ident = ""; try { jj_consume_token(28); ident = identifier(); jj_consume_token(29); switch ((jj_ntk==-1)?jj_ntk_calc():jj_ntk) { case 31: init_param_delcs(); break; default: jj_la1[29] = jj_gen; ; break; } jj_consume_token(30); switch ((jj_ntk==-1)?jj_ntk_calc():jj_ntk) { case 81: raises_expr(); break; default: jj_la1[30] = jj_gen; ; break; } jj_consume_token(12); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.setIdent(ident); } catch (Exception jjte000) { if (jjtc000) { jjtree.clearNodeScope(jjtn000); jjtc000 = false; } else { jjtree.popNode(); } {if (true) throw ;} } finally { if (jjtc000) { jjtree.closeNodeScope(jjtn000, true); } } }
/** * @see parser.IDLParserVisitor#visit(ASTinit_decl, Object) */ public Object visit(ASTinit_decl node, Object data) { CheckParameterForBuildInfo(data, node); ConcreteValTypeBuildInfo info = (ConcreteValTypeBuildInfo) data; TypeBuilder builder = info.GetContainterType(); // ConstructorInfo defConstr = builder.GetConstructor(Type.EmptyTypes); if (node.jjtGetNumChildren() > 0) { // non-default constructor ParameterSpec[] parameters = (ParameterSpec[])node.jjtGetChild(0).jjtAccept(this, info); ConstructorBuilder constr = m_ilEmitHelper.AddConstructor(builder, parameters, MethodAttributes.Family); ILGenerator gen = constr.GetILGenerator(); // call default constructor of class gen.Emit(OpCodes.Ldarg_0); gen.Emit(OpCodes.Call, info.DefaultConstructor); gen.Emit(OpCodes.Ret); } return null; }