Example #1
0
 public SLFile(SLImportModules import)
 {
     Imports      = import ?? new SLImportModules();
     Declarations = new List <ICodeElement> ();
     Classes      = new SLClasses();
     Functions    = new List <SLFunc> ();
     Trailer      = new List <ICodeElement> ();
 }
Example #2
0
        public SLClass(Visibility vis, SLIdentifier name, IEnumerable <SLFunc> methods = null,
                       bool isStatic = false, bool isSealed = false, NamedType namedType = NamedType.Class)
        {
            // swift hates when you put public on an extension on a public type
            Visibility   = vis == Visibility.Public && namedType == NamedType.Extension ? Visibility.None : vis;
            IsStatic     = isStatic;
            IsSealed     = isSealed;
            NamedType    = namedType;
            Name         = Exceptions.ThrowOnNull(name, "name");
            Inheritance  = new SLInheritance();
            Fields       = new List <ICodeElement> ();
            Constructors = new List <SLFunc> ();
            Methods      = new List <SLFunc> ();
            Properties   = new List <SLProperty> ();
            InnerClasses = new SLClasses();
            Subscripts   = new List <SLSubscript> ();
            Generics     = new SLGenericTypeDeclarationCollection();

            if (methods != null)
            {
                Methods.AddRange(methods);
            }
        }