-
Notifications
You must be signed in to change notification settings - Fork 2
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
WIP: node templates #1
Conversation
Signed-off-by: Alexandre Terrasa <[email protected]>
Ultimately we want to separate the pure C implementation files (under `src/` and `include/`) from the Ruby extension files (under `ext/rbs_extension`). This change allow us to build the Ruby extension using files outside of the `ext/rbs_extension` directory. Signed-off-by: Alexandre Terrasa <[email protected]>
Generate the c/h code for constants definitions and objects initialization. The generated files are generated under `src/` and `include/` as to not conflict with the files from `ext/rbs_extension` and will soon replace `constants.{h,c}` and `ruby_objs.{h,c}`. We make sure the Rake task builds the required templates so we can compile the extension. Signed-off-by: Alexandre Terrasa <[email protected]>
Signed-off-by: Alexandre Terrasa <[email protected]>
Signed-off-by: Alexandre Terrasa <[email protected]>
Signed-off-by: Alexandre Terrasa <[email protected]>
Signed-off-by: Alexandre Terrasa <[email protected]>
Signed-off-by: Alexandre Terrasa <[email protected]>
Signed-off-by: Alexandre Terrasa <[email protected]>
Signed-off-by: Alexandre Terrasa <[email protected]>
Signed-off-by: Alexandre Terrasa <[email protected]>
Signed-off-by: Alexandre Terrasa <[email protected]>
Signed-off-by: Alexandre Terrasa <[email protected]>
Signed-off-by: Alexandre Terrasa <[email protected]>
Signed-off-by: Alexandre Terrasa <[email protected]>
Signed-off-by: Alexandre Terrasa <[email protected]>
Signed-off-by: Alexandre Terrasa <[email protected]>
Signed-off-by: Alexandre Terrasa <[email protected]>
Signed-off-by: Alexandre Terrasa <[email protected]>
Signed-off-by: Alexandre Terrasa <[email protected]>
Signed-off-by: Alexandre Terrasa <[email protected]>
Signed-off-by: Alexandre Terrasa <[email protected]>
Signed-off-by: Alexandre Terrasa <[email protected]>
Signed-off-by: Alexandre Terrasa <[email protected]>
Signed-off-by: Alexandre Terrasa <[email protected]>
Signed-off-by: Alexandre Terrasa <[email protected]>
Signed-off-by: Alexandre Terrasa <[email protected]>
Signed-off-by: Alexandre Terrasa <[email protected]>
if (unchecked) { | ||
rb_funcall(param, rb_intern("unchecked!"), 0); | ||
} |
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.
What's this about?
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.
I needed to extract it from the ruby_objs
code since we now generate it
enum TokenType type; | ||
|
||
member_range.start = state->current_token.range.start; | ||
comment_pos = nonnull_pos_or(comment_pos, member_range.start); | ||
|
||
type = state->current_token.type; |
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.
Can we drop the forward declaration?
enum TokenType type; | |
member_range.start = state->current_token.range.start; | |
comment_pos = nonnull_pos_or(comment_pos, member_range.start); | |
type = state->current_token.type; | |
enum TokenType type = state->current_token.type; |
enum TokenType type; | |
member_range.start = state->current_token.range.start; | |
comment_pos = nonnull_pos_or(comment_pos, member_range.start); | |
type = state->current_token.type; | |
member_range.start = state->current_token.range.start; | |
comment_pos = nonnull_pos_or(comment_pos, member_range.start); | |
enum TokenType type = state->current_token.type; |
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.
It's the style of the original code, I'd prefer to follow it for now to avoid inconsistencies. We can clean all of it later 👍
VALUE comment = get_comment(state, comment_pos.line); | ||
switch (type) |
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.
Is this just an inlining of rbs_ast_members_mixin()
?
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.
Yep, since we generate the specialized methods
extern VALUE <%= node.c_constant_name %>; | ||
<%- end -%> | ||
|
||
void rbs__init_constants(); |
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.
This is subtly incorrect: Prior to C23 (which we aren't using), this means "takes unspecified params", not "takes no parameters".
void rbs__init_constants(); | |
void rbs__init_constants(void); |
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.
Kept the original definition, not sure if we want to change it right now?
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.
Yep, I'll keep it "as-is" in our first PR, and add this to our second
Merged upstream in ruby#2098 |
No description provided.