private void GetSplattedVariable(VariableExpressionAst variableAst) { if (_context == null) { throw new PSInvalidOperationException(AutomationExceptions.CantConvertScriptBlockWithNoContext); } // Process the contents of a splatted variable into the arguments for this // command. If the variable contains a hashtable, distribute the key/value pairs // If it's an enumerable, then distribute the values as $args and finally // if it's a scalar, then the effect is equivalent to $var object splattedValue = _context.GetVariableValue(variableAst.VariablePath); foreach (var splattedParameter in PipelineOps.Splat(splattedValue, variableAst)) { CommandParameter publicParameter = CommandParameter.FromCommandParameterInternal(splattedParameter); _powershell.AddParameter(publicParameter.Name, publicParameter.Value); } }