Experimental idea - create facility to enable internal commands within JS #6440
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces the concept of an internal command, something that could be used in self-hosted JS and in testing environments to pass a command to the engine within a JS file that is not normal JS.
This is illustrated with an example that allows the use of the bytecode operation for object coercion within the JsBuiltins instead of calling the object constructor to accomplish the same.
Broader use of this feature would require implementing specific commands for it to make use of which could include both facilities for JsBuiltins we don't wish to use runtime methods for AND potentially testing features.
Opened as a draft PR at the moment for comment consideration - aware it would need some tidy up pre-merge; also should probably not be merged without a bigger use case than object coercion.
Currently this does the folowing:
@@
within a script, currently it can recognise @@Conv_Obj and @@Conv_Num - though the later is useless (it's resultant bytecode is identical to a unary plus) .