mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
spelling: locals in src/System.Management.Automation/engine/runtime
This commit is contained in:
1 parent
aa929a00ce
commit
e9d4582aec
5 files changed
+27
-27
No files matched your search
@@ -336,7 +336,7 @@ namespace System.Management.Automation.Language
|
||||
#endif
|
||||
}
|
||||
|
||||
internal static class DynamicMetaObjectBinderExtentions
|
||||
internal static class DynamicMetaObjectBinderExtensions
|
||||
{
|
||||
internal static DynamicMetaObject DeferForPSObject(this DynamicMetaObjectBinder binder,
|
||||
params DynamicMetaObject[] args)
|
||||
@@ -1723,7 +1723,7 @@ namespace System.Management.Automation.Language
|
||||
argIndex += 1;
|
||||
}
|
||||
|
||||
// We wrap the block of assignements in a try/catch and issue a general error message whenever the assignment fails.
|
||||
// We wrap the block of assignments in a try/catch and issue a general error message whenever the assignment fails.
|
||||
var exception = Expression.Parameter(typeof(Exception));
|
||||
var block = Expression.Block(
|
||||
Expression.Assign(tmp, result),
|
||||
@@ -2483,7 +2483,7 @@ namespace System.Management.Automation.Language
|
||||
// tmp = Parser.ScanNumber(arg)
|
||||
// if (tmp == null) { throw new RuntimeError("BadNumericConstant") }
|
||||
// dynamic op target tmp
|
||||
// For equality comparision operators, if the conversion fails, we shouldn't raise
|
||||
// For equality comparison operators, if the conversion fails, we shouldn't raise
|
||||
// an exception, so those must be wrapped in try/catch, like:
|
||||
// try { /* as above */ }
|
||||
// catch (InvalidCastException) { true or false (depending on Operation type) }
|
||||
@@ -2520,7 +2520,7 @@ namespace System.Management.Automation.Language
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Use the tokenzier to scan a number and convert it to a number of any type.
|
||||
/// Use the tokenizer to scan a number and convert it to a number of any type.
|
||||
/// </summary>
|
||||
/// <param name="expr">
|
||||
/// The expression that refers to a string to be converted to a number of any type.
|
||||
@@ -2933,7 +2933,7 @@ namespace System.Management.Automation.Language
|
||||
|
||||
// Figure out the smallest type necessary so we don't lose information.
|
||||
// For uint, V2 promoted to long, but it's more correct to use uint.
|
||||
// For ulong, V2 incorreclty used long, this is fixed here.
|
||||
// For ulong, V2 incorrectly used long, this is fixed here.
|
||||
// For float, double, and decimal operands, we used to use long because V2 did.
|
||||
// Because we use unsigned for -bnot, to be consistent, we promote to unsigned here too (-band,-bor,-xor)
|
||||
opType = GetBitwiseOpType((int)leftTypeCode >= (int)rightTypeCode ? leftTypeCode : rightTypeCode);
|
||||
@@ -3120,7 +3120,7 @@ namespace System.Management.Automation.Language
|
||||
}
|
||||
|
||||
return BinaryComparisonCommon(enumerable, target, arg)
|
||||
?? BinaryComparision(target, arg, e => Expression.LessThan(e, ExpressionCache.Constant(0)));
|
||||
?? BinaryComparison(target, arg, e => Expression.LessThan(e, ExpressionCache.Constant(0)));
|
||||
}
|
||||
|
||||
private DynamicMetaObject CompareLE(DynamicMetaObject target,
|
||||
@@ -3140,7 +3140,7 @@ namespace System.Management.Automation.Language
|
||||
}
|
||||
|
||||
return BinaryComparisonCommon(enumerable, target, arg)
|
||||
?? BinaryComparision(target, arg, e => Expression.LessThanOrEqual(e, ExpressionCache.Constant(0)));
|
||||
?? BinaryComparison(target, arg, e => Expression.LessThanOrEqual(e, ExpressionCache.Constant(0)));
|
||||
}
|
||||
|
||||
private DynamicMetaObject CompareGT(DynamicMetaObject target,
|
||||
@@ -3162,7 +3162,7 @@ namespace System.Management.Automation.Language
|
||||
}
|
||||
|
||||
return BinaryComparisonCommon(enumerable, target, arg)
|
||||
?? BinaryComparision(target, arg, e => Expression.GreaterThan(e, ExpressionCache.Constant(0)));
|
||||
?? BinaryComparison(target, arg, e => Expression.GreaterThan(e, ExpressionCache.Constant(0)));
|
||||
}
|
||||
|
||||
private DynamicMetaObject CompareGE(DynamicMetaObject target,
|
||||
@@ -3184,10 +3184,10 @@ namespace System.Management.Automation.Language
|
||||
}
|
||||
|
||||
return BinaryComparisonCommon(enumerable, target, arg)
|
||||
?? BinaryComparision(target, arg, e => Expression.GreaterThanOrEqual(e, ExpressionCache.Constant(0)));
|
||||
?? BinaryComparison(target, arg, e => Expression.GreaterThanOrEqual(e, ExpressionCache.Constant(0)));
|
||||
}
|
||||
|
||||
private DynamicMetaObject BinaryComparision(DynamicMetaObject target, DynamicMetaObject arg, Func<Expression, Expression> toResult)
|
||||
private DynamicMetaObject BinaryComparison(DynamicMetaObject target, DynamicMetaObject arg, Func<Expression, Expression> toResult)
|
||||
{
|
||||
if (target.LimitType == typeof(string))
|
||||
{
|
||||
@@ -5821,7 +5821,7 @@ namespace System.Management.Automation.Language
|
||||
}
|
||||
Expression transformedExpression = originalExpression.Convert(typeof(object));
|
||||
var engineIntrinsicsTempVar = Expression.Variable(typeof(EngineIntrinsics));
|
||||
// apply tranformation attributes from right to left
|
||||
// apply transformation attributes from right to left
|
||||
for (int i = attributesArray.Length - 1; i >= 0; i--)
|
||||
{
|
||||
transformedExpression = Expression.Call(Expression.Constant(attributesArray[i]),
|
||||
@@ -6648,7 +6648,7 @@ namespace System.Management.Automation.Language
|
||||
|
||||
// If we're calling SteppablePipeline.{Begin|Process|End}, we don't want
|
||||
// to wrap exceptions - this is very much a special case to help error
|
||||
// propogation and ensure errors are attributed to the correct code (the
|
||||
// propagation and ensure errors are attributed to the correct code (the
|
||||
// cmdlet invoked, not the method call from some proxy.)
|
||||
if (methodInfo.DeclaringType == typeof(SteppablePipeline)
|
||||
&& (methodInfo.Name.Equals("Begin", StringComparison.Ordinal))
|
||||
@@ -6911,7 +6911,7 @@ namespace System.Management.Automation.Language
|
||||
/// <param name="target">The target to operate against</param>
|
||||
/// <param name="args">
|
||||
/// Arguments to the operator. The first argument must be either a scriptblock
|
||||
/// or a string representing a 'simple where' expresson. The second is an enum that controls
|
||||
/// or a string representing a 'simple where' expression. The second is an enum that controls
|
||||
/// the matching behaviour returning the first, last or all matching elements.
|
||||
/// </param>
|
||||
/// <param name="argRestrictions">The binding restrictions for the arguments.</param>
|
||||
|
||||
@@ -259,7 +259,7 @@ namespace System.Management.Automation
|
||||
private bool _usesCmdletBinding;
|
||||
private bool _compiledOptimized;
|
||||
private bool _compiledUnoptimized;
|
||||
private bool _hasSuspicousContent;
|
||||
private bool _hasSuspiciousContent;
|
||||
internal bool DebuggerHidden { get; set; }
|
||||
internal bool DebuggerStepThrough { get; set; }
|
||||
internal Guid Id { get; private set; }
|
||||
@@ -281,9 +281,9 @@ namespace System.Management.Automation
|
||||
get
|
||||
{
|
||||
Diagnostics.Assert(_compiledOptimized || _compiledUnoptimized, "HasSuspiciousContent is not set correctly before being compiled");
|
||||
return _hasSuspicousContent;
|
||||
return _hasSuspiciousContent;
|
||||
}
|
||||
set { _hasSuspicousContent = value; }
|
||||
set { _hasSuspiciousContent = value; }
|
||||
}
|
||||
|
||||
private MergedCommandParameterMetadata _parameterMetadata;
|
||||
@@ -1011,7 +1011,7 @@ namespace System.Management.Automation
|
||||
context.LanguageMode = newLanguageMode.Value;
|
||||
}
|
||||
|
||||
args = BindArgumentsForScripblockInvoke(
|
||||
args = BindArgumentsForScriptblockInvoke(
|
||||
(RuntimeDefinedParameter[])RuntimeDefinedParameters.Data,
|
||||
args, context, !createLocalScope, backupWhenDotting, locals);
|
||||
locals.SetAutomaticVariable(AutomaticVariable.Args, args, context);
|
||||
@@ -1106,7 +1106,7 @@ namespace System.Management.Automation
|
||||
return locals;
|
||||
}
|
||||
|
||||
internal static object[] BindArgumentsForScripblockInvoke(
|
||||
internal static object[] BindArgumentsForScriptblockInvoke(
|
||||
RuntimeDefinedParameter[] parameters,
|
||||
object[] args,
|
||||
ExecutionContext context,
|
||||
@@ -1415,7 +1415,7 @@ namespace System.Management.Automation
|
||||
// We only do this once, as the error will always be the same for a given certificate.
|
||||
if (error != null)
|
||||
{
|
||||
// If we got an error resoving the encryption certificate, log a warning and continue
|
||||
// If we got an error resolving the encryption certificate, log a warning and continue
|
||||
// logging the (unencrypted) message anyways. Logging trumps protected logging -
|
||||
// being able to detect that an attacker has compromised a box outweighs the danger of the
|
||||
// attacker seeing potentially sensitive data. Because if they aren't detected, then
|
||||
|
||||
@@ -13,7 +13,7 @@ using System.Management.Automation.Language;
|
||||
using System.Threading;
|
||||
|
||||
// These APIs are not part of the public contract.
|
||||
// They are implementation details and intendent to be called from generated assemlbies for PS classes.
|
||||
// They are implementation details and intended to be called from generated assemblies for PS classes.
|
||||
//
|
||||
// Because they are called from other assemblies, we have to make them public.
|
||||
// We put them in Internal namespace to emphasise that despite the fact that they are public, it's not part of API contract.
|
||||
@@ -27,7 +27,7 @@ namespace System.Management.Automation.Internal
|
||||
/// In the former case, module can be imported from the different runspaces in the same process.
|
||||
/// And so runspaces will share RuntimeType. But in every runspace, Type is associated with just one SessionState.
|
||||
/// We want type methods to be able access $script: variables and module-specific methods.
|
||||
/// To achive it, we preserve reference to SessionState that creates type in the private field 'SessionStateFieldName'.
|
||||
/// To achieve it, we preserve reference to SessionState that creates type in the private field 'SessionStateFieldName'.
|
||||
/// Later, we use it to call scriptBlocks captured in ScriptBlockMemberMethodWrapper with the right sessionState.
|
||||
/// </summary>
|
||||
public class SessionStateKeeper
|
||||
|
||||
@@ -520,7 +520,7 @@ namespace System.Management.Automation
|
||||
var locals = MutableTuple.MakeTuple(Compiler.DottedLocalsTupleType,
|
||||
Compiler.DottedLocalsNameIndexMap);
|
||||
object[] remainingArgs =
|
||||
ScriptBlock.BindArgumentsForScripblockInvoke(
|
||||
ScriptBlock.BindArgumentsForScriptblockInvoke(
|
||||
(RuntimeDefinedParameter[])scriptBlock.RuntimeDefinedParameters.Data,
|
||||
args, context, false, null, locals);
|
||||
locals.SetAutomaticVariable(AutomaticVariable.Args, remainingArgs, context);
|
||||
@@ -576,7 +576,7 @@ namespace System.Management.Automation
|
||||
|
||||
// For nicer error reporting, we want to make it look like errors in the steppable pipeline point back to
|
||||
// the caller of the proxy. We don't want errors pointing to the script block created in the proxy.
|
||||
// Here we assume (in a safe way) that GetSteppablePipline is called from script. If that isn't the case,
|
||||
// Here we assume (in a safe way) that GetSteppablePipeline is called from script. If that isn't the case,
|
||||
// we won't crash, but the error reporting might be a little misleading.
|
||||
var callStack = context.Debugger.GetCallStack().ToArray();
|
||||
if (callStack.Length > 0 && Regex.IsMatch(callStack[0].Position.Text, "GetSteppablePipeline", RegexOptions.IgnoreCase))
|
||||
@@ -1538,7 +1538,7 @@ namespace System.Management.Automation
|
||||
/// <param name="context">The execution context</param>
|
||||
/// <returns>The preference the user selected</returns>
|
||||
/// <remarks>
|
||||
/// Error action is decided by error action preference. If preferenc is inquire, we will
|
||||
/// Error action is decided by error action preference. If preference is inquire, we will
|
||||
/// prompt user for their preference.
|
||||
/// </remarks>
|
||||
internal static ActionPreference QueryForAction(RuntimeException rte, string message, ExecutionContext context)
|
||||
@@ -2488,8 +2488,8 @@ namespace System.Management.Automation
|
||||
var context = Runspace.DefaultRunspace.ExecutionContext;
|
||||
|
||||
// If expression argument is a .Net type then convert the collection to that type
|
||||
// if the target type is a collecton or array, then the result will be a collection of exactly
|
||||
// that type. If the target type is not a collectiom type then return a generic collection of that type.
|
||||
// if the target type is a collection or array, then the result will be a collection of exactly
|
||||
// that type. If the target type is not a collection type then return a generic collection of that type.
|
||||
Type targetType = expression as Type;
|
||||
if (targetType != null)
|
||||
{
|
||||
|
||||
@@ -288,7 +288,7 @@ namespace System.Management.Automation
|
||||
var parameters = functionParameters != null
|
||||
? Compiler.GetParameterMetaData(functionParameters, true, ref usesCmdletBinding)
|
||||
: ((IParameterMetadataProvider)body).GetParameterMetadata(true, ref usesCmdletBinding);
|
||||
object[] remainingArgs = ScriptBlock.BindArgumentsForScripblockInvoke(
|
||||
object[] remainingArgs = ScriptBlock.BindArgumentsForScriptblockInvoke(
|
||||
(RuntimeDefinedParameter[])parameters.Data, args, context, false, null, locals);
|
||||
locals.SetAutomaticVariable(AutomaticVariable.Args, remainingArgs, context);
|
||||
newScope.LocalsTuple = locals;
|
||||
|
||||
Reference in new issue
Block a user