Skip to content

parser.y: Always populate SelectField offset#943

Closed
kyleconroy wants to merge 1 commit intopingcap:masterfrom
kyleconroy:populate-offset
Closed

parser.y: Always populate SelectField offset#943
kyleconroy wants to merge 1 commit intopingcap:masterfrom
kyleconroy:populate-offset

Conversation

@kyleconroy
Copy link
Copy Markdown

👋 This is my time contributing code to this project, so please let me know if I need to do more work to get this approved. I'm happy to add tests, documentation, etc.

What problem does this PR solve?

This is a partial solution to #910

What is changed and how it works?

ast.SelectField already has an Offset field. I've updated parser.y to populate this field whenever an ast.SelectField is created.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Jul 24, 2020

CLA assistant check
All committers have signed the CLA.

@codecov
Copy link
Copy Markdown

codecov Bot commented Jul 24, 2020

Codecov Report

Merging #943 into master will decrease coverage by 0.06%.
The diff coverage is 62.50%.

@@            Coverage Diff             @@
##           master     #943      +/-   ##
==========================================
- Coverage   78.46%   78.40%   -0.07%     
==========================================
  Files          40       40              
  Lines       14916    15013      +97     
==========================================
+ Hits        11704    11771      +67     
- Misses       2521     2544      +23     
- Partials      691      698       +7     

@kyleconroy
Copy link
Copy Markdown
Author

Any feedback for this pull request? Is this something you'd be interested in merging if I fixed the test failures?

Comment thread parser.y
$$ = &ast.SelectField{WildCard: &ast.WildCardField{}}
$$ = &ast.SelectField{
WildCard: &ast.WildCardField{},
Offset: parser.startOffset(&yyS[yypt]),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The offset field has been initialized here:

parser/parser.y

Lines 4845 to 4851 in 12de604

FieldList:
Field
{
field := $1.(*ast.SelectField)
field.Offset = parser.startOffset(&yyS[yypt])
$$ = []*ast.SelectField{field}
}

What's the purpose to make this change? Are there any tests or use cases?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Hmm, if this is being populated I'm not sure why I needed to change parser.y at all. I'll need to investigate why it wasn't working for me.

@tangenta
Copy link
Copy Markdown
Contributor

tangenta commented Aug 3, 2020

Any feedback for this pull request? Is this something you'd be interested in merging if I fixed the test failures?

Sorry for the late reply. I thought this is still WIP..

@kyleconroy
Copy link
Copy Markdown
Author

Sorry for the late reply. I thought this is still WIP..

No worries! I was hoping to get feedback before I did too much work. Thanks for explaining how Offset is currently being populated, as I think it makes this PR unnecessary.

@kyleconroy
Copy link
Copy Markdown
Author

I finally got around to testing this; the current behavior works perfectly.

@kyleconroy kyleconroy closed this Aug 19, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants