Esempio n. 1
0
/* Production 22, chapter 3.4, CORBA 2.3.1 */
  public void state_member() {
 /*@bgen(jjtree) state_member */
  ASTstate_member jjtn000 = new ASTstate_member(this, IDLParserTreeConstants.JJTSTATE_MEMBER);
  bool jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
    try {
      switch ((jj_ntk==-1)?jj_ntk_calc():jj_ntk) {
      case 26:
        jj_consume_token(26);
                 jjtn000.setIsPrivate(false);
        break;
      case 27:
        jj_consume_token(27);
                                                              jjtn000.setIsPrivate(true);
        break;
      default:
        jj_la1[28] = jj_gen;
        jj_consume_token(-1);
        throw new ParseException();
        break;
      }
      type_spec();
      declarators();
      jj_consume_token(12);
    } 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(ASTstate_member, Object)
  * @param data the buildInfo for this value-type
  */
 public Object visit(ASTstate_member node, Object data) {        
     CheckParameterForBuildInfo(data, node);
     BuildInfo info = (BuildInfo) data;
     TypeBuilder builder = info.GetContainterType();
     ASTtype_spec typeSpecNode = (ASTtype_spec)node.jjtGetChild(0);
     TypeContainer fieldType = (TypeContainer)typeSpecNode.jjtAccept(this, info);
     fieldType = ReplaceByCustomMappedIfNeeded(fieldType);
     if (fieldType == null) {
         throw new InvalidIdlException(
             String.Format("field type {0} not (yet) defined for {1} in value type",
                           typeSpecNode.GetIdentification(), 
                           node.GetIdentification()));
     }
     IList /* FieldBuilder */ fields = new ArrayList();
     ASTdeclarators decl = (ASTdeclarators)node.jjtGetChild(1);
     for (int i = 0; i < decl.jjtGetNumChildren(); i++) {
         string declFieldName = 
             DetermineTypeAndNameForDeclarator((ASTdeclarator)decl.jjtGetChild(i), data,
                                               ref fieldType);
         string idlFieldName;
         FieldAttributes fieldAttributes;
         if (node.isPrivate()) { // map to protected field
             String privateName = declFieldName;
             // compensate a problem in the java rmi compiler, which can produce illegal idl:
             // it produces idl-files with name clashes if a method getx() and a field x exists
             if (!privateName.StartsWith("m_")) { 
                 privateName = "m_" + privateName; 
             }
             idlFieldName = privateName;     
             fieldAttributes = FieldAttributes.Family;
         } else { // map to public field
             idlFieldName = declFieldName;                
             fieldAttributes = FieldAttributes.Public;
         }
         idlFieldName = IdlNaming.MapIdlNameToClsName(idlFieldName);
         FieldBuilder field = 
             m_ilEmitHelper.AddFieldWithCustomAttrs(builder, idlFieldName,
                                                    fieldType, fieldAttributes);
         fields.Add(field);
     }
     return fields;
 }