public override bool VisitClassDecl(Class @class)
        {
            if (!VisitDeclaration(@class))
            {
                return(false);
            }

            PushBlock(BlockKind.Class);
            GenerateClassSpecifier(@class);

            Write(" ");
            WriteStartBraceIndent();

            var hasNonInterfaceBase = @class.HasBaseClass && @class.BaseClass.IsGenerated &&
                                      [email protected];

            var objectIdent = SwiftGenerator.GeneratedIdentifier("object");

            if ([email protected] && [email protected] && !hasNonInterfaceBase)
            {
                TypePrinter.PushContext(TypePrinterContextKind.Native);
                var typeName = @class.Visit(TypePrinter);
                TypePrinter.PopContext();

                WriteLine($"public var {objectIdent} : {typeName}");
                NewLine();
            }

            VisitDeclContext(@class);
            WriteCloseBraceIndent();
            PopBlock(NewLineKind.BeforeNextBlock);

            return(true);
        }
Beispiel #2
0
        void HandleDecimalType()
        {
            var decimalId = SwiftGenerator.GeneratedIdentifier($"{Parameter.Name}_decimal");
            var @var      = IsByRefParameter ? "var" : "let";

            Before.WriteLine($"{@var} {decimalId} : MonoDecimal = mono_embeddinator_string_to_decimal(\"\")");

            var pointerId = "pointer";

            if (IsByRefParameter)
            {
                Before.WriteLine($"withUnsafeMutablePointer(to: &{decimalId}) {{ ({pointerId}) in");
                After.WriteLine("}");
            }

            Return.Write(IsByRefParameter ? pointerId : decimalId);
        }