Beispiel #1
0
        private static BoundScope CreateParentScopes(BoundGlobalScope previous)
        {
            var stack = new Stack <BoundGlobalScope>();

            while (previous != null)
            {
                stack.Push(previous);
                previous = previous.Previous;
            }

            BoundScope parent = null;

            // submission 3-> submission 2 -> submission 1
            while (stack.Count > 0)
            {
                previous = stack.Pop();
                var scope = new BoundScope(parent);
                foreach (var v in previous.Variables)
                {
                    scope.TryDeclare(v);
                }

                parent = scope;
            }

            return(parent);
        }
Beispiel #2
0
 public Binder(BoundScope parent)
 {
     _scope = new BoundScope(parent);
 }
Beispiel #3
0
 public BoundScope(BoundScope parent)
 {
     Parent = parent;
 }