Exemple #1
0
        public override void Write(SwiftWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            writer.Write("[");
            _elementType.Write(writer);
            writer.Write("]");
        }
Exemple #2
0
        public override void Write(SwiftWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            writer.Write(writer.IsEmittingSwift_12 ? "Set<" : "[");
            _elementType.Write(writer);
            writer.Write(writer.IsEmittingSwift_12 ? ">" : "]");
        }
        public override void Write(SwiftWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            writer.Write(this.Name);
        }
Exemple #4
0
        public override void Write(SwiftWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            this.InnerType.Write(writer);
            writer.Write(_implicitlyUnwrapped ? "!" : "?");
        }
Exemple #5
0
        public void WriteDeclaration(SwiftWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            SwiftComposite.WriteComment(1, writer, this.BriefComment);
            writer.Write("\t{0} {1}: ", _isConstant ? "let" : "var", this.Name);
            this.Type.Write(writer);
            writer.WriteLine();
        }
Exemple #6
0
        public void TestCleanup()
        {
            foreach (var tuple in _translator.GetCachedSwiftTypes())
            {
                var swiftType = tuple.Item1;
                var type      = tuple.Item2;

                _writer.Write(type, swiftType);
            }

            var swiftSource = _writer.ToString();
        }
Exemple #7
0
        protected void WriteDeclaration(SwiftWriter writer, bool forDefinition)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            writer.Write(this.Name);

            if (this.TypeParameterNames.Any())
            {
                var separator = "";

                writer.Write("<");

                foreach (var name in this.TypeParameterNames)
                {
                    writer.Write(separator);

                    var parameter = GetTypeParameter(name);

                    parameter.Write(writer);

                    if (forDefinition)
                    {
                        var constraint = GetTypeParameterConstraint(name);

                        if (constraint != null)
                        {
                            writer.Write(": ");
                            constraint.Write(writer);
                        }
                    }

                    separator = ", ";
                }

                writer.Write(">");
            }
        }
Exemple #8
0
        public void WriteDefinition(SwiftWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }

            WriteComment(0, writer, this.BriefComment);
            WriteKeyword(writer);
            writer.Write(" ");
            WriteDeclaration(writer, true);

            if (this.BaseType != null)
            {
                writer.Write(": ");
                this.BaseType.Write(writer);
            }

            writer.WriteLine(" {");
            WriteChildren(writer);
            writer.WriteLine("}");
        }
Exemple #9
0
 protected override void WriteKeyword(SwiftWriter writer)
 {
     writer.Write("enum");
 }