Skip to content

Commit 56374ab

Browse files
committed
use var where appropriate
1 parent 2c59419 commit 56374ab

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/Razor/Microsoft.AspNetCore.Razor.Language/src/Legacy/SeekableTextReader.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -72,9 +72,9 @@ private void UpdateState()
7272
if (_position >= _cachedLineInfo.Span.End)
7373
{
7474
// Try to avoid the GetLocation call by checking if the next line contains the position
75-
int nextLineIndex = _cachedLineInfo.LineIndex + 1;
76-
int nextLineLength = _sourceDocument.Lines.GetLineLength(nextLineIndex);
77-
TextSpan nextLineSpan = new TextSpan(_cachedLineInfo.Span.End, nextLineLength);
75+
var nextLineIndex = _cachedLineInfo.LineIndex + 1;
76+
var nextLineLength = _sourceDocument.Lines.GetLineLength(nextLineIndex);
77+
var nextLineSpan = new TextSpan(_cachedLineInfo.Span.End, nextLineLength);
7878

7979
if (nextLineSpan.Contains(_position))
8080
{
@@ -88,9 +88,9 @@ private void UpdateState()
8888
else
8989
{
9090
// Try to avoid the GetLocation call by checking if the previous line contains the position
91-
int prevLineIndex = _cachedLineInfo.LineIndex - 1;
92-
int prevLineLength = _sourceDocument.Lines.GetLineLength(prevLineIndex);
93-
TextSpan prevLineSpan = new TextSpan(_cachedLineInfo.Span.Start - prevLineLength, prevLineLength);
91+
var prevLineIndex = _cachedLineInfo.LineIndex - 1;
92+
var prevLineLength = _sourceDocument.Lines.GetLineLength(prevLineIndex);
93+
var prevLineSpan = new TextSpan(_cachedLineInfo.Span.Start - prevLineLength, prevLineLength);
9494

9595
if (prevLineSpan.Contains(_position))
9696
{
@@ -105,8 +105,8 @@ private void UpdateState()
105105
// The call to GetLocation is expensive
106106
_location = _sourceDocument.Lines.GetLocation(_position);
107107

108-
int lineLength = _sourceDocument.Lines.GetLineLength(_location.LineIndex);
109-
TextSpan lineSpan = new TextSpan(_position - _location.CharacterIndex, lineLength);
108+
var lineLength = _sourceDocument.Lines.GetLineLength(_location.LineIndex);
109+
var lineSpan = new TextSpan(_position - _location.CharacterIndex, lineLength);
110110
_cachedLineInfo = (lineSpan, _location.LineIndex);
111111

112112
_current = _sourceDocument[_location.AbsoluteIndex];

0 commit comments

Comments
 (0)