mirror of
https://github.com/bendtherules/ask262.git
synced 2026-08-19 00:31:06 +00:00
Merge commit '6e92d2345e8231a44556ce7d416451f5f3e6c398' as 'engine262'
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import {
|
||||
Evaluate,
|
||||
} from '../evaluator.mts';
|
||||
import {
|
||||
Q,
|
||||
ThrowCompletion,
|
||||
} from '../completion.mts';
|
||||
import type { ParseNode } from '../parser/ParseNode.mts';
|
||||
import {
|
||||
GetValue,
|
||||
} from '#self';
|
||||
|
||||
/** https://tc39.es/ecma262/#sec-throw-statement-runtime-semantics-evaluation */
|
||||
// ThrowStatement : `throw` Expression `;`
|
||||
export function* Evaluate_ThrowStatement({ Expression }: ParseNode.ThrowStatement) {
|
||||
// 1. Let exprRef be the result of evaluating Expression.
|
||||
const exprRef = Q(yield* Evaluate(Expression));
|
||||
// 2. Let exprValue be ? GetValue(exprRef).
|
||||
const exprValue = Q(yield* GetValue(exprRef));
|
||||
// 3. Return ThrowCompletion(exprValue).
|
||||
return ThrowCompletion(exprValue);
|
||||
}
|
||||
Reference in New Issue
Block a user