@next-core/cook 2.4.1 → 2.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/cook.js CHANGED
@@ -3,11 +3,21 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.__dev_only_clearGlobalExecutionContextStack = __dev_only_clearGlobalExecutionContextStack;
7
+ exports.__dev_only_getGlobalExecutionContextStack = __dev_only_getGlobalExecutionContextStack;
6
8
  exports.cook = cook;
7
9
  var _contextFree = require("./context-free.js");
8
10
  var _ExecutionContext = require("./ExecutionContext.js");
9
11
  var _sanitize = require("./sanitize.js");
10
12
  var _traverse = require("./traverse.js");
13
+ const globalExecutionContextStack = [];
14
+ function __dev_only_clearGlobalExecutionContextStack() {
15
+ globalExecutionContextStack.length = 0;
16
+ }
17
+ function __dev_only_getGlobalExecutionContextStack() {
18
+ return globalExecutionContextStack;
19
+ }
20
+
11
21
  /** For next-core internal usage only. */
12
22
  function cook(rootAst, codeSource, {
13
23
  rules,
@@ -442,7 +452,7 @@ function cook(rootAst, codeSource, {
442
452
  }
443
453
  } else if (declarator.id.type === "Identifier") {
444
454
  currentNode = declarator.init;
445
- if (debug) yield;
455
+ if (debug && currentNode.type !== "CallExpression" && currentNode.type !== "TaggedTemplateExpression") yield;
446
456
  const bindingId = declarator.id.name;
447
457
  const lhs = ResolveBinding(bindingId);
448
458
  let value;
@@ -455,7 +465,7 @@ function cook(rootAst, codeSource, {
455
465
  result = node.kind === "var" ? (0, _contextFree.PutValue)(lhs, value) : (0, _contextFree.InitializeReferencedBinding)(lhs, value);
456
466
  } else {
457
467
  currentNode = declarator.init;
458
- if (debug) yield;
468
+ if (debug && currentNode.type !== "CallExpression" && currentNode.type !== "TaggedTemplateExpression") yield;
459
469
  const rhs = yield* Evaluate(declarator.init);
460
470
  const rval = (0, _contextFree.GetValue)(rhs);
461
471
  result = yield* BindingInitialization(declarator.id, rval, node.kind === "var" ? undefined : getRunningContext().LexicalEnvironment);
@@ -1063,6 +1073,7 @@ function cook(rootAst, codeSource, {
1063
1073
  };
1064
1074
  }
1065
1075
  executionContextStack.pop();
1076
+ globalExecutionContextStack.pop();
1066
1077
  if (result.Type === "return") {
1067
1078
  return result.Value;
1068
1079
  }
@@ -1077,6 +1088,7 @@ function cook(rootAst, codeSource, {
1077
1088
  calleeContext.VariableEnvironment = localEnv;
1078
1089
  calleeContext.LexicalEnvironment = localEnv;
1079
1090
  executionContextStack.push(calleeContext);
1091
+ globalExecutionContextStack.push(calleeContext);
1080
1092
  return calleeContext;
1081
1093
  }
1082
1094
  function OrdinaryCallBindThis(F, calleeContext, thisArgument) {