Browse Source

Formatting fixes on MultipleInheritancePass.

pull/1300/head
João Matos 6 years ago committed by João Matos
parent
commit
a7824abb02
  1. 72
      src/Generator/Passes/MultipleInheritancePass.cs

72
src/Generator/Passes/MultipleInheritancePass.cs

@ -139,30 +139,31 @@ namespace CppSharp.Passes @@ -139,30 +139,31 @@ namespace CppSharp.Passes
{
QualifiedType intPtr = new QualifiedType(
new BuiltinType(PrimitiveType.IntPtr));
var instance = new Property
{
Namespace = @interface,
Namespace = @interface,
Name = Helpers.InstanceIdentifier,
QualifiedType = intPtr,
GetMethod = new Method
{
Name = Helpers.InstanceIdentifier,
QualifiedType = intPtr,
GetMethod = new Method
{
Name = Helpers.InstanceIdentifier,
SynthKind = FunctionSynthKind.InterfaceInstance,
Namespace = @interface,
OriginalReturnType = intPtr
}
};
SynthKind = FunctionSynthKind.InterfaceInstance,
Namespace = @interface,
OriginalReturnType = intPtr
}
};
@interface.Properties.Add(instance);
var dispose = new Method
{
Namespace = @interface,
Name = "Dispose",
ReturnType = new QualifiedType(new BuiltinType(PrimitiveType.Void)),
SynthKind = FunctionSynthKind.InterfaceDispose,
Mangled = string.Empty
};
{
Namespace = @interface,
Name = "Dispose",
ReturnType = new QualifiedType(new BuiltinType(PrimitiveType.Void)),
SynthKind = FunctionSynthKind.InterfaceDispose,
Mangled = string.Empty
};
@interface.Methods.Add(dispose);
}
@ -208,21 +209,23 @@ namespace CppSharp.Passes @@ -208,21 +209,23 @@ namespace CppSharp.Passes
if (property.GetMethod != null)
{
interfaceProperty.GetMethod = new Method(property.GetMethod)
{
OriginalFunction = property.GetMethod,
Namespace = @namespace
};
{
OriginalFunction = property.GetMethod,
Namespace = @namespace
};
}
if (property.SetMethod != null)
{
// handle indexers
interfaceProperty.SetMethod = property.GetMethod == property.SetMethod ?
interfaceProperty.GetMethod : new Method(property.SetMethod)
{
OriginalFunction = property.SetMethod,
Namespace = @namespace
};
{
OriginalFunction = property.SetMethod,
Namespace = @namespace
};
}
return interfaceProperty;
}
@ -236,23 +239,29 @@ namespace CppSharp.Passes @@ -236,23 +239,29 @@ namespace CppSharp.Passes
m.Parameters.Where(p => !p.Ignore).SequenceEqual(
method.Parameters.Where(p => !p.Ignore),
ParameterTypeComparer.Instance));
if (existingImpl != null)
{
if (existingImpl.OriginalFunction == null)
existingImpl.OriginalFunction = method;
continue;
}
var impl = new Method(method)
{
Namespace = @class,
OriginalNamespace = @interface,
OriginalFunction = method.OriginalFunction
};
{
Namespace = @class,
OriginalNamespace = @interface,
OriginalFunction = method.OriginalFunction
};
var rootBaseMethod = @class.GetBaseMethod(method);
if (rootBaseMethod != null && rootBaseMethod.IsDeclared)
impl.ExplicitInterfaceImpl = @interface;
@class.Methods.Add(impl);
}
foreach (var @base in @interface.Bases)
ImplementInterfaceMethods(@class, @base.Class);
}
@ -263,11 +272,14 @@ namespace CppSharp.Passes @@ -263,11 +272,14 @@ namespace CppSharp.Passes
{
var impl = CreateInterfaceProperty(property, @class);
impl.OriginalNamespace = @interface;
var rootBaseProperty = @class.GetBasePropertyByName(property, true);
if (rootBaseProperty != null && rootBaseProperty.IsDeclared)
impl.ExplicitInterfaceImpl = @interface;
@class.Properties.Add(impl);
}
foreach (var @base in @interface.Bases)
ImplementInterfaceProperties(@class, @base.Class);
}

Loading…
Cancel
Save