本文整理汇总了C#中FunctionType.GetArgumentCount方法的典型用法代码示例。如果您正苦于以下问题:C# FunctionType.GetArgumentCount方法的具体用法?C# FunctionType.GetArgumentCount怎么用?C# FunctionType.GetArgumentCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionType
的用法示例。
在下文中一共展示了FunctionType.GetArgumentCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MatchFunction
private bool MatchFunction(FunctionType left, FunctionType right, int skipArgs)
{
// The return type must be equal.
if(left.GetReturnType() != right.GetReturnType())
return false;
// The argument count must be equal.
if(left.GetArgumentCount() != right.GetArgumentCount())
return false;
// The variable flag must be equal.
if(left.HasVariableArgument() != right.HasVariableArgument())
return false;
// The arguments must be equals.
for(int i = 1; i < left.GetArgumentCount(); ++i)
{
if(left.GetArgument(i) != right.GetArgument(i))
return false;
}
return true;
}
示例2: SetFunctionType
public void SetFunctionType(FunctionType type)
{
this.type = type;
// Update the argument array.
int count = type.GetArgumentCount();
arguments = new ArgumentData[count];
for(int i = 0; i < count; ++i)
{
ArgumentData arg = new ArgumentData(type.GetArgument(i), i);
arguments[i] = arg;
}
}
示例3: CreateSimplifiedEventFunction
private void CreateSimplifiedEventFunction(AstNode node, EventVariable eventVariable, FunctionType functionType, bool isAdd)
{
// Create the function name.
string functionName = (isAdd ? "add_" : "remove_") + eventVariable.GetName();
// Create the function.
Function function;
if(functionType.GetArgumentCount() > 1)
function = new Method(functionName, eventVariable.GetFlags(), currentContainer);
else
function = new Function(functionName, eventVariable.GetFlags(), currentContainer);
// Set the function type.
function.SetFunctionType(functionType);
// Set the function position.
function.Position = node.GetPosition();
// Store the function in the event.
if(isAdd)
eventVariable.AddModifier = function;
else
eventVariable.RemoveModifier = function;
// Store the function in his container.
if(currentContainer.IsStructure() || currentContainer.IsClass() || currentContainer.IsInterface())
{
Structure building = (Structure)currentContainer;
building.AddFunction(functionName, function);
}
else if(currentContainer.IsNamespace())
{
Namespace space = (Namespace)currentContainer;
space.AddMember(function);
}
else
{
Error(node, "an event cannot be declared here.");
}
}