|
@@ -200,7 +200,9 @@ U32 IfStmtNode::compileStmt(CodeStream& codeStream, U32 ip)
|
|
|
U32 endifIp, elseIp;
|
|
|
addBreakLine(codeStream);
|
|
|
|
|
|
- if (testExpr->getPreferredType() == TypeReqUInt)
|
|
|
+ TypeReq testType = testExpr->getPreferredType();
|
|
|
+
|
|
|
+ if (testType == TypeReqUInt)
|
|
|
{
|
|
|
integer = true;
|
|
|
}
|
|
@@ -209,8 +211,16 @@ U32 IfStmtNode::compileStmt(CodeStream& codeStream, U32 ip)
|
|
|
integer = false;
|
|
|
}
|
|
|
|
|
|
- ip = testExpr->compile(codeStream, ip, integer ? TypeReqUInt : TypeReqFloat);
|
|
|
- codeStream.emit(integer ? OP_JMPIFNOT : OP_JMPIFFNOT);
|
|
|
+ if (testType == TypeReqString || testType == TypeReqNone)
|
|
|
+ {
|
|
|
+ ip = testExpr->compile(codeStream, ip, TypeReqString);
|
|
|
+ codeStream.emit(OP_JMPNOTSTRING);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ip = testExpr->compile(codeStream, ip, integer ? TypeReqUInt : TypeReqFloat);
|
|
|
+ codeStream.emit(integer ? OP_JMPIFNOT : OP_JMPIFFNOT);
|
|
|
+ }
|
|
|
|
|
|
if (elseBlock)
|
|
|
{
|