|
|
@ -694,11 +694,12 @@ internal static bool {Helpers.TryGetNativeToManagedMappingIdentifier}(IntPtr nat |
|
|
|
private IEnumerable<string> GatherInternalParams(Function function, out TypePrinterResult retType) |
|
|
|
private IEnumerable<string> GatherInternalParams(Function function, out TypePrinterResult retType) |
|
|
|
{ |
|
|
|
{ |
|
|
|
TypePrinter.PushContext(TypePrinterContextKind.Native); |
|
|
|
TypePrinter.PushContext(TypePrinterContextKind.Native); |
|
|
|
|
|
|
|
|
|
|
|
retType = function.ReturnType.Visit(TypePrinter); |
|
|
|
retType = function.ReturnType.Visit(TypePrinter); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TypePrinter.Function = function; |
|
|
|
var @params = function.GatherInternalParams(Context.ParserOptions.IsItaniumLikeAbi).Select(p => |
|
|
|
var @params = function.GatherInternalParams(Context.ParserOptions.IsItaniumLikeAbi).Select(p => |
|
|
|
$"{p.Visit(TypePrinter)} {p.Name}").ToList(); |
|
|
|
$"{p.Visit(TypePrinter)} {p.Name}").ToList(); |
|
|
|
|
|
|
|
TypePrinter.Function = null; |
|
|
|
|
|
|
|
|
|
|
|
TypePrinter.PopContext(); |
|
|
|
TypePrinter.PopContext(); |
|
|
|
|
|
|
|
|
|
|
@ -995,7 +996,9 @@ internal static bool {Helpers.TryGetNativeToManagedMappingIdentifier}(IntPtr nat |
|
|
|
var actualProperty = GetActualProperty(property, @class); |
|
|
|
var actualProperty = GetActualProperty(property, @class); |
|
|
|
if (actualProperty == null) |
|
|
|
if (actualProperty == null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
TypePrinter.Property = property; |
|
|
|
WriteLine($@"throw new MissingMethodException(""Method {property.Name} missing from explicit specialization {@class.Visit(TypePrinter)}."");"); |
|
|
|
WriteLine($@"throw new MissingMethodException(""Method {property.Name} missing from explicit specialization {@class.Visit(TypePrinter)}."");"); |
|
|
|
|
|
|
|
TypePrinter.Property = null; |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
property = actualProperty; |
|
|
|
property = actualProperty; |
|
|
@ -1042,7 +1045,8 @@ internal static bool {Helpers.TryGetNativeToManagedMappingIdentifier}(IntPtr nat |
|
|
|
{ |
|
|
|
{ |
|
|
|
Parameter = param, |
|
|
|
Parameter = param, |
|
|
|
ArgName = param.Name, |
|
|
|
ArgName = param.Name, |
|
|
|
ReturnVarName = returnVar |
|
|
|
ReturnVarName = returnVar, |
|
|
|
|
|
|
|
Field = field, |
|
|
|
}; |
|
|
|
}; |
|
|
|
ctx.PushMarshalKind(MarshalKind.NativeField); |
|
|
|
ctx.PushMarshalKind(MarshalKind.NativeField); |
|
|
|
|
|
|
|
|
|
|
@ -1141,7 +1145,8 @@ internal static bool {Helpers.TryGetNativeToManagedMappingIdentifier}(IntPtr nat |
|
|
|
ParameterIndex = function.Parameters.Count( |
|
|
|
ParameterIndex = function.Parameters.Count( |
|
|
|
p => p.Kind != ParameterKind.IndirectReturnType), |
|
|
|
p => p.Kind != ParameterKind.IndirectReturnType), |
|
|
|
ReturnType = new QualifiedType(type), |
|
|
|
ReturnType = new QualifiedType(type), |
|
|
|
ArgName = "value" |
|
|
|
ArgName = "value", |
|
|
|
|
|
|
|
Function = function, |
|
|
|
}; |
|
|
|
}; |
|
|
|
var marshal = new CSharpMarshalManagedToNativePrinter(ctx); |
|
|
|
var marshal = new CSharpMarshalManagedToNativePrinter(ctx); |
|
|
|
type.Visit(marshal); |
|
|
|
type.Visit(marshal); |
|
|
@ -1282,7 +1287,7 @@ internal static bool {Helpers.TryGetNativeToManagedMappingIdentifier}(IntPtr nat |
|
|
|
var ctx = new CSharpMarshalContext(Context, CurrentIndentation) |
|
|
|
var ctx = new CSharpMarshalContext(Context, CurrentIndentation) |
|
|
|
{ |
|
|
|
{ |
|
|
|
ArgName = var.Name, |
|
|
|
ArgName = var.Name, |
|
|
|
ReturnType = var.QualifiedType |
|
|
|
ReturnType = var.QualifiedType, |
|
|
|
}; |
|
|
|
}; |
|
|
|
ctx.PushMarshalKind(MarshalKind.ReturnVariableArray); |
|
|
|
ctx.PushMarshalKind(MarshalKind.ReturnVariableArray); |
|
|
|
|
|
|
|
|
|
|
@ -1333,7 +1338,9 @@ internal static bool {Helpers.TryGetNativeToManagedMappingIdentifier}(IntPtr nat |
|
|
|
var actualProperty = GetActualProperty(property, @class); |
|
|
|
var actualProperty = GetActualProperty(property, @class); |
|
|
|
if (actualProperty == null) |
|
|
|
if (actualProperty == null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
TypePrinter.Property = property; |
|
|
|
WriteLine($@"throw new MissingMethodException(""Method {property.Name} missing from explicit specialization {@class.Visit(TypePrinter)}."");"); |
|
|
|
WriteLine($@"throw new MissingMethodException(""Method {property.Name} missing from explicit specialization {@class.Visit(TypePrinter)}."");"); |
|
|
|
|
|
|
|
TypePrinter.Property = null; |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
QualifiedType type = default; |
|
|
|
QualifiedType type = default; |
|
|
@ -1405,7 +1412,8 @@ internal static bool {Helpers.TryGetNativeToManagedMappingIdentifier}(IntPtr nat |
|
|
|
{ |
|
|
|
{ |
|
|
|
ArgName = field.Name, |
|
|
|
ArgName = field.Name, |
|
|
|
ReturnVarName = returnVar, |
|
|
|
ReturnVarName = returnVar, |
|
|
|
ReturnType = returnType |
|
|
|
ReturnType = returnType, |
|
|
|
|
|
|
|
Field = field, |
|
|
|
}; |
|
|
|
}; |
|
|
|
ctx.PushMarshalKind(MarshalKind.NativeField); |
|
|
|
ctx.PushMarshalKind(MarshalKind.NativeField); |
|
|
|
|
|
|
|
|
|
|
@ -1550,7 +1558,9 @@ internal static bool {Helpers.TryGetNativeToManagedMappingIdentifier}(IntPtr nat |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
GenerateDeclarationCommon(prop); |
|
|
|
GenerateDeclarationCommon(prop); |
|
|
|
|
|
|
|
TypePrinter.Property = prop; |
|
|
|
var printedType = prop.Type.Visit(TypePrinter); |
|
|
|
var printedType = prop.Type.Visit(TypePrinter); |
|
|
|
|
|
|
|
TypePrinter.Property = null; |
|
|
|
if (prop.ExplicitInterfaceImpl == null) |
|
|
|
if (prop.ExplicitInterfaceImpl == null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
Write(Helpers.GetAccess(prop.Access)); |
|
|
|
Write(Helpers.GetAccess(prop.Access)); |
|
|
@ -1926,7 +1936,8 @@ internal static bool {Helpers.TryGetNativeToManagedMappingIdentifier}(IntPtr nat |
|
|
|
ReturnType = param.QualifiedType, |
|
|
|
ReturnType = param.QualifiedType, |
|
|
|
ReturnVarName = param.Name, |
|
|
|
ReturnVarName = param.Name, |
|
|
|
ParameterIndex = i, |
|
|
|
ParameterIndex = i, |
|
|
|
Parameter = param |
|
|
|
Parameter = param, |
|
|
|
|
|
|
|
Function = method, |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
ctx.PushMarshalKind(MarshalKind.GenericDelegate); |
|
|
|
ctx.PushMarshalKind(MarshalKind.GenericDelegate); |
|
|
@ -2071,7 +2082,9 @@ internal static bool {Helpers.TryGetNativeToManagedMappingIdentifier}(IntPtr nat |
|
|
|
|
|
|
|
|
|
|
|
using (WriteBlock($"private static {retType} {vTableMethodDelegateName}Hook({string.Join(", ", @params)})")) |
|
|
|
using (WriteBlock($"private static {retType} {vTableMethodDelegateName}Hook({string.Join(", ", @params)})")) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
TypePrinter.Function = method; |
|
|
|
WriteLine($@"var {Helpers.TargetIdentifier} = {@class.Visit(TypePrinter)}.__GetInstance({Helpers.InstanceField});"); |
|
|
|
WriteLine($@"var {Helpers.TargetIdentifier} = {@class.Visit(TypePrinter)}.__GetInstance({Helpers.InstanceField});"); |
|
|
|
|
|
|
|
TypePrinter.Function = null; |
|
|
|
GenerateVTableManagedCall(method); |
|
|
|
GenerateVTableManagedCall(method); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -2735,12 +2748,16 @@ internal static{(@new ? " new" : string.Empty)} {printedClass} __GetInstance({Ty |
|
|
|
m => m.InstantiatedFrom == (method.OriginalFunction ?? method)); |
|
|
|
m => m.InstantiatedFrom == (method.OriginalFunction ?? method)); |
|
|
|
if (specializedMethod == null) |
|
|
|
if (specializedMethod == null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
TypePrinter.Function = method; |
|
|
|
WriteLine($@"throw new MissingMethodException(""Method {method.Name} missing from explicit specialization {@class.Visit(TypePrinter)}."");"); |
|
|
|
WriteLine($@"throw new MissingMethodException(""Method {method.Name} missing from explicit specialization {@class.Visit(TypePrinter)}."");"); |
|
|
|
|
|
|
|
TypePrinter.Function = null; |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
if (specializedMethod.Ignore) |
|
|
|
if (specializedMethod.Ignore) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
TypePrinter.Function = method; |
|
|
|
WriteLine($@"throw new MissingMethodException(""Method {method.Name} ignored in specialization {@class.Visit(TypePrinter)}."");"); |
|
|
|
WriteLine($@"throw new MissingMethodException(""Method {method.Name} ignored in specialization {@class.Visit(TypePrinter)}."");"); |
|
|
|
|
|
|
|
TypePrinter.Function = null; |
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -2950,6 +2967,7 @@ internal static{(@new ? " new" : string.Empty)} {printedClass} __GetInstance({Ty |
|
|
|
parameter.Type.IsPrimitiveTypeConvertibleToRef() ? |
|
|
|
parameter.Type.IsPrimitiveTypeConvertibleToRef() ? |
|
|
|
"ref *" : string.Empty, |
|
|
|
"ref *" : string.Empty, |
|
|
|
parameter.Name); |
|
|
|
parameter.Name); |
|
|
|
|
|
|
|
TypePrinter.Function = method; |
|
|
|
var printedType = method.ConversionType.Visit(TypePrinter); |
|
|
|
var printedType = method.ConversionType.Visit(TypePrinter); |
|
|
|
if (@interface != null) |
|
|
|
if (@interface != null) |
|
|
|
{ |
|
|
|
{ |
|
|
@ -2958,6 +2976,7 @@ internal static{(@new ? " new" : string.Empty)} {printedClass} __GetInstance({Ty |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
WriteLine($"return new {printedType}({paramName});"); |
|
|
|
WriteLine($"return new {printedType}({paramName});"); |
|
|
|
|
|
|
|
TypePrinter.Function = null; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|