Skip to content

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

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
Contributor

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