Fix using Delegate<> in API event
This commit is contained in:
@@ -4,11 +4,6 @@
|
||||
|
||||
#include "Engine/Core/Memory/Allocation.h"
|
||||
|
||||
template<typename>
|
||||
class Function;
|
||||
template<typename... Params>
|
||||
class Delegate;
|
||||
|
||||
/// <summary>
|
||||
/// The function object.
|
||||
/// </summary>
|
||||
|
||||
@@ -97,6 +97,10 @@ template<typename T, typename U>
|
||||
class Pair;
|
||||
template<typename KeyType, typename ValueType>
|
||||
class Dictionary;
|
||||
template<typename>
|
||||
class Function;
|
||||
template<typename... Params>
|
||||
class Delegate;
|
||||
|
||||
// Declares full set of operators for the enum type (using binary operation on integer values)
|
||||
#define DECLARE_ENUM_OPERATORS(T) \
|
||||
|
||||
@@ -136,6 +136,8 @@ namespace Flax.Build.Bindings
|
||||
private static string GenerateCSharpNativeToManaged(BuildData buildData, TypeInfo typeInfo, ApiTypeInfo caller)
|
||||
{
|
||||
string result;
|
||||
if (typeInfo?.Type == null)
|
||||
throw new ArgumentNullException();
|
||||
|
||||
// Use dynamic array as wrapper container for fixed-size native arrays
|
||||
if (typeInfo.IsArray)
|
||||
|
||||
@@ -1136,6 +1136,7 @@ namespace Flax.Build.Bindings
|
||||
|
||||
// C# event invoking wrapper (calls C# event from C++ delegate)
|
||||
CppIncludeFiles.Add("Engine/Scripting/ManagedCLR/MEvent.h");
|
||||
CppIncludeFiles.Add("Engine/Scripting/ManagedCLR/MClass.h");
|
||||
contents.Append(" ");
|
||||
if (eventInfo.IsStatic)
|
||||
contents.Append("static ");
|
||||
@@ -1150,7 +1151,7 @@ namespace Flax.Build.Bindings
|
||||
contents.Append(" {").AppendLine();
|
||||
contents.Append(" static MMethod* mmethod = nullptr;").AppendLine();
|
||||
contents.Append(" if (!mmethod)").AppendLine();
|
||||
contents.AppendFormat(" mmethod = {1}::GetStaticClass()->GetMethod(\"Internal_{0}_Invoke\", {2});", eventInfo.Name, classTypeNameNative, paramsCount).AppendLine();
|
||||
contents.AppendFormat(" mmethod = {1}::TypeInitializer.GetType().ManagedClass->GetMethod(\"Internal_{0}_Invoke\", {2});", eventInfo.Name, classTypeNameNative, paramsCount).AppendLine();
|
||||
contents.Append(" CHECK(mmethod);").AppendLine();
|
||||
contents.Append(" MonoObject* exception = nullptr;").AppendLine();
|
||||
if (paramsCount == 0)
|
||||
|
||||
@@ -213,7 +213,9 @@ namespace Flax.Build.Bindings
|
||||
type.GenericArgs = new List<TypeInfo>();
|
||||
do
|
||||
{
|
||||
type.GenericArgs.Add(ParseType(ref context));
|
||||
var argType = ParseType(ref context);
|
||||
if (argType.Type != null)
|
||||
type.GenericArgs.Add(argType);
|
||||
token = context.Tokenizer.NextToken();
|
||||
} while (token.Type != TokenType.RightAngleBracket);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user