This repository was archived by the owner on Jan 5, 2023. It is now read-only.
Add classes for array and slice literals#175
Merged
owen-mc merged 3 commits intogithub:masterfrom Jun 12, 2020
Merged
Conversation
| class ArrayOrSliceLit extends CompositeLit { | ||
| Type type; | ||
|
|
||
| ArrayOrSliceLit() { getType() instanceof ArrayType or getType() instanceof SliceType } |
Contributor
There was a problem hiding this comment.
Did you perhaps mean to bind the field type here?
Suggested change
| ArrayOrSliceLit() { getType() instanceof ArrayType or getType() instanceof SliceType } | |
| ArrayOrSliceLit() { type = getType() and (type instanceof ArrayType or type instanceof SliceType) } |
Contributor
There was a problem hiding this comment.
Of course you can also just remove the field altogether and leave the characteristic predicates as they are.
| * ``` | ||
| */ | ||
| class ArrayLit extends ArrayOrSliceLit { | ||
| ArrayLit() { getType() instanceof ArrayType } |
Contributor
There was a problem hiding this comment.
If you bind type as suggested above, you can now do
Suggested change
| ArrayLit() { getType() instanceof ArrayType } | |
| override ArrayType type; |
| * ``` | ||
| */ | ||
| class SliceLit extends CompositeLit { | ||
| SliceLit() { getType() instanceof SliceType } |
Contributor
There was a problem hiding this comment.
Suggested change
| SliceLit() { getType() instanceof SliceType } | |
| override SliceType type; |
9aec22c to
32e7b93
Compare
bbf5a21 to
e6217d9
Compare
Contributor
Author
|
I've added a commit to update the strings for map and struct literals as well |
max-schaefer
approved these changes
Jun 12, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.