UNPKG

prepack

Version:

Execute a JS bundle, serialize global state and side effects to a snapshot that can be quickly restored.

55 lines (41 loc) 1.92 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = _default; var _completions = require("../../completions.js"); var _index = require("../../values/index.js"); var _generator = require("../../methods/generator.js"); /** * Copyright (c) 2017-present, Facebook, Inc. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. An additional grant * of patent rights can be found in the PATENTS file in the same directory. */ /* strict-local */ function _default(realm, obj) { // ECMA262 25.3.1.2 obj.defineNativeMethod("next", 1, (context, [value]) => { // 1. Let g be the this value. let g = context; // 2. Return ? GeneratorResume(g, value). return (0, _generator.GeneratorResume)(realm, g, value); }); // ECMA262 25.3.1.3 obj.defineNativeMethod("return", 1, (context, [value]) => { // 1. Let g be the this value. let g = context; // 2. Let C be Completion{[[Type]]: return, [[Value]]: value, [[Target]]: empty}. let C = new _completions.ReturnCompletion(value, realm.currentLocation); // 3. Return ? GeneratorResumeAbrupt(g, C). return (0, _generator.GeneratorResumeAbrupt)(realm, g, C); }); // ECMA262 25.3.1.4 obj.defineNativeMethod("throw", 1, (context, [exception]) => { // 1. Let g be the this value. let g = context; // 2. Let C be Completion{[[Type]]: throw, [[Value]]: exception, [[Target]]: empty}. let C = new _completions.ReturnCompletion(exception, realm.currentLocation); // 3. Return ? GeneratorResumeAbrupt(g, C). return (0, _generator.GeneratorResumeAbrupt)(realm, g, C); }); // ECMA262 25.3.1.5 obj.defineNativeProperty(realm.intrinsics.SymbolToStringTag, new _index.StringValue(realm, "Generator"), { writable: false }); } //# sourceMappingURL=GeneratorPrototype.js.map