本文整理汇总了C#中LocalSymbol.AsReadOnlyWrap方法的典型用法代码示例。如果您正苦于以下问题:C# LocalSymbol.AsReadOnlyWrap方法的具体用法?C# LocalSymbol.AsReadOnlyWrap怎么用?C# LocalSymbol.AsReadOnlyWrap使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类LocalSymbol
的用法示例。
在下文中一共展示了LocalSymbol.AsReadOnlyWrap方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RewriteArguments
//.........这里部分代码省略.........
{
refKinds.Add(RefKind.None);
}
}
ArrayBuilder<BoundAssignmentOperator> storesToTemps = null;
ArrayBuilder<BoundExpression> paramArray = null;
if (expanded)
{
paramArray = ArrayBuilder<BoundExpression>.GetInstance();
}
for (int a = 0; a < rewrittenArguments.Count; ++a)
{
var argument = rewrittenArguments[a];
var p = (argsToParamsOpt.IsNotNull) ? argsToParamsOpt[a] : a;
var refKind = argumentRefKinds.RefKinds(a);
Debug.Assert(arguments[p] == null);
if (expanded && p == parameterCount - 1)
{
paramArray.Add(argument);
Debug.Assert(refKind == RefKind.None);
}
else if (IsSafeForReordering(argument, refKind))
{
arguments[p] = argument;
if (refKinds != null)
{
refKinds[p] = refKind;
}
}
else
{
if (storesToTemps == null)
{
storesToTemps = ArrayBuilder<BoundAssignmentOperator>.GetInstance(rewrittenArguments.Count);
}
var tempStore = TempHelpers.StoreToTemp(argument, refKind, containingSymbol);
storesToTemps.Add(tempStore.Item1);
arguments[p] = tempStore.Item2;
}
}
if (expanded)
{
var paramArrayType = parameters[parameterCount - 1].Type;
var arrayArgs = paramArray.ToReadOnlyAndFree();
var int32Type = method.ContainingAssembly.GetPrimitiveType(Microsoft.Cci.PrimitiveTypeCode.Int32);
arguments[parameterCount - 1] = new BoundArrayCreation(
null,
null,
ReadOnlyArray.Singleton<BoundExpression>(
new BoundLiteral(null, null, ConstantValue.Create(arrayArgs.Count), int32Type)),
new BoundArrayInitialization(null, null, arrayArgs),
paramArrayType);
}
for (int p = 0; p < parameterCount; ++p)
{
if (arguments[p] == null)
{
Debug.Assert(parameters[p].IsOptional);
// UNDONE: Add optional arguments.
}
}
if (storesToTemps != null)
{
int tempsNeeded = MergeArgumentsAndSideEffects(storesToTemps, arguments);
if (tempsNeeded > 0)
{
var temps = new LocalSymbol[tempsNeeded];
for (int i = 0, j = 0; i < storesToTemps.Count; i++)
{
var s = storesToTemps[i];
if (s != null)
{
temps[j++] = ((BoundLocal)s.Left).LocalSymbol;
}
}
temporaries = temps.AsReadOnlyWrap();
}
storesToTemps.Free();
}
// * The rewritten list of names is now null because the arguments have been reordered.
// * The args-to-params map is now null because every argument exactly matches its parameter.
// * The call is no longer in its expanded form.
argumentRefKinds = refKinds == null ? ReadOnlyArray<RefKind>.Null : refKinds.AsReadOnly<RefKind>();
rewrittenArguments = arguments.AsReadOnlyWrap();
}