Exemple #1
0
 // Any of the array parameters may be null
 public NamespaceDecl(
     Identifier idName, // must be non-null
     UsingDirective [] arUsingDirectives,
     NamespaceDecl[] arNestedNamespaces,
     ClassDecl[] arClasses,
     TypeDeclBase[] arTypes
 )
 {
     m_idName = idName;
 
     m_arUsingDirectives = (arUsingDirectives == null) ? new UsingDirective [0] : arUsingDirectives;
     m_arNestedNamespaces = (arNestedNamespaces == null) ? new NamespaceDecl[0] : arNestedNamespaces; 
     //m_arClasses = (arClasses == null) ? new ClassDecl[0] : arClasses;
     Debug.Assert(arClasses == null);
     
     m_arTypes = (arTypes == null) ? new TypeDeclBase[0] : arTypes;
 }
Exemple #2
0
 public DelegateDecl(
     Identifier      idName,
     TypeSig         tRetType,
     ParamVarDecl[]  arParams,        
     Modifiers       mods
 )
 {
     Debug.Assert(idName != null);
     Debug.Assert(tRetType != null);
     Debug.Assert(arParams != null);
             
     m_idName    = idName;
     m_tRetType  = tRetType;
     m_arParams  = arParams;
     m_mods      = mods;
     
     // Implied sealed
     m_mods.SetSealed();
 }    
Exemple #3
0
    // For non-interface types
    public ClassDecl(
        Identifier idName,         
        TypeSig [] arSuper, // super class & implemented interfaces
        MethodDecl [] alMethods,
        PropertyDecl[] alProperties,
        FieldDecl[] alFields,
        EventDecl [] alEvents,
        TypeDeclBase[] alNestedTypes,
        Modifiers mods,
        bool fIsClass // true for class, false for struct
    ) 
    {        
        Debug.Assert(idName != null);
        Debug.Assert(alMethods != null);
        Debug.Assert(alFields != null);
        Debug.Assert(alProperties != null);
        Debug.Assert(alEvents != null);


        m_strName = idName.Text;
        
        m_arSuper = (arSuper == null) ? new TypeSig[0] : arSuper;

        m_alNestedTypes     = (alNestedTypes == null) ?  m_sEmptyTypeList : alNestedTypes;
        m_alMethods         = alMethods;
        m_alProperties      = alProperties;
        m_alFields          = alFields;
        m_alEvents          = alEvents;
        
        // @todo - this is wrong
        m_filerange = idName.Location;

        if (!fIsClass) // structs are implicitly sealed.           
            mods.SetSealed();
            
        m_mods = mods;          
                    
        m_genre = fIsClass ? TypeEntry.Genre.cClass : TypeEntry.Genre.cStruct;
    }
Exemple #4
0
 public EventDecl(
     Identifier idName,
     NonRefTypeSig tType,
     Modifiers mods
 )
 {
     Debug.Assert(idName != null);
     Debug.Assert(tType != null);
     
     m_idName    = idName;
     m_tType     = tType;
     m_mods      = mods;    
 }              
Exemple #5
0
 public EnumDecl(Identifier idName, FieldDecl[] fields, Modifiers mods)
 {
     Debug.Assert(fields != null);
     m_fields = fields;
     m_idName = idName;
     m_mods = mods;
 }
Exemple #6
0
    // For interface types
    public ClassDecl(
        Identifier idName,         
        TypeSig [] arSuper, // super class & implemented interfaces
        MethodDecl [] alMethods,
        PropertyDecl[] alProperties,
        Modifiers mods    
    ) 
    {        
        Debug.Assert(idName != null);
        Debug.Assert(alMethods != null);
        

        m_strName = idName.Text;
        
        m_arSuper = (arSuper == null) ? new TypeSig[0] : arSuper;

        m_alMethods = alMethods;
        m_alProperties = alProperties;
        m_alNestedTypes = m_sEmptyTypeList;
        
        // @todo - this is wrong
        m_filerange = idName.Location;

        //m_mods.FlagSetter = mods.Flags | Modifiers.EFlags.Abstract;
        m_mods = mods;
        m_mods.SetAbstract();
       
        m_genre = TypeEntry.Genre.cInterface;
    }
Exemple #7
0
 public CatchHandler(
     TypeSig type,           // type we're catching (must derived from System.Exception)
     Identifier idName,       // optional (can be null) name for local var to store exception
     BlockStatement stmtBody // handler body (non-null)
 ) 
 {         
     Debug.Assert(stmtBody != null);
     
     // General catch blocks just becomes a System.Exception
     if (type == null)
     {        
         m_type = new SimpleTypeSig(new DotObjExp(
             new SimpleObjExp(new Identifier("System", null)),
             new Identifier("Exception", null)
             ));
     
         
     } else {     
         m_type = type;
     }
     m_idVarName = idName;
     m_body = stmtBody;
 }
Exemple #8
0
 public DotObjExp(Exp left, Identifier id)
 {
     m_left = left;
     m_strId = id;
     
     m_filerange = id.Location;
 }
Exemple #9
0
 public SimpleObjExp(string st)
 {
     m_filerange = null;
     m_strId = new Identifier(st, m_filerange);
 }
Exemple #10
0
 public SimpleObjExp(Identifier id)
 {
     m_filerange = id.Location;
     m_strId = id;
 }
Exemple #11
0
 public MethodCallExp(
     Exp e, // may be null,
     Identifier id,
     ArgExp [] arParams
 )
 {   
 // m_objExp may be null _until_ we resolve this. And then it's either
 // going to the implied 'this' ptr, a global func or a static func.
     m_objExp = e;
     m_idName = id;
     m_arParams = (arParams == null) ? new ArgExp[0] : arParams;
     
     
     // @todo - set in parser
     m_filerange = id.Location;        
 }