Example #1
0
/* Production 6: chapter 3.4, CORBA 2.3.1. spec; updated for local interfaces */
  public void forward_dcl() {
 /*@bgen(jjtree) forward_dcl */
  ASTforward_dcl jjtn000 = new ASTforward_dcl(this, IDLParserTreeConstants.JJTFORWARD_DCL);
  bool jjtc000 = true;
  jjtree.openNodeScope(jjtn000);String ident = "";
  System.Int32 ifType = IS_DEFAULT_IF;
    try {
      switch ((jj_ntk==-1)?jj_ntk_calc():jj_ntk) {
      case 17:
      case 18:
        ifType = interface_qualifier();
        break;
      default:
        jj_la1[7] = jj_gen;
        ;
        break;
      }
      jj_consume_token(16);
      ident = identifier();
    jjtree.closeNodeScope(jjtn000, true);
    jjtc000 = false;
    jjtn000.setIdent(ident);
    if (ifType == IS_ABSTRACT_IF) {
       jjtn000.setAbstract();
    }
    if (ifType == IS_LOCAL_IF) {
       jjtn000.setLocal();
    }
    Scope currentScope = m_symbolTable.getCurrentScope();
    currentScope.addFwdDecl(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(ASTforward_dcl, Object)
  * @param data the buildinfo of the scope, this type should be declared in
  */
 public Object visit(ASTforward_dcl node, Object data) {
     CheckParameterForBuildInfo(data, node);
     Scope enclosingScope = ((BuildInfo) data).GetBuildScope();
     // create only the type-builder, but don't call createType()
     Symbol forSymbol = enclosingScope.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; 
     }        
     if (!(m_typeManager.IsTypeDeclarded(forSymbol))) { // ignore fwd-decl if type is already declared, if not generate type for fwd decl
         // it's no problem to add later on interfaces this type should implement with AddInterfaceImplementation,
         // here: specify no interface inheritance, because not known at this point
         CreateOrGetInterfaceDcl(forSymbol, Type.EmptyTypes, 
                                 node.isAbstract(), node.isLocal(), true);
     }
     return null;
 }