Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neo
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Jobs
Commits
Open sidebar
Kirill Smelkov
neo
Commits
8f4526be
Commit
8f4526be
authored
Dec 28, 2016
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
7d9d91d5
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
138 additions
and
131 deletions
+138
-131
t/neo/marshal.go
t/neo/marshal.go
+129
-129
t/neo/protogen.go
t/neo/protogen.go
+9
-2
No files found.
t/neo/marshal.go
View file @
8f4526be
This diff is collapsed.
Click to expand it.
t/neo/protogen.go
View file @
8f4526be
...
...
@@ -48,6 +48,12 @@ func pos(x interface { Pos() token.Pos }) token.Position {
return
fset
.
Position
(
x
.
Pos
())
}
// get type name relative to neo package
var
neoQualifier
types
.
Qualifier
func
typeName
(
typ
types
.
Type
)
string
{
return
types
.
TypeString
(
typ
,
neoQualifier
)
}
func
main
()
{
var
err
error
...
...
@@ -67,10 +73,11 @@ func main() {
}
conf
:=
types
.
Config
{
Importer
:
importer
.
Default
()}
_
,
err
=
conf
.
Check
(
"neo"
,
fset
,
fv
,
info
)
neoPkg
,
err
:
=
conf
.
Check
(
"neo"
,
fset
,
fv
,
info
)
if
err
!=
nil
{
log
.
Fatalf
(
"typecheck: %v"
,
err
)
}
neoQualifier
=
types
.
RelativeTo
(
neoPkg
)
//ncode := 0
...
...
@@ -266,7 +273,7 @@ func (d *decoder) emitobjtype(assignto string, obj types.Object, typ types.Type)
// typ is a named type over some basic, like
// type ClusterState int32
// -> need to cast
decoded
=
fmt
.
Sprintf
(
"%v(%v)"
,
typ
,
decoded
)
decoded
=
fmt
.
Sprintf
(
"%v(%v)"
,
typ
eName
(
typ
)
,
decoded
)
}
d
.
emit
(
"%s = %s"
,
assignto
,
decoded
)
...
...
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