Skip to content

Fix runtime renderers rendering of certain sections #2674

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

Merged
merged 3 commits into from
Jun 11, 2021

Conversation

srawlins
Copy link
Member

If a section is found which is keyed on a context variable other than the top of the stack, then the wrong buffer will be written to.

Before this fix, the test added in this PR renders "Text TwoOne ". Yikes!

It looks like section() is the only node to refer to parent in this way. (getProperties() does not touch its own buffer; it only returns a result directly.)

@google-cla google-cla bot added the cla: yes Google CLA check succeeded. label Jun 10, 2021
@coveralls
Copy link

coveralls commented Jun 10, 2021

Coverage Status

Coverage increased (+0.02%) to 57.582% when pulling 49d437b on srawlins:fix-deeper-section into 12adc15 on dart-lang:master.

@@ -145,7 +145,7 @@ abstract class RendererBase<T> {
Template _template;

/// The output buffer into which [context] is rendered, using a template.
final buffer = StringBuffer();
StringBuffer buffer = StringBuffer();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why can we not pass buffers into the RendererBase and share them, rather than requiring them to be different for each object? Or, further, maybe this could be part of the idea @kevmoo suggested of just having a stream that we add to.

I'm OK with a big honking TODO/issue filed on cleaning this up, but I think the need for a withBuffer really points to a refactoring using streams being the way to handle this.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't think there is any need for an asynchronous stream API. I've added a TODO to pass around a single StringBuffer.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, I was thinking StreamSink accessed synchronously. Async definitely seems like overkill.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah interesting.

@srawlins srawlins merged commit 45d7e76 into dart-lang:master Jun 11, 2021
@srawlins srawlins deleted the fix-deeper-section branch June 11, 2021 22:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Google CLA check succeeded.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants