示例#1
0
        private HLLocation ProcessLogicalNotExpression(ILogicalNot pExpression)
        {
            HLLocation locationOperand   = ProcessExpression(pExpression.Operand);
            HLLocation locationTemporary = HLTemporaryLocation.Create(CreateTemporary(HLDomain.GetOrCreateType(pExpression.Type)));

            mCurrentBlock.EmitBitwiseXor(locationTemporary, locationOperand, HLBooleanLiteralLocation.Create(true));
            return(locationTemporary);
        }
示例#2
0
 private HLLocation ProcessCompileTimeConstantExpression(ICompileTimeConstant pExpression)
 {
     if (pExpression.Value == null)
     {
         return(HLNullLocation.Create(HLDomain.GetOrCreateType(pExpression.Type)));
     }
     if (pExpression.Type.ResolvedType.IsEnum)
     {
         return(HLEnumLiteralLocation.Create(HLDomain.GetOrCreateType(pExpression.Type), pExpression.Value.ToString()));
     }
     if (pExpression.Value is bool)
     {
         return(HLBooleanLiteralLocation.Create((bool)pExpression.Value));
     }
     if (pExpression.Value is sbyte)
     {
         return(HLInt8LiteralLocation.Create((sbyte)pExpression.Value));
     }
     if (pExpression.Value is byte)
     {
         return(HLUInt8LiteralLocation.Create((byte)pExpression.Value));
     }
     if (pExpression.Value is char)
     {
         return(HLCharLiteralLocation.Create((char)pExpression.Value));
     }
     if (pExpression.Value is short)
     {
         return(HLInt16LiteralLocation.Create((short)pExpression.Value));
     }
     if (pExpression.Value is ushort)
     {
         return(HLUInt16LiteralLocation.Create((ushort)pExpression.Value));
     }
     if (pExpression.Value is float)
     {
         return(HLFloat32LiteralLocation.Create((float)pExpression.Value));
     }
     if (pExpression.Value is int)
     {
         return(HLInt32LiteralLocation.Create((int)pExpression.Value));
     }
     if (pExpression.Value is uint)
     {
         return(HLUInt32LiteralLocation.Create((uint)pExpression.Value));
     }
     if (pExpression.Value is double)
     {
         return(HLFloat64LiteralLocation.Create((double)pExpression.Value));
     }
     if (pExpression.Value is long)
     {
         return(HLInt64LiteralLocation.Create((long)pExpression.Value));
     }
     if (pExpression.Value is ulong)
     {
         return(HLUInt64LiteralLocation.Create((ulong)pExpression.Value));
     }
     if (pExpression.Value is string)
     {
         return(HLStringLiteralLocation.Create((string)pExpression.Value));
     }
     throw new NotSupportedException();
 }