Exemple #1
0
        /* Override this method if you want to customize how the node dumps
         * out its children. */

        public void dump(String prefix)
        {
            Console.WriteLine(ToString(prefix));
            if (children != null)
            {
                for (int i = 0; i < children.Length; ++i)
                {
                    SimpleNode n = (SimpleNode)children[i];
                    if (n != null)
                    {
                        n.dump(prefix + " ");
                    }
                }
            }
        }
 /// <summary>
 /// <see cref="parser.IDLParserVisitor.visit(SimpleNode, Object)"/>
 /// </summary>
 public Object visit(SimpleNode node, Object data) {
     return null; // not needed
 }
 /// <summary> 
 /// get the types for the scoped names specified in an inheritance relationship
 /// </summary>
 /// <param name="data">the buildinfo of the container of the type having this inheritance relationship</param>    
 private Type[] ParseInheritanceRelation(SimpleNode node, BuildInfo data) {        
     ArrayList result = new ArrayList();
     for (int i = 0; i < node.jjtGetNumChildren(); i++) {
         // get symbol
         Symbol sym = (Symbol)(node.jjtGetChild(i).jjtAccept(this, data)); // accept interface_name
         if (sym.getDeclaredIn().GetFullyQualifiedNameForSymbol(sym.getSymbolName()).Equals("java.io.Serializable")) {
             Console.WriteLine("ignoring inheritance from java.io.Serializable, because not allowed");                
             continue;
         }
         // get Type
         TypeContainer resultType = m_typeManager.GetKnownType(sym);
         if (resultType == null) {
             // this is an error: type must be created before it is inherited from
             throw new InvalidIdlException("type " + sym.getSymbolName() +
                                           " not seen before in inheritance spec");
         } else if (m_typeManager.IsFwdDeclared(sym)) {
             // this is an error: can't inherit from a fwd declared type
             throw new InvalidIdlException("type " + sym.getSymbolName() + 
                                           " only fwd declared, but for inheritance full definition is needed");
         }
         result.Add(resultType.GetCompactClsType());
     }
     return (System.Type[])result.ToArray(typeof(Type));
 }
 /// <summary>
 /// Adds ASTmember to the type in construction. MemberParent is the node containing ASTmember nodes.
 /// </summary>
 private IList /* FieldBuilder */ GenerateMemberList(SimpleNode memberParent, Object data) {
     ArrayList result = new ArrayList();
     for (int i = 0; i < memberParent.jjtGetNumChildren(); i++) {
         IList infos = 
             (IList)memberParent.jjtGetChild(i).jjtAccept(this, data);
         result.AddRange(infos);
     }        
     return result;
 }
 /** resovle a param_type_spec or a simple_type_spec or other type specs which may return a symbol or a typecontainer
  *  @param node the child node of the type_spec node containing the spec data
  *  @param currentInfo the buildinfo for the scope, this type is specified in
  *  @return a TypeContainer for the represented type
  */
 private TypeContainer ResovleTypeSpec(SimpleNode node, BuildInfo currentInfo) {    
     Object result = node.jjtAccept(this, currentInfo);
     TypeContainer resultingType = null;
     if (result is Symbol) { // case <scoped_name>
         // get type for symbol
         resultingType = m_typeManager.GetKnownType((Symbol)result);
     } else { // other cases
         resultingType = (TypeContainer) result;
     }
     return resultingType;
 }