Skip to content

Commit

Permalink
Remove manual indentation use
Browse files Browse the repository at this point in the history
  • Loading branch information
IsaacMarovitz committed Mar 18, 2024
1 parent 3d7598d commit f9c3155
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
5 changes: 0 additions & 5 deletions src/SharpMetal.Generator/CodeGenContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ public void WriteLine()
_sw.WriteLine();
}

public void Write(string str)
{
_sw.Write(str);
}

public void WriteLine(string str)
{
_sw.WriteLine(_indentation + str);
Expand Down
16 changes: 9 additions & 7 deletions src/SharpMetal.Generator/Instances/ObjectiveCInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,30 @@ public void Generate(CodeGenContext context)
{
context.WriteLine("[return: MarshalAs(UnmanagedType.Bool)]");
}
context.Write($"{context.Indentation}public static partial {Type} ");

var decleration = $"public static partial {Type} ";

if (Type != "void")
{
context.Write($"{Type}_");
decleration += $"{Type}_";
}

context.Write("objc_msgSend(IntPtr receiver, IntPtr selector");
decleration += "objc_msgSend(IntPtr receiver, IntPtr selector";

for (var i = 0; i < Inputs.Count; i++)
{
context.Write(", ");
decleration += ", ";

if (Inputs[i] == "bool")
{
context.Write("[MarshalAs(UnmanagedType.Bool)] ");
decleration += "[MarshalAs(UnmanagedType.Bool)] ";
}

context.Write($"{Inputs[i]} {VarNames[i]}");
decleration += $"{Inputs[i]} {VarNames[i]}";
}

context.Write(");\n");
decleration += ");";
context.WriteLine(decleration);
}

public bool Equals(ObjectiveCInstance? other)
Expand Down

0 comments on commit f9c3155

Please sign in to comment.