| 274 | // Node that applies selected operation on value on top of the stack |
| 275 | |
| 276 | NodeUnaryOp::NodeUnaryOp(CmdID cmd, unsigned int argument) |
| 277 | { |
| 278 | // Unary operation |
| 279 | vmCmd.cmd = cmd; |
| 280 | vmCmd.argument = argument; |
| 281 | |
| 282 | first = TakeLastNode(); |
| 283 | // Resulting type is the same as source type with exception for logical NOT |
| 284 | bool logicalOp = cmd == cmdLogNot; |
| 285 | typeInfo = logicalOp ? typeBool : first->typeInfo; |
| 286 | |
| 287 | if(cmd != cmdCheckedRet && ((first->typeInfo->refLevel != 0 && !logicalOp) || (first->typeInfo->type == TypeInfo::TYPE_COMPLEX && first->typeInfo != typeObject) || (!logicalOp && first->typeInfo == typeBool) || first->typeInfo->type == TypeInfo::TYPE_VOID)) |
| 288 | ThrowError(CodeInfo::lastKnownStartPos, "ERROR: unary operation '%s' is not supported on '%s'", unaryCommandToText[cmd - cmdNeg], first->typeInfo->GetFullTypeName()); |
| 289 | |
| 290 | nodeType = typeNodeUnaryOp; |
| 291 | |
| 292 | parentFunc = NULL; |
| 293 | } |
| 294 | NodeUnaryOp::~NodeUnaryOp() |
| 295 | { |
| 296 | } |
nothing calls this directly
no test coverage detected