public void CopyAll(Scope other, Scope getter)
        {
            other.IterateElements(true, true, iterate => {
                // Add the element.
                if (iterate.Element is IVariable variable)
                {
                    Variables.Add(variable);
                }
                if (iterate.Element is IMethod method)
                {
                    Methods.Add(method);
                }

                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);
            });
        }
        public void CopyAll(Scope other, Scope getter)
        {
            other.IterateElements(getter, true, true, iterate => {
                if (iterate.Element is IVariable variable)
                {
                    Variables.Add(variable);
                }
                if (iterate.Element is IMethod method)
                {
                    Methods.Add(method);
                }

                if (iterate.Container.PrivateCatch)
                {
                    return(ScopeIterateAction.StopAfterScope);
                }
                return(ScopeIterateAction.Continue);
            });
        }
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 =>