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

Conversation

pranavkm
Copy link
Contributor

Ties into aspnet/Mvc#2321

@ghost ghost added the cla-already-signed label Apr 14, 2015
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure how attached we are to these operators - they are scarcely used in our code.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Also confirmed with Todd that these operators aren't used in tooling.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will fix.

Copy link
Contributor

Choose a reason for hiding this comment

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

was this fixed?

@NTaylorMullen
Copy link

  • Add test for SourceLocationTracker verifying that the file paths flow with updated SourceLocations, just need to test the UpdateLocation method.
  • Add test that validates codegen prioritizes SourceLocation.FilePath over the contexts source file.

@NTaylorMullen
Copy link

Copy link
Contributor

Choose a reason for hiding this comment

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

what scenarios will continue to use this constructor? for example, could it be internal and used only in tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We use this one all over the place - I'm being pretty lazy in this PR and specifically using the other ctor when creating inherited Chunks in Mvc. The existing code continues to use this ctor.

@dougbu
Copy link
Contributor

dougbu commented Apr 14, 2015

* Using SourceLocation.FilePath when printing line pragmas, if available.
@pranavkm
Copy link
Contributor Author

Updated

Copy link
Contributor

Choose a reason for hiding this comment

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

  • why doesn't the comparer handle null?
  • adding the wrong value to the hash. either return Add(hashCode) or do what Add(object) does:
Add(hashCode);
return this;

Copy link
Contributor

Choose a reason for hiding this comment

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

also, if the comparer can't handle null suggest making a similar change to Add(object)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately the comparer performs a null check so this ends up throwing. I'll fix the hash code

Copy link
Contributor

Choose a reason for hiding this comment

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

including the file in a relative location seems a bit nonsensical. one possibility would be for - to return a SourceLocation with FilePath==null (maintaining current comparison of input FilePath values) and + to throw if both SourceLocations have FilePath!=null, then return a new SourceLocation with the non-null FilePath (if any).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm neutral about this - subtraction isn't used anywhere in the codebase. Additions are used where the right operand is a relative location and it's used in calculating the offset from document start. So it sort of makes sense to preserve the document location in that case.

@NTaylorMullen
Copy link

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: no 's' in WriteLineNumberDirective_

@dougbu
Copy link
Contributor

dougbu commented Apr 15, 2015

@NTaylorMullen
Copy link

Should investigate travis failures. It's pasing fine on dev branch.

@pranavkm
Copy link
Contributor Author

Updated

Copy link
Contributor

Choose a reason for hiding this comment

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

can't use [NotNull] here. breaks other constructor.

@dougbu
Copy link
Contributor

dougbu commented Apr 16, 2015

⌚ mainly for (A - B) + C discussion

@pranavkm
Copy link
Contributor Author

Updated.

Copy link
Contributor

Choose a reason for hiding this comment

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

add , and neither is null

@dougbu
Copy link
Contributor

dougbu commented Apr 16, 2015

:shipit:

@pranavkm pranavkm closed this Apr 16, 2015
@pranavkm pranavkm deleted the SourceLocation branch April 16, 2015 22:14
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.

3 participants