-
Notifications
You must be signed in to change notification settings - Fork 5
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
Conversation
parser/prism/Parser.h
Outdated
pm_options_free(options); | ||
delete options; | ||
})*/ { | ||
// `pm_parser_init()` does an immutable borrow of `options`. |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
db7a7b3
to
476b1e3
Compare
55a38cc
to
4282cc6
Compare
4282cc6
to
0c3d1f1
Compare
0c3d1f1
to
082c0c9
Compare
Motivation
Closes #122.
Closes #229.
Test plan
See included automated tests.