コード例 #1
0
/* Production 86, chapter 3.4, corba 2.3.1 */
  public void except_dcl() {
 /*@bgen(jjtree) except_dcl */
  ASTexcept_dcl jjtn000 = new ASTexcept_dcl(this, IDLParserTreeConstants.JJTEXCEPT_DCL);
  bool jjtc000 = true;
  jjtree.openNodeScope(jjtn000);String ident = "";
    try {
      jj_consume_token(76);
      ident = identifier();
    Scope currentScope = m_symbolTable.getCurrentScope();
    currentScope.addSymbol(ident);
    jjtn000.setIdent(ident);
    m_symbolTable.openScope(ident, true); // open a scope for type declaration inside the exception

      jj_consume_token(14);
      while (true) {
        switch ((jj_ntk==-1)?jj_ntk_calc():jj_ntk) {
        case 21:
        case 50:
        case 51:
        case 52:
        case 53:
        case 54:
        case 55:
        case 56:
        case 57:
        case 58:
        case 59:
        case 60:
        case 61:
        case 62:
        case 66:
        case 67:
        case 70:
        case 71:
        case 83:
        case 84:
        case IDLParserConstants.ID:
          ;
          break;
        default:
          jj_la1[74] = jj_gen;
          goto label_24;
          break;
        }
        member();
      }
      label_24: ;
      
      jj_consume_token(15);
     jjtree.closeNodeScope(jjtn000, true);
     jjtc000 = false;
    m_symbolTable.closeScope();
    } catch (Exception jjte000) {
    if (jjtc000) {
      jjtree.clearNodeScope(jjtn000);
      jjtc000 = false;
    } else {
      jjtree.popNode();
    }
  {if (true) throw ;}
    } finally {
    if (jjtc000) {
      jjtree.closeNodeScope(jjtn000, true);
    }
    }
  }
コード例 #2
0
    /**
     * @see parser.IDLParserVisitor#visit(ASTexcept_dcl, Object)
     * @param data expected is an instance of BuildInfo
     * if ((BuildInfo)data).getContainerType() is null, than an independant type-decl is created, else
     * the type delcaration is added to the Type in creation
     */
    public Object visit(ASTexcept_dcl node, Object data) {
        CheckParameterForBuildInfo(data, node);
        BuildInfo buildInfo = (BuildInfo) data;
        Symbol forSymbol = buildInfo.GetBuildScope().getSymbol(node.getIdent());
        // check if type is known from a previous run over a parse tree --> if so: skip
        if (m_typeManager.CheckSkip(forSymbol)) { 
            return null;
        }
       
        TypeBuilder exceptToCreate = 
            m_typeManager.StartTypeDefinition(forSymbol,
                                              TypeAttributes.Class | TypeAttributes.Public,
                                              typeof(AbstractUserException), Type.EmptyTypes, 
                                              false);
                                                                               
        BuildInfo thisTypeInfo = new BuildInfo(buildInfo.GetBuildScope().getChildScope(forSymbol.getSymbolName()),
                                               exceptToCreate,
                                               forSymbol);

        // add fileds ...
        IList members = (IList)GenerateMemberList(node, thisTypeInfo);
        // add inheritance from IIdlEntity        
        exceptToCreate.AddInterfaceImplementation(typeof(IIdlEntity));
        AddExceptionRequiredSerializationCode(exceptToCreate, members);
        AddExplicitSerializationOrder(exceptToCreate, members);
        
        // create the type
        m_typeManager.EndTypeDefinition(forSymbol);
        return null;
    }