protected override object __GetConstantValue(IConstantResolver IConstantResolver)
            {
#if true
                throw (new InvalidOperationException("A ExpressionCommaList is not a constant value"));
#else
                return(Expressions.Last().GetConstantValue());
#endif
            }
            protected override object __GetConstantValue(IConstantResolver IConstantResolver)
            {
                //return CSimpleType.GetSize();
                //throw new NotImplementedException();
                var CType = this.Expression.GetCachedCType(null);

                return((CType != null) ? CType.GetSize(null) : null);
            }
 protected override object __GetConstantValue(IConstantResolver IConstantResolver)
 {
     if (CType is CSimpleType)
     {
         return((CType as CSimpleType).GetSize(null));
     }
     //return CSimpleType.GetSize();
     return(null);
 }
 public object GetCachedConstantValue(IConstantResolver Resolver)
 {
     if (__Cached_IConstantResolver != Resolver)
     {
         __Cached_IConstantResolver = Resolver;
         __Cached_IConstantResolver_ConstantValue = __GetConstantValue(Resolver);
     }
     return(__Cached_IConstantResolver_ConstantValue);
 }
            public TType GetConstantValue <TType>(IConstantResolver IConstantResolver)
            {
                var Value = __GetConstantValue(IConstantResolver);

                if (Value == null)
                {
                    Console.Error.WriteLine("Can't cast ConstantValue [{0}] to <{1}>", this.GetType(), typeof(TType));
                    return(default(TType));
                }
                return((TType)Value);
            }
            protected override object __GetConstantValue(IConstantResolver IConstantResolver)
            {
                var RightValue = Right.GetCachedConstantValue(IConstantResolver);

                switch (Operator)
                {
                case "-": return(-((dynamic)RightValue));

                default:
                    throw (new NotImplementedException(String.Format("Not implemented constant unary operator '{0}'", Operator)));
                }
            }
            protected override object __GetConstantValue(IConstantResolver IConstantResolver)
            {
                if (IConstantResolver == null)
                {
                    return(null);
                }
                //var Value = Scope.FindSymbol(Identifier).ConstantValue;
                var Value = IConstantResolver.GetConstantIdentifier(Identifier);

                if (Value == null)
                {
                    //throw (new InvalidOperationException("A IdentifierExpression is not a constant value"));
                    //return null;
                }
                return(Value);
            }
            protected override object __GetConstantValue(IConstantResolver IConstantResolver)
            {
                var LeftValue  = Left.GetCachedConstantValue(IConstantResolver);
                var RightValue = Right.GetCachedConstantValue(IConstantResolver);

                if (LeftValue == null)
                {
                    return(null);
                }
                if (RightValue == null)
                {
                    return(null);
                }

                switch (Operator)
                {
                case "+": return((object)((dynamic)LeftValue + (dynamic)RightValue));

                case "-": return((object)((dynamic)LeftValue - (dynamic)RightValue));

                case "*": return((object)((dynamic)LeftValue * (dynamic)RightValue));

                case "/": return((object)((dynamic)LeftValue / (dynamic)RightValue));

                case "%": return((object)((dynamic)LeftValue % (dynamic)RightValue));

                case "==": return((bool)((dynamic)LeftValue == (dynamic)RightValue));

                case "!=": return((bool)((dynamic)LeftValue != (dynamic)RightValue));

                case "<": return((bool)((dynamic)LeftValue < (dynamic)RightValue));

                case ">": return((bool)((dynamic)LeftValue > (dynamic)RightValue));

                case "<=": return((bool)((dynamic)LeftValue <= (dynamic)RightValue));

                case ">=": return((bool)((dynamic)LeftValue >= (dynamic)RightValue));

                case "&&": return((bool)((bool)LeftValue && (bool)RightValue));

                case "||": return((bool)((bool)LeftValue || (bool)RightValue));

                default:
                    throw (new NotImplementedException(String.Format("Not implemented constant binary operator '{0}'", Operator)));
                }
            }
 protected override object __GetConstantValue(IConstantResolver IConstantResolver)
 {
     throw new NotImplementedException();
 }
 protected override object __GetConstantValue(IConstantResolver IConstantResolver)
 {
     //throw (new InvalidOperationException("A FunctionCallExpression is not a constant value"));
     return(null);
 }
 protected override object __GetConstantValue(IConstantResolver IConstantResolver)
 {
     throw (new InvalidOperationException("An ArrayAccessExpression is not a constant value"));
 }
 protected override object __GetConstantValue(IConstantResolver IConstantResolver)
 {
     return(Value);
 }
 abstract protected object __GetConstantValue(IConstantResolver IConstantResolver);
예제 #14
0
			protected override object __GetConstantValue(IConstantResolver IConstantResolver)
			{
				return Expression.GetCachedConstantValue(IConstantResolver);
			}
예제 #15
0
 protected override object __GetConstantValue(IConstantResolver IConstantResolver)
 {
     return Expression.GetCachedConstantValue(IConstantResolver);
 }