コード例 #1
0
/* Production 5: chapter 3.4, CORBA 2.3.1. spec */
  public void interface_dcl() {
 /*@bgen(jjtree) interface_dcl */
  ASTinterface_dcl jjtn000 = new ASTinterface_dcl(this, IDLParserTreeConstants.JJTINTERFACE_DCL);
  bool jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
    try {
      interface_header();
    // add the interface symbol, after the header is completed
    // get the header node
    ASTinterface_header header = (ASTinterface_header) jjtree.peekNode();
    Scope currentScope = m_symbolTable.getCurrentScope();
    currentScope.addSymbol(header.getIdent());
    Scope ifScope = m_symbolTable.openScope(header.getIdent(), true); // open a scope for type declaration inside the interface
    IList inheritedScopes = header.getInheritedScopeNames(); // list of ASTscoped_name nodes
    for (int i = 0; i <inheritedScopes.Count; i++) {
        ASTscoped_name inheritedScope = (ASTscoped_name)inheritedScopes[i];
        Scope inheritedResolved =
            m_symbolTable.ResolveScopedNameToScope((inheritedScope.hasFileScope() ? m_symbolTable.getTopScope() : currentScope),
                                                   inheritedScope.getNameParts());
        if (inheritedResolved != null) {
            ifScope.AddInheritedScope(inheritedResolved);
        }
    }
      jj_consume_token(14);
      interface_body();
      jj_consume_token(15);
     jjtree.closeNodeScope(jjtn000, true);
     jjtc000 = false;
        m_symbolTable.closeScope(); // close the scope for type declarations inside the interface

    } 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(ASTinterface_dcl, Object)
     * @param data expected is the buildinfo of the scope, this interface is declared in
     * @return the created type
     */
    public Object visit(ASTinterface_dcl node, Object data) {
        CheckParameterForBuildInfo(data, node);
        // data contains the scope, this interface is declared in
        Scope enclosingScope = ((BuildInfo) data).GetBuildScope();
        
        
        // an IDL concrete interface
        // get the header
        ASTinterface_header header = (ASTinterface_header)node.jjtGetChild(0);
        Symbol forSymbol = enclosingScope.getSymbol(header.getIdent());
        // check if a type declaration exists from a previous run / in ref assemblies
        if (m_typeManager.CheckSkip(forSymbol)) { 
            return null; 
        }

        // retrieve first types for the inherited
        System.Type[] interfaces = (System.Type[])header.jjtAccept(this, data);
        TypeBuilder interfaceToBuild = CreateOrGetInterfaceDcl(forSymbol, interfaces, 
                                                               header.isAbstract(), header.isLocal(),
                                                               false);

        // generate body
        ASTinterface_body body = (ASTinterface_body)node.jjtGetChild(1);
        BuildInfo buildInfo = new BuildInfo(enclosingScope.getChildScope(forSymbol.getSymbolName()),
                                            interfaceToBuild, forSymbol);
        body.jjtAccept(this, buildInfo);
    
        // create the type
        m_typeManager.EndTypeDefinition(forSymbol);
        return null;
    }