Modify the logic of "and" and "or" operator.
This commit is contained in:
@@ -107,8 +107,8 @@ namespace Cryville.Crtr {
|
|||||||
static readonly int _colop_and = IdentifierManager.Shared.Request("&");
|
static readonly int _colop_and = IdentifierManager.Shared.Request("&");
|
||||||
static readonly int _colop_or = IdentifierManager.Shared.Request("|");
|
static readonly int _colop_or = IdentifierManager.Shared.Request("|");
|
||||||
protected override bool Collapse(int name, PdtVariableMemory param) {
|
protected override bool Collapse(int name, PdtVariableMemory param) {
|
||||||
if (name == _colop_and) return param.Type == PdtInternalType.Number && param.AsNumber() <= 0;
|
if (name == _colop_and) return (param.Type == PdtInternalType.Number || param.Type == PdtInternalType.Vector) && param.AsNumber() <= 0;
|
||||||
else if (name == _colop_or) return param.Type != PdtInternalType.Number || param.AsNumber() > 0;
|
else if (name == _colop_or) return (param.Type != PdtInternalType.Number && param.Type != PdtInternalType.Vector) || param.AsNumber() > 0;
|
||||||
else throw new KeyNotFoundException(string.Format("Undefined collapse operator {0}", IdentifierManager.Shared.Retrieve(name)));
|
else throw new KeyNotFoundException(string.Format("Undefined collapse operator {0}", IdentifierManager.Shared.Retrieve(name)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user