diff --git a/index.html b/index.html index 6dfa0f4..77715ee 100644 --- a/index.html +++ b/index.html @@ -2999,7 +2999,7 @@

Stage 3 Draft / November 20, 2024

Dynamic Code Brand Checks

+

Stage 3 Draft / November 27, 2024

Dynamic Code Brand Checks

1 HostGetCodeForEval ( argument )

@@ -3030,7 +3030,7 @@

2 HostEnsureCanCompileStrings ( calleeRealm

3 PerformEval ( x, strictCaller, direct )

The abstract operation PerformEval takes arguments x (an ECMAScript language value), strictCaller (a Boolean), and direct (direct-eval or indirect-eval) and returns either a normal completion containing an ECMAScript language value or a throw completion. It performs the following steps when called:

-
  1. Assert: If direct is indirect-eval, then strictCaller is also false.
  2. If x is a String, then
    1. Let xStr be x.
  3. Else if x is an Object, then
    1. Let code be HostGetCodeForEval(x).
    2. If code is a String, let xStr be code.
    3. Else, return x.
  4. Else,
    1. Return x.
  5. If x is not a String, return x.
  6. Let evalRealm be the current Realm Record.
  7. NOTE: In the case of a direct eval, evalRealm is the realm of both the caller of eval and of the eval function itself.
  8. Perform ? HostEnsureCanCompileStrings(evalRealm, « », x xStr, xStr, direct, « », x).
  9. ...
+
  1. Assert: If direct is indirect-eval, then strictCaller is also false.
  2. If x is a String, then
    1. Let xStr be x.
  3. Else if x is an Object, then
    1. Let code be HostGetCodeForEval(x).
    2. If code is a String, let xStr be code.
    3. Else, return x.
  4. Else,
    1. Return x.
  5. If x is not a String, return x.
  6. Let evalRealm be the current Realm Record.
  7. NOTE: In the case of a direct eval, evalRealm is the realm of both the caller of eval and of the eval function itself.
  8. Perform ? HostEnsureCanCompileStrings(evalRealm, « », x xStr, xStr, direct, « », x).
  9. Let inFunction be false.
  10. Let inMethod be false.
  11. Let inDerivedConstructor be false.
  12. Let inClassFieldInitializer be false.
  13. If direct is direct-eval, then
    1. Let thisEnvRec be GetThisEnvironment().
    2. If thisEnvRec is a Function Environment Record, then
      1. Let F be thisEnvRec.[[FunctionObject]].
      2. Set inFunction to true.
      3. Set inMethod to thisEnvRec.HasSuperBinding().
      4. If F.[[ConstructorKind]] is derived, set inDerivedConstructor to true.
      5. Let classFieldInitializerName be F.[[ClassFieldInitializerName]].
      6. If classFieldInitializerName is not empty, set inClassFieldInitializer to true.
  14. Perform the following substeps in an implementation-defined order, possibly interleaving parsing and error detection:
    1. Let script be ParseText(x xStr, Script).
  15. ...
diff --git a/spec.emu b/spec.emu index d34a8e6..5218f9c 100644 --- a/spec.emu +++ b/spec.emu @@ -81,6 +81,21 @@ contributors: Krzysztof Kotowicz, Mike Samuel, Luke Warlow 1. Let _evalRealm_ be the current Realm Record. 1. NOTE: In the case of a direct eval, _evalRealm_ is the realm of both the caller of `eval` and of the `eval` function itself. 1. Perform ? HostEnsureCanCompileStrings(_evalRealm_, « », _x_ _xStr_, _xStr_, _direct_, « », _x_).
+ 1. Let _inFunction_ be *false*. + 1. Let _inMethod_ be *false*. + 1. Let _inDerivedConstructor_ be *false*. + 1. Let _inClassFieldInitializer_ be *false*. + 1. If _direct_ is ~direct-eval~, then + 1. Let _thisEnvRec_ be GetThisEnvironment(). + 1. If _thisEnvRec_ is a Function Environment Record, then + 1. Let _F_ be _thisEnvRec_.[[FunctionObject]]. + 1. Set _inFunction_ to *true*. + 1. Set _inMethod_ to _thisEnvRec_.HasSuperBinding(). + 1. If _F_.[[ConstructorKind]] is ~derived~, set _inDerivedConstructor_ to *true*. + 1. Let _classFieldInitializerName_ be _F_.[[ClassFieldInitializerName]]. + 1. If _classFieldInitializerName_ is not ~empty~, set _inClassFieldInitializer_ to *true*. + 1. Perform the following substeps in an implementation-defined order, possibly interleaving parsing and error detection: + 1. Let _script_ be ParseText(_x_ _xStr_, |Script|). 1. ...