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

Set @line_number directly on the Liquid::ParseContext #100

Merged
merged 1 commit into from
Oct 23, 2020

Conversation

dylanahsmith
Copy link
Contributor

Liquid::ParseContext uses an attr_accessor for the line number. Right now liquid-c is calling Liquid::ParseContext#line_number= to set that attribute, but it would be faster to just call rb_ivar_set. Also, this will let me re-use the same ID for re-using with rb_attr_get, which I will need for Liquid::Assign.compile in #96

@@ -36,6 +37,7 @@ void Init_liquid_c(void)
id_to_s = rb_intern("to_s");
id_call = rb_intern("call");
id_compile_evaluate = rb_intern("compile_evaluate");
id_ivar_line_number = rb_intern("@line_number");
Copy link
Member

Choose a reason for hiding this comment

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

Is there a reason id_ivar_line_number is declared in liquid.c rather than block.c? Is it/will it be used anywhere else?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this will let me re-use the same ID for re-using with rb_attr_get, which I will need for Liquid::Assign.compile in #96

@dylanahsmith dylanahsmith merged commit 8c221a3 into master Oct 23, 2020
@dylanahsmith dylanahsmith deleted the set-line-number-ivar-directly branch October 23, 2020 17:40
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.

2 participants