/* Production 43, chapter 3.4, corba 2.3.1 */ public void type_declarator() { /*@bgen(jjtree) type_declarator */ ASTtype_declarator jjtn000 = new ASTtype_declarator(this, IDLParserTreeConstants.JJTTYPE_DECLARATOR); bool jjtc000 = true; jjtree.openNodeScope(jjtn000); try { type_spec(); declarators(); jjtree.closeNodeScope(jjtn000, true); jjtc000 = false; Node declaratorNodes = jjtn000.jjtGetChild(1); Scope currentScope = m_symbolTable.getCurrentScope(); for (int i = 0; i < declaratorNodes.jjtGetNumChildren(); i++) { ASTdeclarator decl = (ASTdeclarator) declaratorNodes.jjtGetChild(i); if (decl.jjtGetChild(0) is ASTsimple_declarator) { String ident = ((SimpleNodeWithIdent) decl.jjtGetChild(0)).getIdent(); currentScope.addTypeDef(ident); } else if (decl.jjtGetChild(0) is ASTcomplex_declarator) { /* complex_declarator contains an array_declarator */ String ident = ((SimpleNodeWithIdent) decl.jjtGetChild(0).jjtGetChild(0)).getIdent(); currentScope.addTypeDef(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(ASTtype_declarator, Object) * @param data expected is an instance of BuildInfo */ public Object visit(ASTtype_declarator node, Object data) { CheckParameterForBuildInfo(data, node); Scope currentScope = ((BuildInfo) data).GetBuildScope(); TypeContainer typeUsedInDefine = (TypeContainer) node.jjtGetChild(0).jjtAccept(this, data); Node declarators = node.jjtGetChild(1); for (int i = 0; i < declarators.jjtGetNumChildren(); i++) { ASTdeclarator decl = (ASTdeclarator) declarators.jjtGetChild(i); if (decl.jjtGetChild(0) is ASTcomplex_declarator) { // check for custom mapping, because will become element type of array typeUsedInDefine = ReplaceByCustomMappedIfNeeded(typeUsedInDefine); } string ident = DetermineTypeAndNameForDeclarator(decl, data, ref typeUsedInDefine); Symbol typedefSymbol = currentScope.getSymbol(ident); // inform the type-manager of this typedef Debug.WriteLine("typedef defined here, type: " + typeUsedInDefine.GetCompactClsType() + ", symbol: " + typedefSymbol); m_typeManager.RegisterTypeDef(typeUsedInDefine, typedefSymbol); } return null; }