A way to reach the parent node(s) or root node from a given Prism::Node
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 35/100
Línea de trabajo
Start by reading the linked Ruby issue note and the discussion here to understand the proposed Prism::Node#root or Prism::Node#parse_result API and the concern about keeping the whole tree alive. Then inspect how nodes retain Prism::Source and how Prism.parse constructs its result. Done means the API choice and memory tradeoff are resolved; the issue does not specify an implementation or tests.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
This is from https://bugs.ruby-lang.org/issues/22520#note-5, for #syntax_tree.
It can be necessary to get the parent node(s) or even the root node, from a given Prism::Node.
One idea would be to have Prism::Node#root or Prism::Node#parse_result, which would work through the existing @source ivar of every node holding a Prism::Source.
So then we'd store the root node or the ParseResult inside the Source, and we could then provide Prism::Node#root or Prism::Node#parse_result.
There is one downside, this means holding on to any node (even leaves) would keep the whole tree alive.
(Currently every node holds the source, so the entire source code, but does not hold on parent nodes)
If that's a concern, this could be controlled via a keyword argument of Prism.parse (opt-in or opt-out).
I'm happy to make a PR for this but I wanted to first see what others think of this idea, and whether they prefer Prism::Node#root or Prism::Node#parse_result, or some other solution.
(Feel free to convert this to a GitHub discussion if you prefer)
- Lenguaje dominante
- C
- Estrellas
- 1k
- Forks
- 206
- Merge medio
- 1 d 1 h
- PR fusionados (30 d)
- 71
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de ruby/prism
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
Los mantenedores suelen responder en 1 día
-
More differential fuzzing bugsAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
Los mantenedores suelen responder en 1 día
Todos los issues de ruby/prism
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Polprzewodnikowy/N64FlashcartMenu#486 · 3 comentarios ·
-
[raygui] update to 5.0Abiertocategory:port-update
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
Los mantenedores suelen responder en 2 días
-
crash
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
tree-sitter/tree-sitter-c#338 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100