Skip to content

Commit 834432e

Browse files
committed
Update struct
1 parent 769c6de commit 834432e

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ END_UNRELEASED_TEMPLATE
7272
* (py_wheel) py_wheel always creates zip64-capable wheel zips
7373
* (providers) (experimental) {obj}`PyInfo.venv_symlinks` replaces
7474
`PyInfo.site_packages_symlinks`
75-
(gazelle) Export `parser.Module` as a public struct.
75+
* (gazelle) Types for exposed members of python.ParserOutput are now all public.
7676

7777
{#v0-0-0-fixed}
7878
### Fixed

gazelle/python/file_parser.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const (
4242
type ParserOutput struct {
4343
FileName string
4444
Modules []Module
45-
Comments []comment
45+
Comments []Comment
4646
HasMain bool
4747
}
4848

@@ -188,7 +188,7 @@ func (p *FileParser) parseImportStatements(node *sitter.Node) bool {
188188
// It updates FileParser.output.Comments with the parsed comment.
189189
func (p *FileParser) parseComments(node *sitter.Node) bool {
190190
if node.Type() == sitterNodeTypeComment {
191-
p.output.Comments = append(p.output.Comments, comment(node.Content(p.code)))
191+
p.output.Comments = append(p.output.Comments, Comment(node.Content(p.code)))
192192
return true
193193
}
194194
return false

gazelle/python/file_parser_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ func TestParseComments(t *testing.T) {
152152
units := []struct {
153153
name string
154154
code string
155-
result []comment
155+
result []Comment
156156
}{
157157
{
158158
name: "not has comment",
@@ -162,17 +162,17 @@ func TestParseComments(t *testing.T) {
162162
{
163163
name: "has comment",
164164
code: "# a = 1\n# b = 2",
165-
result: []comment{"# a = 1", "# b = 2"},
165+
result: []Comment{"# a = 1", "# b = 2"},
166166
},
167167
{
168168
name: "has comment in if",
169169
code: "if True:\n # a = 1\n # b = 2",
170-
result: []comment{"# a = 1", "# b = 2"},
170+
result: []Comment{"# a = 1", "# b = 2"},
171171
},
172172
{
173173
name: "has comment inline",
174174
code: "import os# 123\nfrom pathlib import Path as b#456",
175-
result: []comment{"# 123", "#456"},
175+
result: []Comment{"# 123", "#456"},
176176
},
177177
}
178178
for _, u := range units {

gazelle/python/parser.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,12 @@ const (
176176
annotationKindIncludeDep annotationKind = "include_dep"
177177
)
178178

179-
// comment represents a Python comment.
180-
type comment string
179+
// Comment represents a Python comment.
180+
type Comment string
181181

182182
// asAnnotation returns an annotation object if the comment has the
183183
// annotationPrefix.
184-
func (c *comment) asAnnotation() (*annotation, error) {
184+
func (c *Comment) asAnnotation() (*annotation, error) {
185185
uncomment := strings.TrimLeft(string(*c), "# ")
186186
if !strings.HasPrefix(uncomment, annotationPrefix) {
187187
return nil, nil
@@ -215,7 +215,7 @@ type annotations struct {
215215

216216
// annotationsFromComments returns all the annotations parsed out of the
217217
// comments of a Python module.
218-
func annotationsFromComments(comments []comment) (*annotations, error) {
218+
func annotationsFromComments(comments []Comment) (*annotations, error) {
219219
ignore := make(map[string]struct{})
220220
includeDeps := []string{}
221221
for _, comment := range comments {

0 commit comments

Comments
 (0)