Browse Source

Changed type maps to only return types - no strings.

Signed-off-by: Dimitar Dobrev <dpldobrev@protonmail.com>
pull/1146/head
Dimitar Dobrev 7 years ago
parent
commit
e10fc01bff
  1. 7
      src/AST/Type.cs
  2. 1
      src/Generator.Tests/ASTTestFixture.cs
  3. 11
      src/Generator/BindingContext.cs
  4. 6
      src/Generator/Driver.cs
  5. 13
      src/Generator/Generators/CLI/CLITypePrinter.cs
  6. 2
      src/Generator/Generators/CSharp/CSharpSources.cs
  7. 70
      src/Generator/Generators/CSharp/CSharpTypePrinter.cs
  8. 4
      src/Generator/Generators/TypePrinter.cs
  9. 86
      src/Generator/Types/Std/Stdlib.cs
  10. 11
      src/Generator/Types/TypeMap.cs
  11. 20
      src/Generator/Types/TypeMapDatabase.cs
  12. 33
      tests/CSharp/CSharp.cs
  13. 9
      tests/Common/Common.cs

7
src/AST/Type.cs

@ -1119,6 +1119,13 @@ namespace CppSharp.AST @@ -1119,6 +1119,13 @@ namespace CppSharp.AST
}
}
public class CustomType : UnsupportedType
{
public CustomType(string description) : base(description)
{
}
}
#region Primitives
/// <summary>

1
src/Generator.Tests/ASTTestFixture.cs

@ -34,6 +34,7 @@ namespace CppSharp.Generator.Tests @@ -34,6 +34,7 @@ namespace CppSharp.Generator.Tests
if (!Driver.ParseCode())
throw new Exception("Error parsing the code");
Driver.SetupTypeMaps();
AstContext = Driver.Context.ASTContext;
new CleanUnitPass { Context = Driver.Context }.VisitASTContext(AstContext);
new ResolveIncompleteDeclsPass { Context = Driver.Context }.VisitASTContext(AstContext);

11
src/Generator/BindingContext.cs

@ -7,17 +7,17 @@ namespace CppSharp.Generators @@ -7,17 +7,17 @@ namespace CppSharp.Generators
{
public class BindingContext
{
public DriverOptions Options { get; private set; }
public DriverOptions Options { get; }
public ParserOptions ParserOptions { get; set; }
public ASTContext ASTContext { get; set; }
public ParserTargetInfo TargetInfo { get; set; }
public SymbolContext Symbols { get; private set; }
public TypeMapDatabase TypeMaps { get; private set; }
public SymbolContext Symbols { get; }
public TypeMapDatabase TypeMaps { get; set; }
public PassBuilder<TranslationUnitPass> TranslationUnitPasses { get; private set; }
public PassBuilder<GeneratorOutputPass> GeneratorOutputPasses { get; private set; }
public PassBuilder<TranslationUnitPass> TranslationUnitPasses { get; }
public PassBuilder<GeneratorOutputPass> GeneratorOutputPasses { get; }
public BindingContext(DriverOptions options, ParserOptions parserOptions = null)
{
@ -25,7 +25,6 @@ namespace CppSharp.Generators @@ -25,7 +25,6 @@ namespace CppSharp.Generators
ParserOptions = parserOptions;
Symbols = new SymbolContext();
TypeMaps = new TypeMapDatabase();
TranslationUnitPasses = new PassBuilder<TranslationUnitPass>(this);
GeneratorOutputPasses = new PassBuilder<GeneratorOutputPass>(this);

6
src/Generator/Driver.cs

@ -13,6 +13,7 @@ using CppSharp.Parser; @@ -13,6 +13,7 @@ using CppSharp.Parser;
using CppSharp.Passes;
using CppSharp.Utils;
using Microsoft.CSharp;
using CppSharp.Types;
namespace CppSharp
{
@ -68,10 +69,12 @@ namespace CppSharp @@ -68,10 +69,12 @@ namespace CppSharp
ValidateOptions();
ParserOptions.Setup();
Context = new BindingContext(Options, ParserOptions);
Context.TypeMaps.SetupTypeMaps(Options.GeneratorKind);
Generator = CreateGeneratorFromKind(Options.GeneratorKind);
}
public void SetupTypeMaps() =>
Context.TypeMaps = new TypeMapDatabase(Context.ASTContext, Options.GeneratorKind);
void OnSourceFileParsed(IEnumerable<string> files, ParserResult result)
{
OnFileParsed(files, result);
@ -434,6 +437,7 @@ namespace CppSharp @@ -434,6 +437,7 @@ namespace CppSharp
Diagnostics.Message("Processing code...");
driver.SetupPasses(library);
driver.SetupTypeMaps();
library.Preprocess(driver, driver.Context.ASTContext);

13
src/Generator/Generators/CLI/CLITypePrinter.cs

@ -27,7 +27,7 @@ namespace CppSharp.Generators.CLI @@ -27,7 +27,7 @@ namespace CppSharp.Generators.CLI
{
typeMap.Type = tag;
var typePrinterContext = new TypePrinterContext { Type = tag };
return typeMap.CLISignature(typePrinterContext);
return typeMap.CLISignatureType(typePrinterContext).ToString();
}
Declaration decl = tag.Declaration;
@ -202,11 +202,11 @@ namespace CppSharp.Generators.CLI @@ -202,11 +202,11 @@ namespace CppSharp.Generators.CLI
{
typeMap.Type = typedef;
var typePrinterContext = new TypePrinterContext { Type = typedef };
return typeMap.CLISignature(typePrinterContext);
return typeMap.CLISignatureType(typePrinterContext).ToString();
}
FunctionType func;
if (decl.Type.IsPointerTo<FunctionType>(out func))
if (decl.Type.IsPointerTo(out func))
{
// TODO: Use SafeIdentifier()
return string.Format("{0}^", VisitDeclaration(decl));
@ -228,7 +228,7 @@ namespace CppSharp.Generators.CLI @@ -228,7 +228,7 @@ namespace CppSharp.Generators.CLI
typeMap.Declaration = decl;
typeMap.Type = template;
var typePrinterContext = new TypePrinterContext { Type = template };
return typeMap.CLISignature(typePrinterContext);
return typeMap.CLISignatureType(typePrinterContext).ToString();
}
return decl.Name;
@ -289,6 +289,11 @@ namespace CppSharp.Generators.CLI @@ -289,6 +289,11 @@ namespace CppSharp.Generators.CLI
return result;
}
public override TypePrinterResult VisitUnsupportedType(UnsupportedType type, TypeQualifiers quals)
{
return type.Description;
}
public override TypePrinterResult VisitDeclaration(Declaration decl)
{
var names = new List<string>();

2
src/Generator/Generators/CSharp/CSharpSources.cs

@ -2757,7 +2757,7 @@ namespace CppSharp.Generators.CSharp @@ -2757,7 +2757,7 @@ namespace CppSharp.Generators.CSharp
Type = indirectRetType.Type.Desugar()
};
WriteLine("{0} {1};", typeMap.CSharpSignature(typePrinterContext),
WriteLine("{0} {1};", typeMap.CSharpSignatureType(typePrinterContext),
Helpers.ReturnIdentifier);
}
else

70
src/Generator/Generators/CSharp/CSharpTypePrinter.cs

@ -42,15 +42,7 @@ namespace CppSharp.Generators.CSharp @@ -42,15 +42,7 @@ namespace CppSharp.Generators.CSharp
Type = tag
};
string type = typeMap.CSharpSignature(typePrinterContext);
if (!string.IsNullOrEmpty(type))
{
return new TypePrinterResult
{
Type = type,
TypeMap = typeMap
};
}
return typeMap.CSharpSignatureType(typePrinterContext).ToString();
}
return base.VisitTagType(tag, quals);
@ -290,15 +282,7 @@ namespace CppSharp.Generators.CSharp @@ -290,15 +282,7 @@ namespace CppSharp.Generators.CSharp
Type = typedef
};
string type = typeMap.CSharpSignature(typePrinterContext);
if (!string.IsNullOrEmpty(type))
{
return new TypePrinterResult
{
Type = type,
TypeMap = typeMap
};
}
return typeMap.CSharpSignatureType(typePrinterContext).ToString();
}
FunctionType func = decl.Type as FunctionType;
@ -350,17 +334,7 @@ namespace CppSharp.Generators.CSharp @@ -350,17 +334,7 @@ namespace CppSharp.Generators.CSharp
MarshalKind = MarshalKind
};
var type = typeMap.CSharpSignature(typePrinterContext);
if (!string.IsNullOrEmpty(type))
{
return new TypePrinterResult
{
Type = type,
TypeMap = typeMap
};
}
return decl.Visit(this);
return typeMap.CSharpSignatureType(typePrinterContext).ToString();
}
public override TypePrinterResult VisitDependentTemplateSpecializationType(
@ -408,7 +382,38 @@ namespace CppSharp.Generators.CSharp @@ -408,7 +382,38 @@ namespace CppSharp.Generators.CSharp
public override TypePrinterResult VisitCILType(CILType type, TypeQualifiers quals)
{
return type.Type.FullName;
switch (System.Type.GetTypeCode(type.Type))
{
case TypeCode.Boolean:
return "bool";
case TypeCode.Char:
return "char";
case TypeCode.SByte:
return "sbyte";
case TypeCode.Byte:
return "byte";
case TypeCode.Int16:
return "short";
case TypeCode.UInt16:
return "ushort";
case TypeCode.Int32:
return "int";
case TypeCode.UInt32:
return "uint";
case TypeCode.Int64:
return "long";
case TypeCode.UInt64:
return "ulong";
case TypeCode.Single:
return "float";
case TypeCode.Double:
return "double";
case TypeCode.Decimal:
return "decimal";
case TypeCode.String:
return "string";
}
return $"global::{type.Type.FullName}";
}
public static void GetPrimitiveTypeWidth(PrimitiveType primitive,
@ -707,6 +712,11 @@ namespace CppSharp.Generators.CSharp @@ -707,6 +712,11 @@ namespace CppSharp.Generators.CSharp
return vectorType.ElementType.Visit(this);
}
public override TypePrinterResult VisitUnsupportedType(UnsupportedType type, TypeQualifiers quals)
{
return type.Description;
}
private static string GetParameterUsage(ParameterUsage usage)
{
switch (usage)

4
src/Generator/Generators/TypePrinter.cs

@ -1,16 +1,12 @@ @@ -1,16 +1,12 @@
using CppSharp.AST;
using CppSharp.AST.Extensions;
using CppSharp.Types;
using System;
using System.Collections.Generic;
using System.Linq;
namespace CppSharp.Generators
{
public class TypePrinterResult
{
public string Type;
public TypeMap TypeMap;
public string NameSuffix;
public static implicit operator TypePrinterResult(string type)

86
src/Generator/Types/Std/Stdlib.cs

@ -12,28 +12,15 @@ namespace CppSharp.Types.Std @@ -12,28 +12,15 @@ namespace CppSharp.Types.Std
[TypeMap("va_list")]
public class VaList : TypeMap
{
public override string CLISignature(TypePrinterContext ctx)
{
return "va_list";
}
public override string CSharpSignature(TypePrinterContext ctx)
{
return "va_list";
}
public override bool IsIgnored
{
get { return true; }
}
public override bool IsIgnored => true;
}
[TypeMap("basic_string<char, char_traits<char>, allocator<char>>")]
public class String : TypeMap
{
public override string CLISignature(TypePrinterContext ctx)
public override Type CLISignatureType(TypePrinterContext ctx)
{
return "System::String^";
return new CILType(typeof(string));
}
public override void CLIMarshalToNative(MarshalContext ctx)
@ -48,14 +35,14 @@ namespace CppSharp.Types.Std @@ -48,14 +35,14 @@ namespace CppSharp.Types.Std
ctx.ReturnVarName);
}
public override string CSharpSignature(TypePrinterContext ctx)
public override Type CSharpSignatureType(TypePrinterContext ctx)
{
if (ctx.Kind == TypePrinterContextKind.Managed)
return "string";
return new CILType(typeof(string));
ClassTemplateSpecialization basicString = GetBasicString(ctx.Type);
var typePrinter = new CSharpTypePrinter(null);
typePrinter.PushContext(TypePrinterContextKind.Native);
return basicString.Visit(typePrinter).Type;
return new CustomType(basicString.Visit(typePrinter).Type);
}
public override void CSharpMarshalToNative(CSharpMarshalContext ctx)
@ -146,9 +133,9 @@ namespace CppSharp.Types.Std @@ -146,9 +133,9 @@ namespace CppSharp.Types.Std
[TypeMap("std::wstring", GeneratorKind = GeneratorKind.CLI)]
public class WString : TypeMap
{
public override string CLISignature(TypePrinterContext ctx)
public override Type CLISignatureType(TypePrinterContext ctx)
{
return "System::String^";
return new CILType(typeof(string));
}
public override void CLIMarshalToNative(MarshalContext ctx)
@ -163,9 +150,9 @@ namespace CppSharp.Types.Std @@ -163,9 +150,9 @@ namespace CppSharp.Types.Std
ctx.ReturnVarName);
}
public override string CSharpSignature(TypePrinterContext ctx)
public override Type CSharpSignatureType(TypePrinterContext ctx)
{
return "string";
return new CILType(typeof(string));
}
public override void CSharpMarshalToNative(CSharpMarshalContext ctx)
@ -200,10 +187,10 @@ namespace CppSharp.Types.Std @@ -200,10 +187,10 @@ namespace CppSharp.Types.Std
}
}
public override string CLISignature(TypePrinterContext ctx)
public override Type CLISignatureType(TypePrinterContext ctx)
{
return string.Format("System::Collections::Generic::List<{0}>^",
ctx.GetTemplateParameterList());
return new CustomType(
$"System::Collections::Generic::List<{ctx.GetTemplateParameterList()}>^");
}
public override void CLIMarshalToNative(MarshalContext ctx)
@ -307,12 +294,12 @@ namespace CppSharp.Types.Std @@ -307,12 +294,12 @@ namespace CppSharp.Types.Std
ctx.Return.Write(tmpVarName);
}
public override string CSharpSignature(TypePrinterContext ctx)
public override Type CSharpSignatureType(TypePrinterContext ctx)
{
if (ctx.Kind == TypePrinterContextKind.Native)
return "Std.Vector";
return new CustomType("Std.Vector");
return string.Format("Std.Vector<{0}>", ctx.GetTemplateParameterList());
return new CustomType($"Std.Vector<{ctx.GetTemplateParameterList()}>");
}
public override void CSharpMarshalToNative(CSharpMarshalContext ctx)
@ -335,12 +322,12 @@ namespace CppSharp.Types.Std @@ -335,12 +322,12 @@ namespace CppSharp.Types.Std
{
public override bool IsIgnored { get { return true; } }
public override string CLISignature(TypePrinterContext ctx)
public override Type CLISignatureType(TypePrinterContext ctx)
{
var type = Type as TemplateSpecializationType;
return string.Format(
"System::Collections::Generic::Dictionary<{0}, {1}>^",
type.Arguments[0].Type, type.Arguments[1].Type);
return new CustomType(
$@"System::Collections::Generic::Dictionary<{
type.Arguments[0].Type}, {type.Arguments[1].Type}>^");
}
public override void CLIMarshalToNative(MarshalContext ctx)
@ -353,15 +340,15 @@ namespace CppSharp.Types.Std @@ -353,15 +340,15 @@ namespace CppSharp.Types.Std
throw new System.NotImplementedException();
}
public override string CSharpSignature(TypePrinterContext ctx)
public override Type CSharpSignatureType(TypePrinterContext ctx)
{
if (ctx.Kind == TypePrinterContextKind.Native)
return "Std.Map";
return new CustomType("Std.Map");
var type = Type as TemplateSpecializationType;
return string.Format(
"System.Collections.Generic.Dictionary<{0}, {1}>",
type.Arguments[0].Type, type.Arguments[1].Type);
return new CustomType(
$@"System.Collections.Generic.Dictionary<{
type.Arguments[0].Type}, {type.Arguments[1].Type}>");
}
}
@ -375,29 +362,14 @@ namespace CppSharp.Types.Std @@ -375,29 +362,14 @@ namespace CppSharp.Types.Std
public class SharedPtr : TypeMap
{
public override bool IsIgnored { get { return true; } }
public override string CLISignature(TypePrinterContext ctx)
{
throw new System.NotImplementedException();
}
public override void CLIMarshalToNative(MarshalContext ctx)
{
throw new System.NotImplementedException();
}
public override void CLIMarshalToManaged(MarshalContext ctx)
{
throw new System.NotImplementedException();
}
}
[TypeMap("basic_ostream<char, char_traits<char>>", GeneratorKind.CLI)]
public class OStream : TypeMap
{
public override string CLISignature(TypePrinterContext ctx)
public override Type CLISignatureType(TypePrinterContext ctx)
{
return "System::IO::TextWriter^";
return new CILType(typeof(System.IO.TextWriter));
}
public override void CLIMarshalToNative(MarshalContext ctx)
@ -435,9 +407,9 @@ namespace CppSharp.Types.Std @@ -435,9 +407,9 @@ namespace CppSharp.Types.Std
[TypeMap("FILE", GeneratorKind = GeneratorKind.CSharp)]
public class FILE : TypeMap
{
public override string CSharpSignature(TypePrinterContext ctx)
public override Type CSharpSignatureType(TypePrinterContext ctx)
{
return CSharpTypePrinter.IntPtrType;
return new CILType(typeof(System.IntPtr));
}
public override void CSharpMarshalToNative(CSharpMarshalContext ctx)

11
src/Generator/Types/TypeMap.cs

@ -38,6 +38,7 @@ namespace CppSharp.Types @@ -38,6 +38,7 @@ namespace CppSharp.Types
{
public Type Type { get; set; }
public Declaration Declaration { get; set; }
public ASTContext ASTContext { get; set; }
public ITypeMapDatabase TypeMapDatabase { get; set; }
public bool IsEnabled { get; set; } = true;
@ -64,11 +65,6 @@ namespace CppSharp.Types @@ -64,11 +65,6 @@ namespace CppSharp.Types
return new CILType(typeof(object));
}
public virtual string CSharpSignature(TypePrinterContext ctx)
{
throw new NotImplementedException();
}
public virtual void CSharpMarshalToNative(CSharpMarshalContext ctx)
{
throw new NotImplementedException();
@ -97,11 +93,6 @@ namespace CppSharp.Types @@ -97,11 +93,6 @@ namespace CppSharp.Types
return new CILType(typeof(object));
}
public virtual string CLISignature(TypePrinterContext ctx)
{
throw new NotImplementedException();
}
public virtual void CLITypeReference(CLITypeReferenceCollector collector, ASTRecord<Declaration> loc)
{
}

20
src/Generator/Types/TypeMapDatabase.cs

@ -3,10 +3,6 @@ using System.Collections.Generic; @@ -3,10 +3,6 @@ using System.Collections.Generic;
using CppSharp.AST;
using CppSharp.AST.Extensions;
using CppSharp.Generators;
using CppSharp.Generators.AST;
using CppSharp.Generators.CLI;
using CppSharp.Generators.CSharp;
using Attribute = System.Attribute;
using Type = CppSharp.AST.Type;
namespace CppSharp.Types
@ -15,21 +11,15 @@ namespace CppSharp.Types @@ -15,21 +11,15 @@ namespace CppSharp.Types
{
public IDictionary<string, TypeMap> TypeMaps { get; set; }
public TypeMapDatabase()
public TypeMapDatabase(ASTContext astContext, GeneratorKind generatorKind)
{
TypeMaps = new Dictionary<string, TypeMap>();
}
public void SetupTypeMaps(GeneratorKind generatorKind)
{
var loadedAssemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (var assembly in loadedAssemblies)
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
{
try
{
var types = assembly.FindDerivedTypes(typeof(TypeMap));
SetupTypeMaps(types, generatorKind);
SetupTypeMaps(types, generatorKind, astContext);
}
catch (System.Reflection.ReflectionTypeLoadException ex)
{
@ -39,7 +29,8 @@ namespace CppSharp.Types @@ -39,7 +29,8 @@ namespace CppSharp.Types
}
}
private void SetupTypeMaps(IEnumerable<System.Type> types, GeneratorKind generatorKind)
private void SetupTypeMaps(IEnumerable<System.Type> types,
GeneratorKind generatorKind, ASTContext astContext)
{
foreach (var type in types)
{
@ -49,6 +40,7 @@ namespace CppSharp.Types @@ -49,6 +40,7 @@ namespace CppSharp.Types
if (attr.GeneratorKind == 0 || attr.GeneratorKind == generatorKind)
{
var typeMap = (TypeMap) Activator.CreateInstance(type);
typeMap.ASTContext = astContext;
typeMap.TypeMapDatabase = this;
this.TypeMaps[attr.Type] = typeMap;
}

33
tests/CSharp/CSharp.cs

@ -109,11 +109,6 @@ namespace CppSharp.Tests @@ -109,11 +109,6 @@ namespace CppSharp.Tests
return GetEnumType(ctx.Type);
}
public override string CSharpSignature(TypePrinterContext ctx)
{
return CSharpSignatureType(ctx).ToString();
}
public override void CSharpMarshalToNative(CSharpMarshalContext ctx)
{
if (ctx.Parameter.Type.Desugar().IsAddress())
@ -161,12 +156,7 @@ namespace CppSharp.Tests @@ -161,12 +156,7 @@ namespace CppSharp.Tests
public override Type CSharpSignatureType(TypePrinterContext ctx)
{
return new TagType(new Enumeration());
}
public override string CSharpSignature(TypePrinterContext ctx)
{
return "Flags";
return new TagType(flags ?? (flags = ASTContext.FindEnum("Flags").First()));
}
public override void CSharpMarshalToNative(CSharpMarshalContext ctx)
@ -178,6 +168,8 @@ namespace CppSharp.Tests @@ -178,6 +168,8 @@ namespace CppSharp.Tests
{
ctx.Return.Write(ctx.ReturnVarName);
}
private Enumeration flags;
}
[TypeMap("QList")]
@ -195,7 +187,7 @@ namespace CppSharp.Tests @@ -195,7 +187,7 @@ namespace CppSharp.Tests
}
}
public override string CSharpSignature(TypePrinterContext ctx)
public override Type CSharpSignatureType(TypePrinterContext ctx)
{
if (ctx.Kind == TypePrinterContextKind.Native)
{
@ -203,13 +195,16 @@ namespace CppSharp.Tests @@ -203,13 +195,16 @@ namespace CppSharp.Tests
var specialization = type.GetClassTemplateSpecialization();
var typePrinter = new CSharpTypePrinter(null);
typePrinter.PushContext(TypePrinterContextKind.Native);
return string.Format($"{specialization.Visit(typePrinter)}{(Type.IsAddress() ? "*" : string.Empty)}", specialization.Visit(typePrinter),
Type.IsAddress() ? "*" : string.Empty);
return new CustomType(string.Format($@"{
specialization.Visit(typePrinter)}{
(Type.IsAddress() ? "*" : string.Empty)}", specialization.Visit(typePrinter),
Type.IsAddress() ? "*" : string.Empty));
}
return string.Format("System.Collections.Generic.{0}<{1}>",
ctx.MarshalKind == MarshalKind.DefaultExpression ? "List" : "IList",
ctx.GetTemplateParameterList());
return new CustomType(
$@"System.Collections.Generic.{
(ctx.MarshalKind == MarshalKind.DefaultExpression ? "List" : "IList")}<{
ctx.GetTemplateParameterList()}>");
}
public override void CSharpMarshalToNative(CSharpMarshalContext ctx)
@ -231,10 +226,10 @@ namespace CppSharp.Tests @@ -231,10 +226,10 @@ namespace CppSharp.Tests
[TypeMap("TypeMappedWithOperator")]
public class TypeMappedWithOperator : TypeMap
{
public override string CSharpSignature(TypePrinterContext ctx)
public override Type CSharpSignatureType(TypePrinterContext ctx)
{
// doesn't matter, we just need it to compile
return "int";
return new BuiltinType(PrimitiveType.Int);
}
public override void CSharpMarshalToNative(CSharpMarshalContext ctx)

9
tests/Common/Common.cs

@ -2,7 +2,6 @@ @@ -2,7 +2,6 @@
using CppSharp.AST;
using CppSharp.Generators;
using CppSharp.Generators.CSharp;
using CppSharp.Passes;
using CppSharp.Types;
using CppSharp.Utils;
@ -11,9 +10,9 @@ namespace CppSharp.Tests @@ -11,9 +10,9 @@ namespace CppSharp.Tests
[TypeMap("TypeMappedIndex")]
public class TypeMappedIndex : TypeMap
{
public override string CLISignature(TypePrinterContext ctx)
public override Type CLISignatureType(TypePrinterContext ctx)
{
return "unsigned short";
return new BuiltinType(PrimitiveType.UShort);
}
public override void CLIMarshalToManaged(MarshalContext ctx)
@ -26,9 +25,9 @@ namespace CppSharp.Tests @@ -26,9 +25,9 @@ namespace CppSharp.Tests
ctx.Return.Write("::TypeMappedIndex()");
}
public override string CSharpSignature(TypePrinterContext ctx)
public override Type CSharpSignatureType(TypePrinterContext ctx)
{
return "ushort";
return new BuiltinType(PrimitiveType.UShort);
}
public override void CSharpMarshalToManaged(CSharpMarshalContext ctx)

Loading…
Cancel
Save