Browse Source

Made the generation of conversion operators for constructors non-optional.

We are better off always having them because we map to C++ better this way.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/719/head
Dimitar Dobrev 9 years ago
parent
commit
bc9016cf19
  1. 5
      src/Generator/Driver.cs
  2. 7
      src/Generator/Options.cs
  3. 3
      tests/CSharp/CSharp.cs
  4. 1
      tests/Common/Common.cs
  5. 1
      tests/TypeMaps/TypeMaps.cs

5
src/Generator/Driver.cs

@ -296,10 +296,7 @@ namespace CppSharp @@ -296,10 +296,7 @@ namespace CppSharp
TranslationUnitPasses.AddPass(new MoveOperatorToClassPass());
TranslationUnitPasses.AddPass(new MoveFunctionToClassPass());
TranslationUnitPasses.AddPass(new GenerateAnonymousDelegatesPass());
if (Options.GenerateConversionOperators)
TranslationUnitPasses.AddPass(new ConstructorToConversionOperatorPass());
TranslationUnitPasses.AddPass(new ConstructorToConversionOperatorPass());
TranslationUnitPasses.AddPass(new MarshalPrimitivePointersAsRefTypePass());
TranslationUnitPasses.AddPass(new CheckAmbiguousFunctions());
TranslationUnitPasses.AddPass(new CheckOperatorsOverloadsPass());

7
src/Generator/Options.cs

@ -102,13 +102,6 @@ namespace CppSharp @@ -102,13 +102,6 @@ namespace CppSharp
/// </summary>
public bool GeneratePropertiesAdvanced;
/// <summary>
/// If set to true the generator will use ConstructorToConversionOperatorPass to
/// create implicit and explicit conversion operators out of single argument
/// constructors.
/// </summary>
public bool GenerateConversionOperators;
/// <summary>
/// If set to true the CLI generator will use ObjectOverridesPass to create
/// Equals, GetHashCode and (if the insertion operator &lt;&lt; is overloaded) ToString

3
tests/CSharp/CSharp.cs

@ -151,9 +151,6 @@ namespace CppSharp.Tests @@ -151,9 +151,6 @@ namespace CppSharp.Tests
public override void SetupPasses(Driver driver)
{
driver.Options.GeneratePropertiesAdvanced = true;
// To ensure that calls to constructors in conversion operators
// are not ambiguous with multiple inheritance pass enabled.
driver.Options.GenerateConversionOperators = true;
driver.Context.TranslationUnitPasses.AddPass(new TestAttributesPass());
driver.Context.TranslationUnitPasses.AddPass(new CheckMacroPass());
driver.Options.MarshalCharAsManagedChar = true;

1
tests/Common/Common.cs

@ -63,7 +63,6 @@ namespace CppSharp.Tests @@ -63,7 +63,6 @@ namespace CppSharp.Tests
{
driver.Options.MarshalCharAsManagedChar = true;
driver.Options.GenerateProperties = true;
driver.Options.GenerateConversionOperators = true;
driver.Options.GenerateDefaultValuesForArguments = true;
}

1
tests/TypeMaps/TypeMaps.cs

@ -17,7 +17,6 @@ namespace CppSharp.Tests @@ -17,7 +17,6 @@ namespace CppSharp.Tests
{
driver.Options.MarshalCharAsManagedChar = true;
driver.Options.GenerateProperties = true;
driver.Options.GenerateConversionOperators = true;
}
public override void Preprocess(Driver driver, ASTContext ctx)

Loading…
Cancel
Save