Beispiel #1
0
        public static CodeExpression ResultExpression(Mono.Build.Result r)
        {
            if (r == null)
            {
                throw new ArgumentNullException();
            }

            CodeObjectCreateExpression oce = new CodeObjectCreateExpression();

            if (r is MBString)
            {
                oce.CreateType = new CodeTypeReference(typeof(MBString));
                oce.Parameters.Add(new CodePrimitiveExpression(((MBString)r).Value));
            }
            else if (r is MBBool)
            {
                oce.CreateType = new CodeTypeReference(typeof(MBBool));
                oce.Parameters.Add(new CodePrimitiveExpression(((MBBool)r).Value));
            }
            else
            {
                throw ExHelp.InvalidOp("Don't know how to emit literal result {0}?", r);
            }

            return(oce);
        }