本文整理汇总了C#中mdr.SetExpectedArgsCount方法的典型用法代码示例。如果您正苦于以下问题:C# mdr.SetExpectedArgsCount方法的具体用法?C# mdr.SetExpectedArgsCount怎么用?C# mdr.SetExpectedArgsCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mdr
的用法示例。
在下文中一共展示了mdr.SetExpectedArgsCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DeclareParameterSymbols
private void DeclareParameterSymbols(ref mdr.CallFrame callFrame)
{
var parameters = _currFuncMetadata.FunctionIR.Parameters;
//Extend missing arguments
callFrame.SetExpectedArgsCount(parameters.Count);
if (_currScope.HasArgumentsSymbol)
{
///In this case, we already read/write from the arguments.Elements[i] for the symbol.
///however, we should always refer to the arguments variable itself since its .Elements
///may be resized and changed
///we cannot rely on the argument symbol's variable for this since the progremmer
///may write the arguments symbol and we can lose the value, so we keep our own separately
Arguments = JSFunctionArguments.CreateArgumentsObject(ref callFrame, Context);
var symbols = _currScope.Symbols;
for (var i = parameters.Count; i < symbols.Count; ++i) //Hopefully "arguments" is the symbol almost immediately after the parameters
{
var symbol = symbols[i];
if (symbol.SymbolType == JSSymbol.SymbolTypes.Arguments)
{
SymbolValues[symbol.ValueIndex].Set(Arguments);
break;
}
}
}
else
{
Arguments = null;
var i = parameters.Count;
if (i > callFrame.PassedArgsCount)
i = callFrame.PassedArgsCount;
for (i = i - 1; i >= 0; --i)
{
var symbol = parameters[i].Symbol;
Debug.Assert(symbol.ParameterIndex == i, "Invalid situation!, symbol {0} should be paramter with parameter index {1} instead of {2}", symbol.Name, i, symbol.ParameterIndex);
if (symbol.SymbolType == JSSymbol.SymbolTypes.ClosedOnLocal)
{
var pd = Context.Map.GetPropertyDescriptorByFieldId(symbol.FieldId);
Debug.Assert(
pd != null
&& !pd.HasAttributes(mdr.PropertyDescriptor.Attributes.Undefined | mdr.PropertyDescriptor.Attributes.Inherited | mdr.PropertyDescriptor.Attributes.Accessor)
, "Invalid situation, symbol {0} is not properly added to context", symbol.Name);
Context.Fields[pd.Index] = callFrame.Arg(i);
SymbolValues[symbol.ValueIndex].Set(pd);
}
}
}
}