in SyntheticTypes/SynTypes.js [2011:2117]
function __evaluateStack(valStack, opStack)
{
while(opStack.length > 0)
{
var op = opStack.pop();
//*************************************************
// Unary:
//
if (valStack.length < 1)
{
throw new Error("Expected operand in expression");
}
var firstVal = valStack.pop();
if (op == __operators.UnaryOpNegative)
{
valStack.push(-firstVal);
continue;
}
else if (op == __operators.UnaryOpLogicalNot)
{
valStack.push(!firstVal);
continue;
}
//*************************************************
// Binary:
//
if (valStack.length < 1)
{
throw new Error("Expected operand in expression");
}
var secondVal = valStack.pop();
if (op == __operators.BinaryOpAdd)
{
valStack.push(secondVal + firstVal);
}
else if (op == __operators.BinaryOpSubtract)
{
valStack.push(secondVal - firstVal);
}
else if (op == __operators.BinaryOpMultiply)
{
valStack.push(secondVal * firstVal);
}
else if (op == __operators.BinaryOpDivide)
{
valStack.push(secondVal / firstVal);
}
else if (op == __operators.BinaryOpModulo)
{
valStack.push(secondVal % firstVal);
}
else if (op == __operators.BinaryOpLogicalAnd)
{
valStack.push(secondVal && firstVal);
}
else if (op == __operators.BinaryOpLogicalOr)
{
valStack.push(secondVal || firstVal);
}
else if (op == __operators.BinaryOpEqualCompare)
{
valStack.push(secondVal == firstVal);
}
else if (op == __operators.BinaryOpNotEqualCompare)
{
valStack.push(secondVal != firstval);
}
else if (op == __operators.BinaryOpLess)
{
valStack.push(secondVal < firstVal);
}
else if (op == __operators.BinaryOpLessEqual)
{
valStack.push(secondVal <= firstVal);
}
else if (op == __operators.BinaryOpGreater)
{
valStack.push(secondVal > firstVal);
}
else if (op == __operators.BinaryOpGreaterEqual)
{
valStack.push(secondVal >= firstVal);
}
else if (op == __operators.BinaryOpLeftShift)
{
valStack.push(secondVal << firstVal);
}
else if (op == __operators.BinaryOpRightShift)
{
valStack.push(secondVal >> firstVal);
}
continue;
}
if (opStack.length != 0 || valStack.length != 1)
{
throw new Error("Illegal expression");
}
return valStack.pop();
}