001    package AST;
002    
003    import java.util.HashSet;
004    import java.io.File;
005    import java.util.*;
006    import beaver.*;
007    import java.util.ArrayList;
008    import java.util.zip.*;
009    import java.io.*;
010    import java.io.FileNotFoundException;
011    import java.util.Collection;
012    /**
013      * @ast class
014     * 
015     */
016    public class InnerClassesAttribute extends Attribute {
017    
018        public InnerClassesAttribute(TypeDecl typeDecl) {
019          super(typeDecl.constantPool(), "InnerClasses");
020          ConstantPool c = typeDecl.constantPool();
021          Collection list = typeDecl.innerClassesAttributeEntries();
022          u2(list.size());
023          for(Iterator iter = list.iterator(); iter.hasNext(); ) {
024            TypeDecl type = (TypeDecl)iter.next();
025            u2(c.addClass(type.constantPoolName())); // inner_class_info_index
026            u2(type.isMemberType() ? c.addClass(type.enclosingType().constantPoolName()) : 0); // outer_class_info_index
027            u2(type.isAnonymous() ? 0 : c.addUtf8(type.name())); // inner_name_index
028            u2(type.isInterfaceDecl() ? (type.flags() | Modifiers.ACC_INTERFACE) : type.flags()); // inner_class_access_flags
029          }
030        }
031    
032    
033    }