public void CopyAll(Scope other, Scope getter)
        {
            other.IterateParents(scope =>
            {
                _methodGroups.AddRange(scope._methodGroups);
                return(true);
            });

            other.IterateElements(true, true, iterate =>
            {
                // Add the element.
                if (iterate.Element is IVariable variable)
                {
                    _variables.Add(variable);
                }

                if (iterate.Container.PrivateCatch || iterate.Container.CompletionCatch)
                {
                    return(ScopeIterateAction.StopAfterScope);
                }
                return(ScopeIterateAction.Continue);
            }, scope =>
            {
                // On empty scope.
                if (scope.PrivateCatch || scope.CompletionCatch)
                {
                    return(ScopeIterateAction.StopAfterScope);
                }
                return(ScopeIterateAction.Continue);
            });
        }
Exemplo n.º 2
0
        public static ICodeTypeInitializer[] TypesFromName(this Scope scope, string name)
        {
            var types = new List <ICodeTypeInitializer>();

            scope.IterateParents(scope => {
                types.AddRange(scope.Types.Where(t => t.Name == name));
                return(false);
            });
            return(types.ToArray());
        }
Exemplo n.º 3
0
        public void CopyAll(Scope other)
        {
            other.IterateParents(scope =>
            {
                _methods.AddRange(scope._methods);
                return(true);
            });

            other.IterateElements(true, true, iterate =>
            {
                // Add the element.
                if (iterate.Element is IVariableInstance variable && !_variables.Contains(variable))
                {
                    _variables.Add(variable);
                }

                if (iterate.Container.PrivateCatch || iterate.Container.CompletionCatch)
                {
                    return(ScopeIterateAction.StopAfterScope);
                }
                return(ScopeIterateAction.Continue);
            }, scope =>