Esempio n. 1
0
            // Get or set the value for a given type.
            public Object this[StackInfoType type]
            {
                get
                {
                    // search for the given type
                    StackInfo info = stack;
                    while (info != null)
                    {
                        if (info.type == type)
                        {
                            return(info.value);
                        }
                        info = info.next;
                    }
                    return(null);
                }
                set
                {
                    // check for the given type in the current scope
                    StackInfo info = stack;
                    while (info != null && info.type != StackInfoType.None)
                    {
                        if (info.type == type)
                        {
                            // update the value and return
                            info.value = value;
                            return;
                        }
                        info = info.next;
                    }

                    // add a new information block to the current scope
                    stack = new StackInfo(type, value, stack);
                }
            }
			// Construct a new scope boundary block.
			public StackInfo(StackInfo next)
					{
						this.type = StackInfoType.None;
						this.value = null;
						this.next = next;
					}
			// Construct a new stack information block.
			public StackInfo(StackInfoType type, Object value, StackInfo next)
					{
						this.type = type;
						this.value = value;
						this.next = next;
					}
		// Get or set the value for a given type.
		public Object this[StackInfoType type]
				{
					get
					{
						// search for the given type
						StackInfo info = stack;
						while(info != null)
						{
							if(info.type == type)
							{
								return info.value;
							}
							info = info.next;
						}
						return null;
					}
					set
					{
						// check for the given type in the current scope
						StackInfo info = stack;
						while(info != null && info.type != StackInfoType.None)
						{
							if(info.type == type)
							{
								// update the value and return
								info.value = value;
								return;
							}
							info = info.next;
						}

						// add a new information block to the current scope
						stack = new StackInfo(type, value, stack);
					}
				}
Esempio n. 5
0
 // Construct a new scope boundary block.
 public StackInfo(StackInfo next)
 {
     this.type  = StackInfoType.None;
     this.value = null;
     this.next  = next;
 }
Esempio n. 6
0
 // Construct a new stack information block.
 public StackInfo(StackInfoType type, Object value, StackInfo next)
 {
     this.type  = type;
     this.value = value;
     this.next  = next;
 }