Skip to content

Commit

Permalink
Fixed error
Browse files Browse the repository at this point in the history
  • Loading branch information
zillemarco committed Oct 12, 2017
1 parent 41de24c commit db2e796
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/Generator/Generators/CSharp/CSharpMarshal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ public override bool VisitPointerType(PointerType pointer, TypeQualifiers quals)
return true;
}

if (finalPointee.IsPrimitiveType(out PrimitiveType primitive) || finalPointee.IsEnumType())
PrimitiveType primitive;
if (finalPointee.IsPrimitiveType(out primitive) || finalPointee.IsEnumType())
{
if (isRefParam)
{
Expand Down Expand Up @@ -267,7 +268,8 @@ public override bool VisitTypedefType(TypedefType typedef, TypeQualifiers quals)

var decl = typedef.Declaration;

if (decl.Type is FunctionType functionType || decl.Type.IsPointerTo(out functionType))
var functionType = decl.Type as FunctionType;
if (functionType != null || decl.Type.IsPointerTo(out functionType))
{
var ptrName = Generator.GeneratedIdentifier("ptr") +
Context.ParameterIndex;
Expand Down Expand Up @@ -595,7 +597,9 @@ public override bool VisitPointerType(PointerType pointer, TypeQualifiers quals)
var param = Context.Parameter;
var isRefParam = param != null && (param.IsInOut || param.IsOut);
var finalPointee = pointer.GetFinalPointee();
bool finalPointeeIsPrimitiveType = finalPointee.IsPrimitiveType(out PrimitiveType primitive);

PrimitiveType primitive;
bool finalPointeeIsPrimitiveType = finalPointee.IsPrimitiveType(out primitive);

if (CSharpTypePrinter.IsConstCharString(pointee) && isRefParam)
{
Expand Down

0 comments on commit db2e796

Please sign in to comment.