Пример #1
0
 // Resolve the members (fields & methods)
 public override void ResolveMemberDecls(
     ISemanticResolver s,
     ICLRtypeProvider provider
 )
 {   
     // If we've already been resolved, then skip
     if (this.Symbol.MemberScope.IsLocked)
         return;
         
     // We need our base types to have resolved members so that we can 
     // do inheritence checks.            
     FixBaseMemberDecls(s, provider);    
     
     // Setup our context to do evaluation
     Scope prev = s.SetCurrentContext(m_symbol.MemberScope);
     s.SetCurrentClass(m_symbol);            
             
     // Add our members to our scope
     {
         // Do events first because they generate methods & fields
         FixEvents(s, provider);
     
         if (!IsInterface)
             this.FixFields(s, provider);
         
         // Resolve properties before methods, since properties create methods
         foreach(PropertyDecl p in m_alProperties)
         {
             p.ResolveMember(m_symbol, s, provider);                            
         }
         
         // This can change both the normal methods as well as accessor methods on properties.
         FixMethods(s, provider);
         
         // Set property symbols after we've touched up the methods.
         foreach(PropertyDecl p in m_alProperties)
         {
             p.Symbol.SetInfo(provider);
         }
         
         PostFixEvents(s, provider);
               
         // Nested types
         foreach(TypeDeclBase t in this.m_alNestedTypes)
         {
             t.ResolveMemberDecls(s, provider);        
         }              
                
                 
         // If we have no ctor at all, then add a default one.
         // (default ctor - takes no parameters, chains to base's default ctor)
         if (!IsInterface)
             FixCtors(s, provider);
         
         // We're done adding to the scope, so lock it.
         m_symbol.MemberScope.LockScope();
     }
     
     s.SetCurrentClass(null);        
     s.RestoreContext(prev);
 }
Пример #2
0
// Resolve the bodies of methods
    public override void ResolveBodies(ISemanticResolver s)
    {
        Scope scope = m_symbol.MemberScope;
        
        //s.PushScope(scope);
        Scope prev = s.SetCurrentContext(scope);
        s.SetCurrentClass(m_symbol);
         
        foreach(MethodDecl m in m_alMethods)
        {
            m.ResolveBodies(s);
        }
        
        foreach(PropertyDecl p in m_alProperties)
        {
            p.ResolveBodies(s);
        }
        
        // Nested
        foreach(TypeDeclBase t in this.m_alNestedTypes)
        {
            t.ResolveBodies(s);
        }
        
        s.SetCurrentClass(null);
        //s.PopScope(scope);
        s.RestoreContext(prev);
    }
Пример #3
0
    // Semantic checking
    // Stubs can be resolved in any order.
    public override void ResolveTypesAsBlueStub(
        ISemanticResolver s,
        string stNamespace,
        Scope scopeParent
        )
    {
        // Get our name. Nested classes are separated with a '+'
        // Namespaces are separated with a '.'
        string stFullName = (stNamespace == "") ? 
            (m_strName) :
            (stNamespace + "." + m_strName);

        // Are we a nested class? 
        if (scopeParent.Node is ClassDecl)
        {
            Debug.Assert(stNamespace != "");
            stFullName = stNamespace + "+" + m_strName;
        }                    

        // Create a stub sym entry to add to current scope
        m_symbol = new TypeEntry(stFullName, this, m_genre, scopeParent);
        scopeParent.AddSymbol(m_symbol);
        
        // Stub on nested types
        //s.PushScope(m_symbol.MemberScope);
        
        // Our context is the same as the scope on our symbol
        Scope context = m_symbol.MemberScope;
        Debug.Assert(context != null);
        
        s.SetCurrentClass(m_symbol);
                    
        foreach(TypeDeclBase t in this.m_alNestedTypes)
        {   
            t.ResolveTypesAsBlueStub(s, stFullName, context);
        }
        
        s.SetCurrentClass(null);
        //s.PopScope(m_symbol.MemberScope);
    }