Exemplo n.º 1
0
/* Production 14, chapter 3.4, CORBA 2.3.1 */
  public void value_forward_decl() {
 /*@bgen(jjtree) value_forward_decl */
  ASTvalue_forward_decl jjtn000 = new ASTvalue_forward_decl(this, IDLParserTreeConstants.JJTVALUE_FORWARD_DECL);
  bool jjtc000 = true;
  jjtree.openNodeScope(jjtn000);String ident = "";
  bool isAbstract = false;
    try {
      switch ((jj_ntk==-1)?jj_ntk_calc():jj_ntk) {
      case 17:
        jj_consume_token(17);
                  isAbstract = true;
        break;
      default:
        jj_la1[16] = jj_gen;
        ;
        break;
      }
      jj_consume_token(22);
      ident = identifier();
      jj_consume_token(12);
      jjtree.closeNodeScope(jjtn000, true);
      jjtc000 = false;
      jjtn000.setIdent(ident);
      jjtn000.setAbstract(isAbstract);
      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(ASTvalue_forward_decl, Object)
  * @param data the buildinfo of the container
  */
 public Object visit(ASTvalue_forward_decl node, Object data) {
     CheckParameterForBuildInfo(data, node);
     // is possible to do with reflection emit, because interface and class inheritance can be specified later on with setParent() and AddInterfaceImplementation()
     Scope enclosingScope = ((BuildInfo) data).GetBuildScope();
     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; 
     }
     
     // create only the type-builder, but don't call createType()
     if (!(m_typeManager.IsTypeDeclarded(forSymbol))) { // if the full type declaration already exists, ignore fwd decl
         // it's no problem to add later on interfaces this type should implement and the base class this type should inherit from with AddInterfaceImplementation / set parent
         // here: specify no inheritance, because not known at this point
         CreateOrGetValueDcl(forSymbol, null, Type.EmptyTypes, 
                             node.isAbstract(), true);
     }
     return null;
 }