/* Production 85, chapter 3.4, corba 2.3.1 */ public void attr_dcl() { /*@bgen(jjtree) attr_dcl */ ASTattr_dcl jjtn000 = new ASTattr_dcl(this, IDLParserTreeConstants.JJTATTR_DCL); bool jjtc000 = true; jjtree.openNodeScope(jjtn000);bool isReadOnly = false; try { switch ((jj_ntk==-1)?jj_ntk_calc():jj_ntk) { case 74: jj_consume_token(74); isReadOnly = true; break; default: jj_la1[72] = jj_gen; ; break; } jj_consume_token(75); param_type_spec(); simple_declarator(); while (true) { switch ((jj_ntk==-1)?jj_ntk_calc():jj_ntk) { case 20: ; break; default: jj_la1[73] = jj_gen; goto label_23; break; } jj_consume_token(20); simple_declarator(); } label_23: ; jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; jjtn000.setReadOnly(isReadOnly); } 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(ASTattr_dcl, Object) * @param data the buildinfo of the type, which declares this attribute */ public Object visit(ASTattr_dcl node, Object data) { CheckParameterForBuildInfo(data, node); BuildInfo info = (BuildInfo) data; TypeBuilder builder = info.GetContainterType(); ASTparam_type_spec typeSpecNode = (ASTparam_type_spec)node.jjtGetChild(0); TypeContainer propType = (TypeContainer)typeSpecNode.jjtAccept(this, info); if (propType == null) { throw new InvalidIdlException( String.Format("attribute type {0} not defined for attribute(s) {1}", typeSpecNode.GetIdentification(), node.GetIdentification())); } propType = ReplaceByCustomMappedIfNeeded(propType); for (int i = 1; i < node.jjtGetNumChildren(); i++) { ASTsimple_declarator simpleDecl = (ASTsimple_declarator) node.jjtGetChild(i); String propName = IdlNaming.MapIdlNameToClsName(simpleDecl.getIdent()); String transmittedNameGetter = IdlNaming.DetermineGetterTransmissionName(simpleDecl.getIdent()); // set the methods for the property MethodBuilder getAccessor = m_ilEmitHelper.AddPropertyGetter(builder, propName, transmittedNameGetter, propType, MethodAttributes.Virtual | MethodAttributes.Abstract | MethodAttributes.Public | MethodAttributes.NewSlot); MethodBuilder setAccessor = null; if (!(node.isReadOnly())) { String transmittedNameSetter = IdlNaming.DetermineSetterTransmissionName(simpleDecl.getIdent()); setAccessor = m_ilEmitHelper.AddPropertySetter(builder, propName, transmittedNameSetter, propType, MethodAttributes.Virtual | MethodAttributes.Abstract | MethodAttributes.Public | MethodAttributes.NewSlot); } string fromIdlPropertyName = IdlNaming.DetermineAttributeTransmissionName(simpleDecl.getIdent()); m_ilEmitHelper.AddProperty(builder, propName, fromIdlPropertyName, propType, getAccessor, setAccessor); } return null; }