当前位置: 首页>>代码示例>>C#>>正文


C# ISemanticResolver.GetCurrentScope方法代码示例

本文整理汇总了C#中ISemanticResolver.GetCurrentScope方法的典型用法代码示例。如果您正苦于以下问题:C# ISemanticResolver.GetCurrentScope方法的具体用法?C# ISemanticResolver.GetCurrentScope怎么用?C# ISemanticResolver.GetCurrentScope使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISemanticResolver的用法示例。


在下文中一共展示了ISemanticResolver.GetCurrentScope方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ResolveNamespace

    // Before we can process the classes, we need to add all the namespaces
    public void ResolveNamespace(
        string stParentNamespace, 
        ISemanticResolver s,
        Scope scopeParent)
    {
        Debug.Assert(m_symbol == null);
        
        // We can have one namespaces spread across multiple blocks (NamespaceDecl).
        // All blocks share the same scope (something defined in any block is visible
        // to all blocks), but each block can have its own lexical parent & set
        // of using clause. 
#if true
        m_symbol = (UserNamespaceEntry) scopeParent.LookupSymbolInThisScopeOnly(Name);
        if (m_symbol == null)
        {
            // Create new namespace
            string stFullName;
            if (stParentNamespace == "")
                stFullName = this.Name;
            else 
                stFullName = stParentNamespace + "." + this.Name;

            m_symbol = new UserNamespaceEntry(this, stFullName);
            scopeParent.AddSymbol(m_symbol);                        
        }
        
        // The symbol has the scope with all the data. But each namespace decl creates
        // a proxy scope that links to the symbol's data (Because all blocks share that)
        // but has a tie to its own set of using clauses & lexical parent.
        m_context = m_symbol.ChildScope.CreateSharedScope(this, scopeParent);
        
        foreach(NamespaceDecl n in NestedNamespaces)
            n.ResolveNamespace(m_symbol.FullName, s, m_context);
#else        
        
        // Since we can have multiple disjoint namespace decls refer
        // to the same namespace, we have to check and see if this
        // symbol is already created.        
        m_symbol = (UserNamespaceEntry) s.GetCurrentScope().LookupSymbolInThisScopeOnly(Name);
        if (m_symbol == null) 
        {
            string stFullName;
            if (stParentNamespace == "")
                stFullName = this.Name;
            else 
                stFullName = stParentNamespace + "." + this.Name;

            m_symbol = new UserNamespaceEntry(this, stFullName);        
            s.GetCurrentScope().AddSymbol(m_symbol);
        }
        
        
        EnterNamespace(s);
        
        foreach(NamespaceDecl n in NestedNamespaces)
            n.ResolveNamespace(m_symbol.FullName, s, scopeParent);
            
        
        ExitNamespace(s);
#endif        
    }
开发者ID:chenzuo,项目名称:blue,代码行数:62,代码来源:AST.cs


注:本文中的ISemanticResolver.GetCurrentScope方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。