Skip to content
This repository has been archived by the owner on Dec 19, 2018. It is now read-only.

Refactor WriteAttribute \ AddHtmlAttribute #554

Closed
wants to merge 2 commits into from
Closed

Conversation

pranavkm
Copy link
Contributor

Fixes #177

WriteStringLiteral(value.Value);
WriteParameterSeparator();
Write(value.Location.AbsoluteIndex.ToString(CultureInfo.CurrentCulture));
WriteEndMethodInvocation(false);
Write(value.Location.AbsoluteIndex.ToString(CultureInfo.InvariantCulture));
Copy link
Member

Choose a reason for hiding this comment

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

Why change the culture here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No reason for generated code to rely on user culture.

Copy link
Member

Choose a reason for hiding this comment

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

As mentioned later, this doesn't fit in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Leaving as is. It's too small a change and has no user impact.

Copy link
Member

Choose a reason for hiding this comment

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

Either this change has no user impact and isn't worth making or there's a scenario where the user's culture could result in compilation failures and we should be tracking it as an issue, making sure it the problem doesn't exist elsewhere, testing, ...

.WriteParameterSeparator()
.Write(chunk.Start.AbsoluteIndex.ToString(CultureInfo.InvariantCulture))
.WriteParameterSeparator()
.Write(chunk.Association.Length.ToString(CultureInfo.InvariantCulture))
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't need the length at runtime.

Copy link
Member

Choose a reason for hiding this comment

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

Really starting to think you're mixing an unrelated change into this PR. If there's a culture-related issue, file it separately.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@NTaylorMullen
Copy link
Member

@@ -467,15 +470,32 @@ private void RenderUnboundAttribute(string attributeName, Chunk attributeValueCh
// Dynamic attribute value should be run through the conditional attribute removal system. It's
// unbound and contains C#.

// TagHelper attribute rendering is buffered by default. We do not want to write to the current
// writer.
var currentTargetWriter = _context.TargetWriterName;
Copy link
Member

Choose a reason for hiding this comment

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

Move these lines down to where it has effect where we do the _attributeCodeVisitor.Accept(attributeValueChunk);

@NTaylorMullen
Copy link
Member

To fulfill the purpose of the issue we should be conditionally generating the instrumented bits (value length, value offset etc.) based on instrumentation.

@pranavkm
Copy link
Contributor Author

@NTaylorMullen The primary issue with conditionally generating these values is that we'll have to factor it in the page cache invalidation which is more work than it needs to be. Right now, we always generate it instrumented with the assumption that having no-op instrumentation methods and parameters is very cheap.

I've updated the work item to reflect this design choice.

@NTaylorMullen
Copy link
Member

:shipit:

@pranavkm pranavkm closed this Oct 1, 2015
@pranavkm pranavkm deleted the prkrishn/177 branch October 1, 2015 17:26
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants