Skip to content

Commit 68167ee

Browse files
committed
fix: unable convert to string
1 parent a6488ef commit 68167ee

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

mdk/DCCMTool/Commands/Docs/GenerateHaxeDBCommand.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public HaxeCompilerException(string message) : base(message) { }
3030
public HaxeCompilerException(string message, Exception inner) : base(message, inner) { }
3131

3232
}
33+
3334
private record class HaxeInstance(BinaryReader OutputStream, BinaryWriter InputStream, Process Process, int Index);
3435
private static async Task<string> SendCommand(HaxeInstance haxe, string? stdin, params List<string> args)
3536
{

sources/HashlinkNET.Compiler/Utils/GeneralUtils.cs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,8 @@ public static void EmitFieldGetterSetter( this TypeDefinition type,
7676
IDataContainer container,
7777
string name)
7878
{
79+
property.CheckDynamic(
80+
container.GetGlobalData<RuntimeImports>(), property.PropertyType);
7981
var gdata = container.GetGlobalData<GlobalData>();
8082
{
8183
property.SetMethod = new("set_" + name, MethodAttributes.SpecialName | MethodAttributes.Public,
@@ -86,6 +88,9 @@ public static void EmitFieldGetterSetter( this TypeDefinition type,
8688
new(property.PropertyType)
8789
}
8890
};
91+
property.SetMethod.Parameters[0].CheckDynamic(
92+
container.GetGlobalData<RuntimeImports>(), property.PropertyType);
93+
8994
var ilp = property.SetMethod.Body.GetILProcessor();
9095
ilp.Emit(OpCodes.Ldarg_0);
9196
ilp.Emit(OpCodes.Ldarg_1);
@@ -330,12 +335,12 @@ void CheckDynamic2(List<bool> values, TypeReference tr)
330335

331336
if (anyDynamic)
332337
{
333-
338+
var array = dynamicFlagsList.ToArray();
334339
provider.CustomAttributes.Add(new(runtimeImports.attrDynamic2)
335340
{
336341
ConstructorArguments = {
337-
new(runtimeImports.typeSystem.Boolean.MakeArrayType(), dynamicFlagsList.ToArray())
338-
}
342+
new(runtimeImports.typeSystem.Boolean.MakeArrayType(), array)
343+
}
339344
});
340345
}
341346
}

sources/HaxeProxy/Runtime/HaxeProxyBase.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ public override bool TryConvert( ConvertBinder binder, out object? result )
5858
result = HashlinkObj;
5959
return true;
6060
}
61+
if (binder.Type == typeof(string))
62+
{
63+
result = ToString();
64+
return true;
65+
}
6166
return base.TryConvert(binder, out result);
6267
}
6368
public virtual T ToVirtual<T>() where T : HaxeVirtual

0 commit comments

Comments
 (0)