Beispiel #1
0
 internal void SetAutomaticVariable(AutomaticVariable auto, object value, System.Management.Automation.ExecutionContext context)
 {
     if (context._debuggingMode > 0)
     {
         context.Debugger.CheckVariableWrite(SpecialVariables.AutomaticVariables[(int)auto]);
     }
     this.SetValue((int)auto, value);
 }
Beispiel #2
0
 internal void SetAutomaticVariable(AutomaticVariable auto, object value, ExecutionContext context)
 {
     if (context._debuggingMode > 0)
     {
         context.Debugger.CheckVariableWrite(SpecialVariables.AutomaticVariables[(int)auto]);
     }
     SetValue((int)auto, value);
 }
        internal object GetAutomaticVariableValue(AutomaticVariable variable)
        {
            int index = (int)variable;

            foreach (MutableTuple tuple in this._dottedScopes)
            {
                if (tuple.IsValueSet(index))
                {
                    return(tuple.GetValue(index));
                }
            }
            if ((this.LocalsTuple != null) && this.LocalsTuple.IsValueSet(index))
            {
                return(this.LocalsTuple.GetValue(index));
            }
            return(AutomationNull.Value);
        }
Beispiel #4
0
 internal object GetAutomaticVariableValue(AutomaticVariable variable)
 {
     int index = (int) variable;
     foreach (MutableTuple tuple in this._dottedScopes)
     {
         if (tuple.IsValueSet(index))
         {
             return tuple.GetValue(index);
         }
     }
     if ((this.LocalsTuple != null) && this.LocalsTuple.IsValueSet(index))
     {
         return this.LocalsTuple.GetValue(index);
     }
     return AutomationNull.Value;
 }
Beispiel #5
0
 internal object GetAutomaticVariable(AutomaticVariable auto)
 {
     return(this.GetValue((int)auto));
 }
Beispiel #6
0
 internal static void SetAutomaticVariable(AutomaticVariable variable, object value, MutableTuple locals)
 {
     locals.SetValue((int)variable, value);
 }
Beispiel #7
0
 internal object GetAutomaticVariable(AutomaticVariable auto)
 {
     return this.GetValue((int) auto);
 }
Beispiel #8
0
 internal object GetAutomaticVariableValue(AutomaticVariable variable)
 {
     SessionStateScopeEnumerator enumerator = new SessionStateScopeEnumerator(this.CurrentScope);
     object automaticVariableValue = AutomationNull.Value;
     foreach (SessionStateScope scope in (IEnumerable<SessionStateScope>) enumerator)
     {
         automaticVariableValue = scope.GetAutomaticVariableValue(variable);
         if (automaticVariableValue != AutomationNull.Value)
         {
             return automaticVariableValue;
         }
     }
     return automaticVariableValue;
 }
        } // GetVariableValueAtScope

        internal object GetAutomaticVariableValue(AutomaticVariable variable)
        {
            var scopeEnumerator = new SessionStateScopeEnumerator(CurrentScope);
            object result = AutomationNull.Value;
            foreach (var scope in scopeEnumerator)
            {
                result = scope.GetAutomaticVariableValue(variable);
                if (result != AutomationNull.Value)
                {
                    break;
                }
            }

            return result;
        }
Beispiel #10
0
        /// <summary>
        /// 
        /// </summary>
        /// <param name="variable"></param>
        /// <returns></returns>
        internal object GetAutomaticVariableValue(AutomaticVariable variable)
        {
            int index = (int)variable;
            foreach (var dottedScope in _dottedScopes)
            {
                if (dottedScope.IsValueSet(index))
                {
                    return dottedScope.GetValue(index);
                }
            }

            // LocalsTuple should not be null, but the test infrastructure creates scopes
            // and doesn't set LocalsTuple
            if (LocalsTuple != null && LocalsTuple.IsValueSet(index))
            {
                return LocalsTuple.GetValue(index);
            }

            return AutomationNull.Value;
        }