From 488b6fd6e5c258e60f15e3ec1225d602a966af31 Mon Sep 17 00:00:00 2001 From: Luke Warlow Date: Thu, 2 May 2024 13:23:32 +0100 Subject: [PATCH] Revert removal of codeString from HostEnsureCanCompileStrings --- README.md | 13 ++++++++++++- index.html | 21 +++++++++++---------- spec.emu | 23 ++++++++++++++++++----- 3 files changed, 41 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 99fda61..66c8ca4 100644 --- a/README.md +++ b/README.md @@ -7,6 +7,7 @@ - [Motivation](#motivation) - [Problem 1: %eval% does not accept objects in lieu of strings for code](#problem-1-eval-does-not-accept-objects-in-lieu-of-strings-for-code) - [Problem 2: Host callout does not receive type information](#problem-2-host-callout-does-not-receive-type-information) +- [Problem 3: Host callout does not receive the full code to check](#problem-3-host-callout-does-not-receive-the-full-code-to-check) - [Tests](#tests) ## Status @@ -18,7 +19,7 @@ Spec: [ecmarkup output][draft spec], [source][] ## TL;DR -Allow hosts to create _code-like_ objects and change _HostEnsureCanCompileStrings( calleeRealm, parameterStrings, bodyString, direct )_ to _HostEnsureCanCompileStrings( calleeRealm, parameterStrings, bodyString, compilationType, parameterArgs, bodyArg )_. +Allow hosts to create _code-like_ objects and change _HostEnsureCanCompileStrings( calleeRealm, parameterStrings, bodyString, direct )_ to _HostEnsureCanCompileStrings( calleeRealm, parameterStrings, bodyString, codeString, compilationType, parameterArgs, bodyArg )_. ## Motivation @@ -168,6 +169,16 @@ the Function constructor arguments. - Requires changes to the host callout (see also below): - Complex host interface; Requires passing objects to the host. +## Problem 3: Host callout does not receive the full code to check + +`HostEnsureCanCompileStrings` is called with parameters for the source code, but they're not in a unified string. + +### Solution + +This proposal updates the host callout to contain the full code string to be executed, +and moves the callout in `CreateDynamicFunction` after the function body is +assembled. + ## Tests Related tests at diff --git a/index.html b/index.html index a8ec112..2fbdc60 100644 --- a/index.html +++ b/index.html @@ -1554,7 +1554,7 @@ }); let sdoMap = JSON.parse(`{}`); -let biblio = JSON.parse(`{"refsByClause":{"sec-performeval":["_ref_0","_ref_1"],"sec-createdynamicfunction":["_ref_2"],"sec-host-hooks-summary":["_ref_3"]},"entries":[{"type":"op","aoid":"HostGetCodeForEval","refId":"sec-hostgetcodeforeval"},{"type":"clause","id":"sec-hostgetcodeforeval","title":"HostGetCodeForEval ( argument )","titleHTML":"HostGetCodeForEval ( argument )","number":"1","referencingIds":["_ref_0","_ref_3"]},{"type":"op","aoid":"HostEnsureCanCompileStrings","refId":"sec-hostensurecancompilestrings"},{"type":"clause","id":"sec-hostensurecancompilestrings","title":"HostEnsureCanCompileStrings ( calleeRealm, parameterStrings, bodyString, direct, compilationType, parameterArgs, bodyArg )","titleHTML":"HostEnsureCanCompileStrings ( calleeRealm, parameterStrings, bodyString, direct, compilationType, parameterArgs, bodyArg )","number":"2","referencingIds":["_ref_1","_ref_2"]},{"type":"op","aoid":"PerformEval","refId":"sec-performeval"},{"type":"clause","id":"sec-performeval","title":"PerformEval ( x, strictCaller, direct )","titleHTML":"PerformEval ( x, strictCaller, direct )","number":"3"},{"type":"op","aoid":"CreateDynamicFunction","refId":"sec-createdynamicfunction"},{"type":"clause","id":"sec-createdynamicfunction","title":"CreateDynamicFunction ( constructor, newTarget, kind, parameterArgs, bodyArg )","titleHTML":"CreateDynamicFunction ( constructor, newTarget, kind, parameterArgs, bodyArg )","number":"4"},{"type":"clause","id":"sec-host-hooks-summary","titleHTML":"Host Hooks","number":"A.1"},{"type":"clause","id":"sec-host-layering-points","titleHTML":"Host Layering Points","number":"A"}]}`); +let biblio = JSON.parse(`{"refsByClause":{"sec-performeval":["_ref_0","_ref_1"],"sec-createdynamicfunction":["_ref_2","_ref_3"],"sec-host-hooks-summary":["_ref_4"]},"entries":[{"type":"op","aoid":"HostGetCodeForEval","refId":"sec-hostgetcodeforeval"},{"type":"clause","id":"sec-hostgetcodeforeval","title":"HostGetCodeForEval ( argument )","titleHTML":"HostGetCodeForEval ( argument )","number":"1","referencingIds":["_ref_0","_ref_4"]},{"type":"op","aoid":"HostEnsureCanCompileStrings","refId":"sec-hostensurecancompilestrings"},{"type":"clause","id":"sec-hostensurecancompilestrings","title":"HostEnsureCanCompileStrings ( calleeRealm, parameterStrings, bodyString, direct, codeString, compilationType, parameterArgs, bodyArg )","titleHTML":"HostEnsureCanCompileStrings ( calleeRealm, parameterStrings, bodyString, direct, codeString, compilationType, parameterArgs, bodyArg )","number":"2","referencingIds":["_ref_1","_ref_2","_ref_3"]},{"type":"op","aoid":"PerformEval","refId":"sec-performeval"},{"type":"clause","id":"sec-performeval","title":"PerformEval ( x, strictCaller, direct )","titleHTML":"PerformEval ( x, strictCaller, direct )","number":"3"},{"type":"op","aoid":"CreateDynamicFunction","refId":"sec-createdynamicfunction"},{"type":"clause","id":"sec-createdynamicfunction","title":"CreateDynamicFunction ( constructor, newTarget, kind, parameterArgs, bodyArg )","titleHTML":"CreateDynamicFunction ( constructor, newTarget, kind, parameterArgs, bodyArg )","number":"4"},{"type":"clause","id":"sec-host-hooks-summary","titleHTML":"Host Hooks","number":"A.1"},{"type":"clause","id":"sec-host-layering-points","titleHTML":"Host Layering Points","number":"A"}]}`); ;let usesMultipage = false