Example #1
0
 /// <summary>
 /// Closes the scope, used at the end of adding items to the scope.
 /// </summary>
 /// <param name="scope">The outer scope, used to attach a fallback mechanism to each
 /// scope, optionally, by default not effective.</param>
 public override void CloseScope(IZincIdentScope scope = null)
 {
     base.CloseScope (scope);
     Dictionary<IZincIdent,IZincIdent> replace = new Dictionary<IZincIdent, IZincIdent> ();
     foreach (Tuple<IZincIdentScope,IZincIdent> matcher in ICompositionUtils.DoubleBlanket<IZincIdentScope,IZincElement> (this, StandardFunctions.AllPredicate<IZincElement> (), x => x is IZincIdent, StandardFunctions.AllPredicate<IZincIdentScope> ()).Cast<Tuple<IZincIdentScope,IZincIdent>> ()) {
         replace.Add (matcher.Item2, matcher.Item1.NameRegister.Lookup (matcher.Item2));
     }
     this.Replace (replace);
 }
Example #2
0
        /// <summary>
        /// Closes the scope, used at the end of adding items to the scope.
        /// </summary>
        /// <param name="scope">The outer scope, used to attach a fallback mechanism to each
        /// scope, optionally, by default not effective.</param>
        public override void CloseScope(IZincIdentScope scope = null)
        {
            base.CloseScope(scope);
            Dictionary <IZincIdent, IZincIdent> replace = new Dictionary <IZincIdent, IZincIdent> ();

            foreach (Tuple <IZincIdentScope, IZincIdent> matcher in ICompositionUtils.DoubleBlanket <IZincIdentScope, IZincElement> (this, StandardFunctions.AllPredicate <IZincElement> (), x => x is IZincIdent, StandardFunctions.AllPredicate <IZincIdentScope> ()).Cast <Tuple <IZincIdentScope, IZincIdent> > ())
            {
                replace.Add(matcher.Item2, matcher.Item1.NameRegister.Lookup(matcher.Item2));
            }
            this.Replace(replace);
        }
Example #3
0
 /// <summary>
 /// Closes the scope, used at the end of adding items to the scope.
 /// </summary>
 /// <param name="scope">The outer scope, used to attach a fallback mechanism to each
 /// scope.</param>
 /// <remarks>
 /// <para>When the scope closes, several operations are carried out: identifiers used in the scope
 /// that are defined in the scope as well are redirected to the assignment identifier.</para>
 /// </remarks>
 public virtual void CloseScope(IZincIdentScope scope)
 {
     this.nameRegister.Parent = scope.OrNull(x => x.NameRegister);
     foreach (IZincIdentDeclaration vardecl in ICompositionUtils.Blanket <IZincElement> (this, x => !(x is IZincScopeElement), x => x is IZincIdentDeclaration).Cast <IZincIdentDeclaration> ())
     {
         this.nameRegister.Register(vardecl.DeclaredIdentifier);
     }
     foreach (IZincScopeElement subScope in ICompositionUtils.TypeBlanket <IZincElement, IZincScopeElement> (this))
     {
         Console.WriteLine(subScope);
         Console.WriteLine(subScope == this);
         subScope.CloseScope(this);                 //close al underlying scopes (cascade)
     }
 }
 /// <summary>
 /// Closes the scope, used at the end of adding items to the scope.
 /// </summary>
 /// <param name="scope">The outer scope, used to attach a fallback mechanism to each
 /// scope.</param>
 /// <remarks>
 /// <para>When the scope closes, several operations are carried out: identifiers used in the scope
 /// that are defined in the scope as well are redirected to the assignment identifier.</para>
 /// </remarks>
 public virtual void CloseScope(IZincIdentScope scope)
 {
     this.nameRegister.Parent = scope.OrNull (x => x.NameRegister);
     foreach (IZincIdentDeclaration vardecl in ICompositionUtils.Blanket<IZincElement> (this, x => !(x is IZincScopeElement), x => x is IZincIdentDeclaration).Cast<IZincIdentDeclaration> ()) {
         this.nameRegister.Register (vardecl.DeclaredIdentifier);
     }
     foreach (IZincScopeElement subScope in ICompositionUtils.TypeBlanket<IZincElement,IZincScopeElement> (this)) {
         Console.WriteLine (subScope);
         Console.WriteLine (subScope == this);
         subScope.CloseScope (this);//close al underlying scopes (cascade)
     }
 }