Skip to content

SyntaxNodes: subsume DotSelfExpr and ImplicitMemberExpr by MemberAccessExpr. #21953

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

Merged
merged 2 commits into from
Jan 17, 2019

Conversation

nkcsgexi
Copy link
Contributor

Per our discussion in another PR, having these three similar nodes at
the same time may unnecessarily complicate client side.

@nkcsgexi
Copy link
Contributor Author

@swift-ci please smoke test

token_choices=[
'PeriodToken', 'PrefixPeriodToken'
]),
Child('SelfKeyword', kind='SelfToken'),
## Name could be 'self'
Child("Name", kind='Token'),
Copy link
Contributor

Choose a reason for hiding this comment

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

How do you distinguish foo.self and foo.`self`?

struct Foo {
  var `self`: Int { return 0 }
}

let f = Foo()
print(f.self)
print(f.`self`)

Copy link
Contributor

Choose a reason for hiding this comment

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

(I mean, yes, hopefully no one does this, but the compiler and language support it.)

Copy link
Contributor Author

@nkcsgexi nkcsgexi Jan 17, 2019

Choose a reason for hiding this comment

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

`self` is currently parsed as one token so the structure still applies. It's parsed to be something like: <MemberAccessExpr><IdentifierExpr>f</IdentifierExpr>.`self`</MemberAccessExpr>

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, `self` and self are different tokens, even though they have the same identifier text.

@nkcsgexi
Copy link
Contributor Author

@swift-ci please smoke test

@nkcsgexi
Copy link
Contributor Author

@swift-ci please smoke test

…ssExpr.

Per our discussion in another PR, having these three similar nodes at
the same time  may unnecessarily complicate client side.
@nkcsgexi
Copy link
Contributor Author

@swift-ci please smoke test

@nkcsgexi nkcsgexi merged commit c04a7de into swiftlang:master Jan 17, 2019
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