first commit
This commit is contained in:
62
build/node_modules/prepack/lib/evaluators/BlockStatement.js
generated
vendored
Normal file
62
build/node_modules/prepack/lib/evaluators/BlockStatement.js
generated
vendored
Normal file
@@ -0,0 +1,62 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
|
||||
exports.default = function (ast, strictCode, env, realm) {
|
||||
// 1. Let oldEnv be the running execution context's LexicalEnvironment.
|
||||
var oldEnv = realm.getRunningContext().lexicalEnvironment;
|
||||
|
||||
// 2. Let blockEnv be NewDeclarativeEnvironment(oldEnv).
|
||||
var blockEnv = _singletons.Environment.NewDeclarativeEnvironment(realm, oldEnv);
|
||||
|
||||
// 3. Perform BlockDeclarationInstantiation(StatementList, blockEnv).
|
||||
_singletons.Environment.BlockDeclarationInstantiation(realm, strictCode, ast.body, blockEnv);
|
||||
|
||||
// 4. Set the running execution context's LexicalEnvironment to blockEnv.
|
||||
realm.getRunningContext().lexicalEnvironment = blockEnv;
|
||||
|
||||
try {
|
||||
// 5. Let blockValue be the result of evaluating StatementList.
|
||||
var blockValue = void 0;
|
||||
|
||||
if (ast.directives) {
|
||||
var _iteratorNormalCompletion = true;
|
||||
var _didIteratorError = false;
|
||||
var _iteratorError = undefined;
|
||||
|
||||
try {
|
||||
for (var _iterator = ast.directives[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
||||
var directive = _step.value;
|
||||
|
||||
blockValue = new _index.StringValue(realm, directive.value.value);
|
||||
}
|
||||
} catch (err) {
|
||||
_didIteratorError = true;
|
||||
_iteratorError = err;
|
||||
} finally {
|
||||
try {
|
||||
if (!_iteratorNormalCompletion && _iterator.return) {
|
||||
_iterator.return();
|
||||
}
|
||||
} finally {
|
||||
if (_didIteratorError) {
|
||||
throw _iteratorError;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return _singletons.Functions.EvaluateStatements(ast.body, blockValue, strictCode, blockEnv, realm);
|
||||
} finally {
|
||||
// 6. Set the running execution context's LexicalEnvironment to oldEnv.
|
||||
realm.getRunningContext().lexicalEnvironment = oldEnv;
|
||||
realm.onDestroyScope(blockEnv);
|
||||
}
|
||||
};
|
||||
|
||||
var _index = require("../values/index.js");
|
||||
|
||||
var _singletons = require("../singletons.js");
|
||||
//# sourceMappingURL=BlockStatement.js.map
|
||||
Reference in New Issue
Block a user