Go to file
Doug Bunting 6384977e96 Improve `GetHashCode()` implementations and their consistency with `Equals()`
- #362 and more
- make a few more properties immutable
 - in a few cases, just remove `private` setters
 - in others, adjust consuming code to handle the changes
- make `Equals()` commutative
 - use `GetType() == obj.GetType()` if necessary
- use only immutable values in `GetHashCode()` calculations
 - avoid `object.GetHashCode()`; that calculates hash of reference
 - add warnings about `RazorError` property setters but use properties
 - BUT lack of immutable values leads to some static `GetHashCode()` calculations
- correct important typo in `TagHelperDescriptorComparer`
- ensure `Equals()` does not `throw` an NRE e.g. in `LineMapping`
- add `SyntaxTreeNode.GetEquivalenceHash()`
- make `SourceLocation.Equals()` and `SourceLocation.CompareTo()` consistent

Update affected tests
- code generators and edit handlers less likely to be equal; adjust expectations

Add lots of tests
- not for all updated classes but enough to see impact of odd choices

nits:
- remove some `Equals()` and `GetHashCode()` overrides in `SpanCodeGenerator` subclasses
 - no longer unique
- remove redundant null checks e.g. when also done in `base.Equals()`
- add `StringComparer.Ordinal` if `StringComparison.Ordinal` used in `Equals()`
- make some `CSharpLineMappingWriter` fields `readonly`
- remove unused `LineMapping` constructor
2015-04-28 20:35:04 -07:00
src Improve `GetHashCode()` implementations and their consistency with `Equals()` 2015-04-28 20:35:04 -07:00
test Improve `GetHashCode()` implementations and their consistency with `Equals()` 2015-04-28 20:35:04 -07:00
.gitattributes
.gitignore
.travis.yml Update .travis.yml and appveyor.yml to build quietly. 2015-04-07 16:16:19 -07:00
CONTRIBUTING.md
LICENSE.txt
NuGet.Config
README.md Normalize README.md build status badges. 2015-04-06 11:55:11 -07:00
Razor.sln
appveyor.yml Update .travis.yml and appveyor.yml to build quietly. 2015-04-07 16:16:19 -07:00
build.cmd
build.sh Add travis and appveyor CI support. 2015-04-01 15:54:21 -07:00
global.json Update global.json, sources=>projects 2015-04-02 09:20:25 -07:00
makefile.shade

README.md

Razor

AppVeyor: AppVeyor

Travis: Travis

The Razor syntax provides a fast, terse, clean and lightweight way to combine server code with HTML to create dynamic web content. This repo contains the parser and the C# code generator for the Razor syntax.

This project is part of ASP.NET 5. You can find samples, documentation and getting started instructions for ASP.NET 5 at the Home repo.