コード例 #1
0
        public override void ExitNamespace([NotNull] NamespaceContext context)
        {
            var identityName = context.qualified_identifier().identifier();

            for (int i = 1; i <= identityName.Length; i++)
            {
                currentScope = currentScope.GetEnclosingScope();
            }
        }
コード例 #2
0
        /// <summary>
        /// Define namespace scope
        /// </summary>
        /// <param name="context"></param>
        public override void EnterNamespace([NotNull] NamespaceContext context)
        {
            //create scope namespace
            var             identityList = context.qualified_identifier().identifier();
            NamespaceSymbol symbolScope  = null;

            foreach (var identity in identityList)
            {
                symbolScope = (NamespaceSymbol)currentScope.Resolve(identity.GetText());
                if (symbolScope == null)
                {
                    symbolScope = new NamespaceSymbol(identity.GetText());
                    symbolScope.SetEnclosingScope(currentScope);
                    Define(symbolScope);
                    linker[currentFileAnalysis].Add(symbolScope);
                }

                identity.Scope  = symbolScope;
                identity.Symbol = symbolScope;

                symbolScope.Linker = linker;
                currentScope       = symbolScope;
            }
        }