Esempio n. 1
0
/* Production 15, chapter 3.4, CORBA 2.3.1 */
  public void value_box_decl() {
 /*@bgen(jjtree) value_box_decl */
  ASTvalue_box_decl jjtn000 = new ASTvalue_box_decl(this, IDLParserTreeConstants.JJTVALUE_BOX_DECL);
  bool jjtc000 = true;
  jjtree.openNodeScope(jjtn000);String ident = "";
    try {
      jj_consume_token(22);
      ident = identifier();
      type_spec();
      jj_consume_token(12);
      jjtree.closeNodeScope(jjtn000, true);
      jjtc000 = false;
        jjtn000.setIdent(ident);
        // the symbol must not be added before the valuebox definition is completed, 3.8.2, CORBA 2.3.1 spec
        Scope currentScope = m_symbolTable.getCurrentScope();
        currentScope.addSymbol(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_box_decl, Object)
     * @param data the current buildinfo
     */
    public Object visit(ASTvalue_box_decl node, Object data) {
        CheckParameterForBuildInfo(data, node);
        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;
        }
        
        Debug.WriteLine("begin boxed value type: " + node.getIdent());
        // get the boxed type
        TypeContainer boxedType = (TypeContainer)node.jjtGetChild(0).jjtAccept(this, data);
        if (boxedType == null) {
            throw new InvalidIdlException(
                String.Format("boxed type " + 
                              ((SimpleNode)node.jjtGetChild(0)).GetIdentification() +
                              " not (yet) defined for boxed value type " +
                              node.GetIdentification()));
        }
        boxedType = ReplaceByCustomMappedIfNeeded(boxedType);        

        // do use fusioned type + attributes on fusioned type for boxed value;
        m_typeManager.StartBoxedValueTypeDefinition(forSymbol, boxedType.GetCompactClsType(),
                                                    boxedType.GetCompactTypeAttrs());

        m_typeManager.EndTypeDefinition(forSymbol);
        return null;
    }