Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
cb897436
Commit
cb897436
authored
Jun 16, 2009
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix nesting level for parameters
R=rsc DELTA=8 (4 added, 2 deleted, 2 changed) OCL=30365 CL=30368
parent
e15b64e8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
3 deletions
+5
-3
printer.go
src/pkg/go/printer/printer.go
+5
-3
No files found.
src/pkg/go/printer/printer.go
View file @
cb897436
...
...
@@ -322,6 +322,7 @@ func (p *printer) exprList(list []ast.Expr) {
func
(
p
*
printer
)
parameters
(
list
[]
*
ast
.
Field
)
{
p
.
print
(
token
.
LPAREN
);
if
len
(
list
)
>
0
{
p
.
level
++
;
// adjust nesting level for parameters
for
i
,
par
:=
range
list
{
if
i
>
0
{
p
.
print
(
token
.
COMMA
,
blank
);
...
...
@@ -333,6 +334,7 @@ func (p *printer) parameters(list []*ast.Field) {
};
p
.
expr
(
par
.
Type
);
}
p
.
level
--
;
}
p
.
print
(
token
.
RPAREN
);
}
...
...
@@ -512,9 +514,9 @@ func (p *printer) expr1(expr ast.Expr, prec1 int) (optSemi bool) {
}
case
*
ast
.
FuncLit
:
p
.
level
++
;
p
.
expr
(
x
.
Type
);
p
.
print
(
blank
);
p
.
level
++
;
// adjust nesting level for function body
p
.
stmt
(
x
.
Body
);
p
.
level
--
;
...
...
@@ -929,7 +931,6 @@ func (p *printer) decl(decl ast.Decl) (optSemi bool) {
}
case
*
ast
.
FuncDecl
:
p
.
level
++
;
p
.
doc
(
d
.
Doc
);
p
.
print
(
d
.
Pos
(),
token
.
FUNC
,
blank
);
if
recv
:=
d
.
Recv
;
recv
!=
nil
{
...
...
@@ -946,9 +947,10 @@ func (p *printer) decl(decl ast.Decl) (optSemi bool) {
p
.
signature
(
d
.
Type
.
Params
,
d
.
Type
.
Results
);
if
!
p
.
exportsOnly
()
&&
d
.
Body
!=
nil
{
p
.
print
(
blank
);
p
.
level
++
;
// adjust nesting level for function body
p
.
stmt
(
d
.
Body
);
p
.
level
--
;
}
p
.
level
--
;
default
:
panic
(
"unreachable"
);
...
...
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