Add %raw syntax for fixed external arguments - #8609
Draft
cknitt wants to merge 1 commit into
Draft
Conversation
Signed-off-by: Christoph Knittel <ck@cca.io>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
Introduce a dedicated parsetree representation and new syntax for fixed external arguments.
Previously, fixed values were expressed using an
@asattribute on a wildcard type:They can now be written using the familiar
%rawextension syntax:The
%rawpayload must be a string containing a JavaScript literal. Non-interpolated template strings are also supported, which is convenient for JavaScript string values:Compatibility
Existing fixed-value forms continue to parse:
They now:
%raw(...)syntax.The
jsontag no longer has a special string-literal representation in the AST. Outside this compatibility path,jsontemplates behave like ordinary tagged template strings.Implementation
Fixed external arguments are represented explicitly as
Parg_fixed, containing the raw JavaScript source and argument metadata. The representation is handled across AST traversal, mapping, analysis, type checking, external processing, and printing.The frozen v0 parsetree remains unchanged. The existing AST mapping bridge converts fixed arguments to and from a compatible v0 representation.
Testing
Added and updated coverage for:
%rawstring and template-string payloads;make test, syntax tests, and syntax round-trip tests pass.