File tree Expand file tree Collapse file tree 4 files changed +11
-11
lines changed Expand file tree Collapse file tree 4 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ END_UNRELEASED_TEMPLATE
72
72
* (py_wheel) py_wheel always creates zip64-capable wheel zips
73
73
* (providers) (experimental) {obj}` PyInfo.venv_symlinks ` replaces
74
74
` 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 .
76
76
77
77
{#v0-0-0-fixed}
78
78
### Fixed
Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ const (
42
42
type ParserOutput struct {
43
43
FileName string
44
44
Modules []Module
45
- Comments []comment
45
+ Comments []Comment
46
46
HasMain bool
47
47
}
48
48
@@ -188,7 +188,7 @@ func (p *FileParser) parseImportStatements(node *sitter.Node) bool {
188
188
// It updates FileParser.output.Comments with the parsed comment.
189
189
func (p * FileParser ) parseComments (node * sitter.Node ) bool {
190
190
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 )))
192
192
return true
193
193
}
194
194
return false
Original file line number Diff line number Diff line change @@ -152,7 +152,7 @@ func TestParseComments(t *testing.T) {
152
152
units := []struct {
153
153
name string
154
154
code string
155
- result []comment
155
+ result []Comment
156
156
}{
157
157
{
158
158
name : "not has comment" ,
@@ -162,17 +162,17 @@ func TestParseComments(t *testing.T) {
162
162
{
163
163
name : "has comment" ,
164
164
code : "# a = 1\n # b = 2" ,
165
- result : []comment {"# a = 1" , "# b = 2" },
165
+ result : []Comment {"# a = 1" , "# b = 2" },
166
166
},
167
167
{
168
168
name : "has comment in if" ,
169
169
code : "if True:\n # a = 1\n # b = 2" ,
170
- result : []comment {"# a = 1" , "# b = 2" },
170
+ result : []Comment {"# a = 1" , "# b = 2" },
171
171
},
172
172
{
173
173
name : "has comment inline" ,
174
174
code : "import os# 123\n from pathlib import Path as b#456" ,
175
- result : []comment {"# 123" , "#456" },
175
+ result : []Comment {"# 123" , "#456" },
176
176
},
177
177
}
178
178
for _ , u := range units {
Original file line number Diff line number Diff line change @@ -176,12 +176,12 @@ const (
176
176
annotationKindIncludeDep annotationKind = "include_dep"
177
177
)
178
178
179
- // comment represents a Python comment.
180
- type comment string
179
+ // Comment represents a Python comment.
180
+ type Comment string
181
181
182
182
// asAnnotation returns an annotation object if the comment has the
183
183
// annotationPrefix.
184
- func (c * comment ) asAnnotation () (* annotation , error ) {
184
+ func (c * Comment ) asAnnotation () (* annotation , error ) {
185
185
uncomment := strings .TrimLeft (string (* c ), "# " )
186
186
if ! strings .HasPrefix (uncomment , annotationPrefix ) {
187
187
return nil , nil
@@ -215,7 +215,7 @@ type annotations struct {
215
215
216
216
// annotationsFromComments returns all the annotations parsed out of the
217
217
// comments of a Python module.
218
- func annotationsFromComments (comments []comment ) (* annotations , error ) {
218
+ func annotationsFromComments (comments []Comment ) (* annotations , error ) {
219
219
ignore := make (map [string ]struct {})
220
220
includeDeps := []string {}
221
221
for _ , comment := range comments {
You can’t perform that action at this time.
0 commit comments