public void MergeEventFunction(UnityApiEventFunction newFunction, Version apiVersion)
{
UpdateSupportedVersion(apiVersion);
var newFunctionSig = newFunction.ToString();
foreach (var eventFunction in myEventFunctions)
{
if (eventFunction.ToString() == newFunctionSig)
{
// Prefer an existing documented function that covers this version, than an undocumented one. This
// means we will automatically replace our undocumented functions with documented versions without
// having to explicitly add an end version
if (newFunction.IsUndocumented && !eventFunction.IsUndocumented &&
eventFunction.MinimumVersion <= apiVersion && eventFunction.MaximumVersion >= apiVersion)
{
return;
}
// If the documented state of both functions is the same, update the function
if (newFunction.IsUndocumented == eventFunction.IsUndocumented)
{
eventFunction.Update(newFunction, apiVersion);
return;
}
}
}
// Not a match. We either haven't found this function before,
// or a parameter or return type is different
myEventFunctions.Add(newFunction);
}