public override AstNode Visit(DeleteRawArrayStatement node) { // Begin the node. builder.BeginNode(node); // Get the pointer. Expression pointer = node.GetPointer(); pointer.Accept(this); // Cast the pointer. IChelaType pointerType = pointer.GetNodeType(); IChelaType coercionType = node.GetCoercionType(); if(pointerType != coercionType) Cast(node, pointer.GetNodeValue(), pointerType, coercionType); // Delete the object. builder.CreateDeleteRawArray(); return builder.EndNode(); }
public override AstNode Visit(DeleteRawArrayStatement node) { // Get the pointer. Expression pointer = node.GetPointer(); pointer.Accept(this); // Get the pointer type. IChelaType pointerType = pointer.GetNodeType(); // Dereference the expression. if(pointerType.IsReference()) { ReferenceType refType = (ReferenceType)pointerType; pointerType = refType.GetReferencedType(); } // The expression must be a pointer expression. if(!pointerType.IsPointer()) Error(node, "cannot delete something without a pointer."); // Set the coercion type. node.SetCoercionType(pointerType); return node; }