AST pretty-printing is broken for nodes containing interned strings

Open
#85 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Stale
Tech stack
javascript, rust
Domain
compilers

Research direction

Start by locating the AST nodes' Display implementations and the StringInterner usage described in the issue. Trace how interned Symbols are currently rendered, then determine how pretty-printing can access their string data. Done means AST output uses surface-looking JavaScript strings and no longer emits interned IDs.

Written by the indexing model from the issue text.

Description

AST

AST nodes can be pretty-printed via their Display impl and should output surface-looking javascript.
At some point string interning was introduced, which means that it now requires access to &StringInterner to be able to get a &str out of a Symbol, which effectively broke these impls (because the impls do not have access and there is no way to pass it as a parameter).

This is currently worked around by simply outputting their ID instead of the string data but this is not very useful.

function <interned id: 248>(<interned id: 249>) {
  return <interned id: 249> * <interned id: 249>
}
Dominant language
Rust
Stars
54
Forks
2
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from y21/dash

All issues in y21/dash

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.