Open
Conversation
hgoldstein
requested changes
Mar 3, 2026
Contributor
hgoldstein
left a comment
There was a problem hiding this comment.
Do we need to freeze the table made in the constructor for AstSerialize? What about the location structs? Mainly I think you need to handle incomplete ASTs.
One question I have is: how bad would it be if we "deep froze" the table at the very end? Just recurse through the table itself rather than freeze at every junction when serializing.
| luaL_error(L, "parsing failed:\n%s", fullError.c_str()); | ||
| } | ||
|
|
||
| lua_rawcheckstack(L, 1); |
|
|
||
| // For correct trivia computation, everything must end up going through serializeToken | ||
| void serializeToken(Luau::Position position, const char* text, int nrec = 0) | ||
| void serializeToken(Luau::Position position, const char* text, int nrec = 0, bool freezeToken = true) |
Contributor
There was a problem hiding this comment.
Why do we have an extra argument here?
Comment on lines
+1289
to
+1290
| // Lute isn't in the business of serializing incomplete ASTs | ||
| LUAU_ASSERT(node->hasThen); |
Contributor
There was a problem hiding this comment.
Is that true? I feel like if you were implementing, say, an LSP on top of Lute, you might expect that the AST you're given is incomplete (because the user is writing it).
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.
This is a prerequisite for making AST APIs available in Engine