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
43456b4a
Commit
43456b4a
authored
Jun 02, 2009
by
Robert Griesemer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove superfluous indirection
R=rsc DELTA=7 (0 added, 0 deleted, 7 changed) OCL=29776 CL=29778
parent
8083467d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
src/lib/go/ast/format.go
src/lib/go/ast/format.go
+7
-7
No files found.
src/lib/go/ast/format.go
View file @
43456b4a
...
@@ -24,13 +24,13 @@ type Format datafmt.Format;
...
@@ -24,13 +24,13 @@ type Format datafmt.Format;
type
state
struct
{
type
state
struct
{
// for now we have very little state
// for now we have very little state
// TODO maintain list of unassociated comments
// TODO maintain list of unassociated comments
optSemi
*
bool
optSemi
bool
}
}
func
(
s
*
state
)
Copy
()
datafmt
.
Environment
{
func
(
s
*
state
)
Copy
()
datafmt
.
Environment
{
optSemi
:=
*
s
.
optSemi
;
copy
:=
*
s
;
return
&
state
{
&
optSemi
}
;
return
&
copy
;
}
}
...
@@ -56,19 +56,19 @@ func isMultiLineComment(s *datafmt.State, value interface{}, ruleName string) bo
...
@@ -56,19 +56,19 @@ func isMultiLineComment(s *datafmt.State, value interface{}, ruleName string) bo
func
clearOptSemi
(
s
*
datafmt
.
State
,
value
interface
{},
ruleName
string
)
bool
{
func
clearOptSemi
(
s
*
datafmt
.
State
,
value
interface
{},
ruleName
string
)
bool
{
*
s
.
Env
()
.
(
*
state
)
.
optSemi
=
false
;
s
.
Env
()
.
(
*
state
)
.
optSemi
=
false
;
return
true
;
return
true
;
}
}
func
setOptSemi
(
s
*
datafmt
.
State
,
value
interface
{},
ruleName
string
)
bool
{
func
setOptSemi
(
s
*
datafmt
.
State
,
value
interface
{},
ruleName
string
)
bool
{
*
s
.
Env
()
.
(
*
state
)
.
optSemi
=
true
;
s
.
Env
()
.
(
*
state
)
.
optSemi
=
true
;
return
true
;
return
true
;
}
}
func
optSemi
(
s
*
datafmt
.
State
,
value
interface
{},
ruleName
string
)
bool
{
func
optSemi
(
s
*
datafmt
.
State
,
value
interface
{},
ruleName
string
)
bool
{
if
!
*
s
.
Env
()
.
(
*
state
)
.
optSemi
{
if
!
s
.
Env
()
.
(
*
state
)
.
optSemi
{
s
.
Write
([]
byte
{
';'
});
s
.
Write
([]
byte
{
';'
});
}
}
return
true
;
return
true
;
...
@@ -109,7 +109,7 @@ func NewFormat(filename string) (Format, os.Error) {
...
@@ -109,7 +109,7 @@ func NewFormat(filename string) (Format, os.Error) {
// of bytes written and an os.Error, if any.
// of bytes written and an os.Error, if any.
//
//
func
(
f
Format
)
Fprint
(
w
io
.
Writer
,
nodes
...
)
(
int
,
os
.
Error
)
{
func
(
f
Format
)
Fprint
(
w
io
.
Writer
,
nodes
...
)
(
int
,
os
.
Error
)
{
s
:=
state
{
new
(
bool
)}
;
var
s
state
;
return
datafmt
.
Format
(
f
)
.
Fprint
(
w
,
&
s
,
nodes
);
return
datafmt
.
Format
(
f
)
.
Fprint
(
w
,
&
s
,
nodes
);
}
}
...
...
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