archives

« Bugzilla Issues Index

#674 — [11.11 Binary Logical Operators] step 4 always returns a boolean value instead of the lhs operand


Step 4 always returns a boolean value, cf. step 2:
---
1. Let lref be the result of evaluating LogicalANDExpression.
2. Let lval be ToBoolean(GetValue(lref)).
3. ReturnIfAbrupt(lval).
4. If lval is false, return lval.
5. Let rref be the result of evaluating BitwiseORExpression.
6. Return GetValue(rref).
---

Two additional algorithm steps may be necessary:

---
1. Let lref be the result of evaluating LogicalANDExpression.
2. Let lval be GetValue(lref).
3. ReturnIfAbrupt(lval).
*NEW* 4. Let lbool be ToBoolean(lval).
*NEW* 5. ReturnIfAbrupt(lbool).
6. If lbool is false, return lval.
7. Let rref be the result of evaluating BitwiseORExpression.
8. Return GetValue(rref).
---


Same applies to LogicalORExpression.


corrected in rev 11 editor's draft


in October 26, 2012 release draft