示例#1
0
文件: Scope.cs 项目: odalet/slang
        public bool TryLookupLabel(string name, out LabelSymbol label)
        {
            label = null;
            // We only search for labels inside the current function
            var scope = this;
            var key   = SymbolKey.FromLabel(name);

            while (true)
            {
                if (TryLookupSymbol(scope, key, out label, _ => false))
                {
                    return(true);
                }

                if (scope.Kind == ScopeKind.Function) // Not found in this function
                {
                    return(false);
                }

                scope = scope.Parent;
            }
        }