Esempio n. 1
0
        public override AstNode Visit(ReinterpretCast node)
        {
            // Begin the node.
            builder.BeginNode(node);

            // Get the target type and value.
            //Expression target = node.GetTarget();
            Expression value = node.GetValue();

            // Visit them.
            //target.Accept(this);
            value.Accept(this);

            // Perform the coercion.
            IChelaType coercionType = node.GetCoercionType();
            IChelaType valueType = value.GetNodeType();
            if(coercionType != valueType)
                Cast(node, value.GetNodeValue(), valueType, coercionType, true);

            // Perform the reinterpret_cast.
            IChelaType targetType = node.GetNodeType();
            if(valueType != targetType)
                builder.CreateBitCast(targetType);

            return builder.EndNode();
        }