Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Levin Zimmermann
neoppod
Commits
dca2750d
Commit
dca2750d
authored
Jan 26, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
604c81aa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
27 deletions
+6
-27
t/neo/protogen.go
t/neo/protogen.go
+6
-27
No files found.
t/neo/protogen.go
View file @
dca2750d
...
...
@@ -479,17 +479,14 @@ func (e *encoder) generatedCode() string {
return
code
.
String
()
}
// XXX place?
// XXX place?
naming?
// data <- data[pos:]
// // nread += pos XXX clarify about nread update
// pos <- 0
func
(
d
*
decoder
)
resetPos
()
{
if
d
.
n
!=
0
{
d
.
emit
(
"data = data[%v:]"
,
d
.
n
)
//d.emit("%v += %v", d.var_("nread"), d.n)
}
d
.
n
=
0
}
}
// XXX place?
...
...
@@ -507,6 +504,7 @@ func (d *decoder) resetPos() {
// it is inserted
// - before reading a variable sized item
// - in the beginning of a loop inside
// - right after loop exit
func
(
d
*
decoder
)
overflowCheckPoint
()
{
// nop if we know overflow was already checked
if
d
.
overflowCheck
.
checked
{
...
...
@@ -645,11 +643,7 @@ func (d *decoder) genSlice1(assignto string, typ types.Type) {
d
.
emit
(
"{"
)
d
.
genBasic
(
"l:"
,
types
.
Typ
[
types
.
Uint32
],
nil
)
// XXX vvv = resetPos but with nread += ... + l
// XXX -> resetPos("l") ?
d
.
emit
(
"data = data[%v:]"
,
d
.
n
)
//d.emit("%v += %v + l", d.var_("nread"), d.n)
d
.
n
=
0
d
.
resetPos
()
d
.
overflowCheckPoint
()
d
.
overflowCheck
.
AddExpr
(
"l"
)
...
...
@@ -750,15 +744,7 @@ func (d *decoder) genSlice(assignto string, typ *types.Slice, obj types.Object)
codegenType
(
"(*a)"
,
typ
.
Elem
(),
obj
,
d
)
// d.resetPos() with nread update optionally skipped
// XXX ^^^ criteria to skip is overflowCheck.Checked
if
d
.
n
!=
0
{
d
.
emit
(
"data = data[%v:]"
,
d
.
n
)
//if !elemFixed {
// d.emit("%v += %v", d.var_("nread"), d.n)
//}
d
.
n
=
0
}
d
.
resetPos
()
d
.
emit
(
"}"
)
d
.
overflowCheckPoint
()
...
...
@@ -866,14 +852,7 @@ func (d *decoder) genMap(assignto string, typ *types.Map, obj types.Object) {
d
.
emit
(
"m[key] = v"
)
}
// d.resetPos() with nread update optionally skipped
if
d
.
n
!=
0
{
d
.
emit
(
"data = data[%v:]"
,
d
.
n
)
//if !itemFixed {
// d.emit("%v += %v", d.var_("nread"), d.n)
//}
d
.
n
=
0
}
d
.
resetPos
()
d
.
emit
(
"}"
)
d
.
emit
(
"}"
)
...
...
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