Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Prism -> Sorbet translation for it keyword #228

Merged
merged 3 commits into from
Sep 16, 2024

Conversation

amomchilov
Copy link

@amomchilov amomchilov commented Sep 3, 2024

Motivation

Closes #122.
Closes #229.

Test plan

See included automated tests.

pm_options_free(options);
delete options;
})*/ {
// `pm_parser_init()` does an immutable borrow of `options`.
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The expected memory management pattern is:

pm_options_t options = {};
pm_string_t input = {};

pm_parser_t parser;
pm_parser_init(&parser, pm_string_source(&input), pm_string_length(&input), &options);

pm_node_t *node = pm_parse(&parser);
// do whatever

pm_node_destroy(&parser, node);
pm_parser_free(&parser);

pm_string_free(&input);
pm_options_free(&options);

In general a good place to look for this is extension.c (https://github.com/ruby/prism/blob/main/ext/prism/extension.c) in the Prism repo which effectively is a consumer of the C API of Prism for use in CRuby.

TODO: update this in the Prism C API docs.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@amomchilov amomchilov self-assigned this Sep 3, 2024
Base automatically changed from Alex/translate-simple-keywords to prism September 3, 2024 18:26
@amomchilov amomchilov marked this pull request as ready for review September 13, 2024 19:14
@amomchilov amomchilov merged commit 9c010bb into prism Sep 16, 2024
1 check passed
@amomchilov amomchilov deleted the Alex/translate-keyword-it branch September 16, 2024 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement Translation for PM_IT_LOCAL_VARIABLE_READ_NODE Implement translation for PM_IT_PARAMETERS_NODE
2 participants