🐐 Conditions have to be bools
This commit is contained in:
@@ -679,6 +679,8 @@ class SiStatement(Node):
|
||||
|
||||
def _eval(self, vtable):
|
||||
vtable, cond = self.test.eval(vtable)
|
||||
if not isinstance(cond, ValBool):
|
||||
raise CentvrionError("SI condition must be a boolean")
|
||||
last_val = ValNul()
|
||||
if cond:
|
||||
for statement in self.statements:
|
||||
@@ -714,6 +716,8 @@ class DumStatement(Node):
|
||||
def _eval(self, vtable):
|
||||
last_val = ValNul()
|
||||
vtable, cond = self.test.eval(vtable)
|
||||
if not isinstance(cond, ValBool):
|
||||
raise CentvrionError("DVM condition must be a boolean")
|
||||
while not cond:
|
||||
for statement in self.statements:
|
||||
vtable, val = statement.eval(vtable)
|
||||
@@ -726,6 +730,8 @@ class DumStatement(Node):
|
||||
if vtable["#return"] is not None:
|
||||
break
|
||||
vtable, cond = self.test.eval(vtable)
|
||||
if not isinstance(cond, ValBool):
|
||||
raise CentvrionError("DVM condition must be a boolean")
|
||||
return vtable, last_val
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user