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
32c39fa1
Commit
32c39fa1
authored
Mar 23, 2010
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
go/printer: avoid reflect in print
R=gri CC=golang-dev
https://golang.org/cl/704041
parent
29f1ca52
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
7 deletions
+5
-7
src/pkg/go/printer/printer.go
src/pkg/go/printer/printer.go
+5
-7
No files found.
src/pkg/go/printer/printer.go
View file @
32c39fa1
...
...
@@ -739,16 +739,13 @@ func (p *printer) writeWhitespace(n int) {
// space for best comment placement. Then, any leftover whitespace is
// printed, followed by the actual token.
//
func
(
p
*
printer
)
print
(
args
...
)
{
v
:=
reflect
.
NewValue
(
args
)
.
(
*
reflect
.
StructValue
)
for
i
:=
0
;
i
<
v
.
NumField
();
i
++
{
f
:=
v
.
Field
(
i
)
func
(
p
*
printer
)
print
(
args
...
interface
{})
{
for
_
,
f
:=
range
args
{
next
:=
p
.
pos
// estimated position of next item
var
data
[]
byte
var
tag
HTMLTag
isKeyword
:=
false
switch
x
:=
f
.
Interface
()
.
(
type
)
{
switch
x
:=
f
.
(
type
)
{
case
whiteSpace
:
if
x
==
ignore
{
// don't add ignore's to the buffer; they
...
...
@@ -795,7 +792,8 @@ func (p *printer) print(args ...) {
next
=
x
// accurate position of next item
}
default
:
panicln
(
"print: unsupported argument type"
,
f
.
Type
()
.
String
())
fmt
.
Fprintf
(
os
.
Stderr
,
"print: unsupported argument type %T
\n
"
,
f
)
panic
()
}
p
.
pos
=
next
...
...
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