Files
NapCatQQ/.pnpm-store/v3/files/ee/57bad6d393265d2957ccd375f80cd13f6ed420b3dad8bd85a606145f61ca140dcd63f4719b887204e32e3b6d7a940283b2695db533d577997643f39aeda4f5
T
TanTan e311ca3275
Build NapCat Artifacts / Type Check & Test (push) Waiting to run
docs: 仓库链接指向本镜像仓库
2026-11-13 09:25:58 +08:00

25 lines
767 B
Plaintext

'use strict';
var $TypeError = require('es-errors/type');
var SLOT = require('internal-slot');
// https://262.ecma-international.org/16.0/#sec-generatorvalidate
module.exports = function GeneratorValidate(generator, generatorBrand) {
SLOT.assert(generator, '[[GeneratorState]]'); // step 1
SLOT.assert(generator, '[[GeneratorBrand]]'); // step 2
var brand = SLOT.get(generator, '[[GeneratorBrand]]');
if (brand !== generatorBrand) {
throw new $TypeError('Assertion failed: generator brand is unexpected: ' + brand);
}
SLOT.assert(generator, '[[GeneratorContext]]'); // step 4
var state = SLOT.get(generator, '[[GeneratorState]]'); // step 5
if (state === 'EXECUTING') {
throw new $TypeError('generator is executing');
}
return state; // step 7
};