Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
4a7d1f20
Commit
4a7d1f20
authored
Jan 05, 2011
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
go/ast: correct Pos/End ranges for field lists
R=rsc CC=golang-dev
https://golang.org/cl/3797045
parent
d84317ba
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
4 deletions
+26
-4
src/pkg/go/ast/ast.go
src/pkg/go/ast/ast.go
+26
-4
No files found.
src/pkg/go/ast/ast.go
View file @
4a7d1f20
...
...
@@ -120,14 +120,36 @@ func (f *Field) End() token.Pos {
// A FieldList represents a list of Fields, enclosed by parentheses or braces.
type
FieldList
struct
{
Opening
token
.
Pos
// position of opening parenthesis/brace
Opening
token
.
Pos
// position of opening parenthesis/brace
, if any
List
[]
*
Field
// field list
Closing
token
.
Pos
// position of closing parenthesis/brace
Closing
token
.
Pos
// position of closing parenthesis/brace
, if any
}
func
(
list
*
FieldList
)
Pos
()
token
.
Pos
{
return
list
.
Opening
}
func
(
list
*
FieldList
)
End
()
token
.
Pos
{
return
list
.
Closing
+
1
}
func
(
f
*
FieldList
)
Pos
()
token
.
Pos
{
if
f
.
Opening
.
IsValid
()
{
return
f
.
Opening
}
// the list should not be empty in this case;
// be conservative and guard against bad ASTs
if
len
(
f
.
List
)
>
0
{
return
f
.
List
[
0
]
.
Pos
()
}
return
token
.
NoPos
}
func
(
f
*
FieldList
)
End
()
token
.
Pos
{
if
f
.
Closing
.
IsValid
()
{
return
f
.
Closing
+
1
}
// the list should not be empty in this case;
// be conservative and guard against bad ASTs
if
n
:=
len
(
f
.
List
);
n
>
0
{
return
f
.
List
[
n
-
1
]
.
End
()
}
return
token
.
NoPos
}
// NumFields returns the number of (named and anonymous fields) in a FieldList.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment