Beispiel #1
0
 /// <summary>
 /// Constructs instance of this class with given parameters.
 /// </summary>
 /// <param name="name">Name of the interface method.</param>
 /// <param name="returnType">Return type of the method. <c>null</c> if method does not return anything.</param>
 /// <param name="owner">Interface containing this method.</param>
 public InterfaceMethodDef([NotNull] String name, [CanBeNull] Type returnType, [NotNull] InterfaceDef owner, [CanBeNull, ItemNotNull] List <String> comments = null)
     : base(name, comments)
 {
     ReturnType = returnType;
     Owner      = owner;
     Parameters = new List <FormalParameterDef>();
     FullName   = $"{owner.FullName}.{name}";
 }
Beispiel #2
0
        private static void SaveInterface(InterfaceDef interfaceDef, CodeWriter writer)
        {
            SaveComments(interfaceDef, writer);
            SaveDecorators(interfaceDef, writer);

            writer.Write("interface {0} ", interfaceDef.Name);
            if (interfaceDef.SuperInterfaces.Count > 0)
            {
                writer.Write(": {0}", interfaceDef.SuperInterfaces[0].Name);
                foreach (InterfaceDef superInterfaceDef in interfaceDef.SuperInterfaces.Skip(1))
                {
                    writer.Write(", {0}", superInterfaceDef.Name);
                }
            }
            writer.Write(" {");
            writer.Indent();

            SaveTypeScope(interfaceDef, writer);

            if (interfaceDef.Properties.Count > 0)
            {
                writer.NewLine();
                for (Int32 index = 0; index < interfaceDef.Properties.Count; index += 1)
                {
                    InterfacePropertyDef propertyDef = interfaceDef.Properties[index];
                    SaveComments(propertyDef, writer);
                    SaveDecorators(propertyDef, writer);

                    if (propertyDef.IsOverride)
                    {
                        writer.Write("override ");
                    }
                    writer.Write("{0} {1}", propertyDef.Type, propertyDef.Name);
                    if (propertyDef.IsReadable)
                    {
                        writer.Write(" get");
                    }
                    if (propertyDef.IsWritable)
                    {
                        writer.Write(" set");
                    }
                    writer.WriteLine(";");
                    if (index + 1 < interfaceDef.Properties.Count)
                    {
                        writer.NewLine();
                    }
                }
            }

            writer.Dedent();
            writer.WriteLine("}");
        }
Beispiel #3
0
 public TypeInterface(InterfaceDef definition)
     : base(TypeKind.Interface)
 {
     Definition = definition;
 }