Merge commit '6e92d2345e8231a44556ce7d416451f5f3e6c398' as 'engine262'

This commit is contained in:
2026-03-27 10:07:29 +05:30
433 changed files with 90478 additions and 0 deletions
@@ -0,0 +1,25 @@
import { Value } from '../value.mts';
import { Evaluate, type ValueEvaluator } from '../evaluator.mts';
import { Q, X } from '../completion.mts';
import type { ParseNode } from '../parser/ParseNode.mts';
import { GetValue, ToBoolean } from '#self';
/** https://tc39.es/ecma262/#sec-binary-logical-operators-runtime-semantics-evaluation */
// LogicalORExpression :
// LogicalORExpression `||` LogicalANDExpression
export function* Evaluate_LogicalORExpression({ LogicalORExpression, LogicalANDExpression }: ParseNode.LogicalORExpression): ValueEvaluator {
// 1. Let lref be the result of evaluating LogicalORExpression.
const lref = Q(yield* Evaluate(LogicalORExpression));
// 2. Let lval be ? GetValue(lref).
const lval = Q(yield* GetValue(lref));
// 3. Let lbool be ! ToBoolean(lval).
const lbool = X(ToBoolean(lval));
// 4. If lbool is false, return lval.
if (lbool === Value.true) {
return lval;
}
// 5. Let rref be the result of evaluating LogicalANDExpression.
const rref = Q(yield* Evaluate(LogicalANDExpression));
// 6. Return ? GetValue(rref).
return Q(yield* GetValue(rref));
}