public void Out(TranslateRule context) { if (!IsInScope) { throw new Exception("ScopeGroup is already out of scope."); } IsInScope = false; foreach (IScopeable var in InScope) { if (var is IndexedVar) { ((IndexedVar)var).OutOfScope(context); VarCollection.Free((IndexedVar)var); } } for (int i = 0; i < Children.Count; i++) { if (Children[0].IsInScope) { throw new Exception(); } } }