Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

types: add ToString method for HexLiteral and BitLiteral #11029

Merged
merged 4 commits into from
Jul 2, 2019

Conversation

imtbkcat
Copy link

@imtbkcat imtbkcat commented Jul 2, 2019

What problem does this PR solve?

pingcap/parser#365 support hex and binary expression in LOAD DATA.
But import an new interface ast.BinaryLiteral which require HexLiteral and BinaryLiteral implement ToString method

What is changed and how it works?

add ToString method for HexLiteral and BitLiteral

Check List

Tests

  • Unit test

Code changes

  • Has exported function/method change

Side effects

Related changes

@codecov
Copy link

codecov bot commented Jul 2, 2019

Codecov Report

Merging #11029 into master will decrease coverage by 0.1459%.
The diff coverage is 100%.

@@              Coverage Diff               @@
##             master    #11029       +/-   ##
==============================================
- Coverage   81.1069%   80.961%   -0.146%     
==============================================
  Files           419       418        -1     
  Lines         89615     89259      -356     
==============================================
- Hits          72684     72265      -419     
- Misses        11704     11757       +53     
- Partials       5227      5237       +10

Copy link
Contributor

@kennytm kennytm left a comment

Choose a reason for hiding this comment

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

Rest LGTM

@@ -183,6 +183,11 @@ func NewBitLiteral(s string) (BitLiteral, error) {
return BitLiteral(b), nil
}

// ToString implement ast.BinaryLiteral interface
func (b BitLiteral) ToString() string {
return string(b)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return string(b)
return BinaryLiteral(b).ToString()

to ensure the implementations are the same.


// ToString implement ast.BinaryLiteral interface
func (b HexLiteral) ToString() string {
return string(b)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return string(b)
return BinaryLiteral(b).ToString()

@kennytm kennytm added the status/LGT1 Indicates that a PR has LGTM 1. label Jul 2, 2019
Copy link
Member

@jackysp jackysp left a comment

Choose a reason for hiding this comment

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

LGTM

@imtbkcat
Copy link
Author

imtbkcat commented Jul 2, 2019

/run-all-tests

@imtbkcat
Copy link
Author

imtbkcat commented Jul 2, 2019

/run-all-tests

@imtbkcat imtbkcat merged commit 973a3e7 into pingcap:master Jul 2, 2019
@imtbkcat imtbkcat deleted the ToString branch July 2, 2019 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/parser status/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants