Skip to content

Shorten Some Commonly Used Method Names. - #1075

Closed
AdamSpeight2008 wants to merge 6 commits into
dotnet:masterfrom
AdamSpeight2008:Rename-(CanGet)-
Closed

Shorten Some Commonly Used Method Names. #1075
AdamSpeight2008 wants to merge 6 commits into
dotnet:masterfrom
AdamSpeight2008:Rename-(CanGet)-

Conversation

@AdamSpeight2008

Copy link
Copy Markdown
Contributor

Implementation of Issue #999

Note: Incudes #1001 (This is where this branch originated)
Note: Builds with Test Failure ##1006

This function encapsulates a common coding pattern in the scanner
source. That of a `CanGetCharAtOffset( )` followed by multiple multiple
`PeekAheadChar( )` and comparison checks. As a result the scanner source
is a bit better to work with.
Renamed PeekAheadCHarAt -> Peek
CanGetCharAtOffset => CanGet(offset As Integer)
CanGetChar         => CanGet()
@gafter

gafter commented Mar 6, 2015

Copy link
Copy Markdown
Member

@AlekseyTs Do you find this change an improvement?

@gafter gafter self-assigned this Mar 6, 2015
@gafter gafter added this to the 1.0 (stable) milestone Mar 6, 2015
@AlekseyTs

Copy link
Copy Markdown
Contributor

I like the idea of renaming. There is one suggestion, "CanGet" should probably be "CanPeek".
It feels like the change itself introduces too much churn. I would prefer it to be straight rename, no reformatting of the code. For example, I do not find a change like the following (conversion to a single-line If) an improvement:

  •                If CanGetCharAtOffset(1) AndAlso BeginsBaseLiteral(PeekAheadChar(1)) Then
    
  •                    Return ScanNumericLiteral(precedingTrivia)
    
  •                End If
    
  •                If CanGet(1) AndAlso BeginsBaseLiteral(Peek(1)) Then Return ScanNumericLiteral(precedingTrivia)
    

Reformatting of conditions from multiple line to a single line fall into the same category, etc.

@gafter

gafter commented Mar 6, 2015

Copy link
Copy Markdown
Member

@AdamSpeight2008 Can you please update your pull request to address the comments from @AlekseyTs ?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Could you please keep the newline after the OrElse in the condition.
Now I need to scroll right the diff on GitHub to see the end of the proposed line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area-Compilers Blocked Feature Request Resolution-Won't Fix A real bug, but Triage feels that the issue is not impactful enough to spend time on.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants