public SLAttribute(SLIdentifier name, CommaListElementCollection <SLBaseExpr> args, bool isSingleLine = false)
            : base(isSingleLine, false, isSingleLine)
        {
            Name = Exceptions.ThrowOnNull(name, nameof(name));
            Add(new SimpleElememt("@"));
            var stringRep = new StringBuilder(Name.Name);

            Add(Name);
            if (args != null)
            {
                Add(new SimpleElememt("("));
                Add(args);
                Add(new SimpleElememt(")"));
                stringRep.Append("(");
                foreach (var arg in args)
                {
                    if (arg is SLIdentifier argId)
                    {
                        stringRep.Append(argId.Name);
                    }
                }
                stringRep.Append(")");
            }
            StringRep = stringRep.ToString();
        }
Example #2
0
 public CSVariableDeclaration(CSType type, IEnumerable <CSBinding> bindings)
     : base(null, false, true)
 {
     Type = Exceptions.ThrowOnNull(type, "type");
     And(Type).And(SimpleElememt.Spacer);
     Bindings = new CommaListElementCollection <CSBinding> (Exceptions.ThrowOnNull(bindings, "bindings"));
     Add(Bindings);
 }
 public CSGenericConstraint(CSIdentifier name, IEnumerable <CSIdentifier> multiIs)
 {
     Name = Exceptions.ThrowOnNull(name, nameof(name));
     IsA  = new CommaListElementCollection <CSIdentifier> ();
     if (multiIs != null)
     {
         IsA.AddRange(multiIs);
     }
 }
Example #4
0
        public static CSLine ThrowLine <T> (T exType, string message) where T : Exception
        {
            CommaListElementCollection <CSBaseExpression> args = new CommaListElementCollection <CSBaseExpression> ();

            if (message != null)
            {
                args.Add(CSConstant.Val(message));
            }
            return(ThrowLine(exType, args));
        }
 public SLAttribute(SLIdentifier name, CommaListElementCollection <SLBaseExpr> args, bool isSingleLine = false)
     : base(isSingleLine, false, isSingleLine)
 {
     Name = Exceptions.ThrowOnNull(name, nameof(name));
     Add(new SimpleElememt("@"));
     Add(Name);
     if (args != null)
     {
         Add(new SimpleElememt("("));
         Add(args);
         Add(new SimpleElememt(")"));
     }
 }
 public CSListInitialized(CSType type, CommaListElementCollection <CSBaseExpression> initializers)
 {
     Type       = Exceptions.ThrowOnNull(type, "type");
     Parameters = Exceptions.ThrowOnNull(initializers, "initializers");
 }
 public CSArray1D(CSIdentifier name, CommaListElementCollection <CSBaseExpression> paramList)
 {
     Name       = Exceptions.ThrowOnNull(name, "name");
     Parameters = Exceptions.ThrowOnNull(paramList, "paramList");
 }
 public SLNamedClosureCall(SLBaseExpr closureExpr, CommaListElementCollection <SLBaseExpr> paramList)
 {
     Closure    = Exceptions.ThrowOnNull(closureExpr, "closure");
     Parameters = paramList ?? new CommaListElementCollection <SLBaseExpr> ();
 }
 public SLSubscriptExpr(SLIdentifier ident, CommaListElementCollection <SLBaseExpr> paramList)
 {
     Name       = Exceptions.ThrowOnNull(ident, nameof(ident));
     Parameters = Exceptions.ThrowOnNull(paramList, nameof(paramList));
 }
 public CSInitializer(IEnumerable <CSBaseExpression> parameters, bool appendNewlineAfterEach)
 {
     Parameters = new CommaListElementCollection <CSBaseExpression> ("", "", parameters, appendNewlineAfterEach);
 }
 public SLAttribute(string name, CommaListElementCollection <SLBaseExpr> args = null)
     : this(new SLIdentifier(name), args)
 {
 }
 public CSGenericConstraint(CSIdentifier name, CSIdentifier isA)
 {
     Name = Exceptions.ThrowOnNull(name, nameof(name));
     IsA  = new CommaListElementCollection <CSIdentifier> ();
     IsA.Add(Exceptions.ThrowOnNull(isA, nameof(isA)));
 }
Example #13
0
 public CSIndexExpression(CSBaseExpression aggregate, CommaListElementCollection <CSBaseExpression> paramList, bool addParensAroundAggregate)
 {
     AddParensAroundAggregate = addParensAroundAggregate;
     Aggregate  = Exceptions.ThrowOnNull(aggregate, "aggregate");
     Parameters = Exceptions.ThrowOnNull(paramList, "paramList");
 }
		public static CSFunctionCall Sizeof (CSBaseExpression expr)
		{
			CommaListElementCollection<CSBaseExpression> parms = new CommaListElementCollection<CSBaseExpression> ();
			parms.Add (expr);
			return new CSFunctionCall (iSizeof, parms, false);
		}
		public static CSFunctionCall Typeof (CSSimpleType t)
		{
			CommaListElementCollection<CSBaseExpression> parms = new CommaListElementCollection<CSBaseExpression> ();
			parms.Add (new CSIdentifier (t.Name));
			return new CSFunctionCall (iTypeof, parms, false);
		}
		public CSFunctionCall (CSIdentifier ident, CommaListElementCollection<CSBaseExpression> paramList, bool isConstructor = false)
		{
			Name = Exceptions.ThrowOnNull (ident, "ident");
			Parameters = Exceptions.ThrowOnNull (paramList, "paramList");
			IsConstructor = isConstructor;
		}
Example #17
0
 public static CSLine ThrowLine <T> (T exType, CommaListElementCollection <CSBaseExpression> args) where T : Exception
 {
     return(new CSLine(new CSThrow(new CSFunctionCall(new CSIdentifier(exType.GetType().Name), args, true))));
 }