Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
ld
go-ld-prime
Commits
1b282cfa
Commit
1b282cfa
authored
Jan 22, 2021
by
Eric Myhre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
schema: connect validation, Compile() now works.
More rules are still to come.
parent
b6009032
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
3 deletions
+16
-3
schema/compiler.go
schema/compiler.go
+15
-2
schema/dmt/compile.go
schema/dmt/compile.go
+1
-1
No files found.
schema/compiler.go
View file @
1b282cfa
...
...
@@ -66,8 +66,21 @@ func (c *Compiler) Init() {
}
}
func
(
c
*
Compiler
)
Compile
()
(
*
TypeSystem
,
error
)
{
panic
(
"TODO"
)
func
(
c
*
Compiler
)
Compile
()
(
*
TypeSystem
,
[]
error
)
{
var
errs
[]
error
for
_
,
typ
:=
range
c
.
ts
.
list
{
validate
(
c
.
ts
,
typ
,
&
errs
)
}
// TODO sort ts.anonTypes
for
_
,
typ
:=
range
c
.
ts
.
anonTypes
{
validate
(
c
.
ts
,
typ
,
&
errs
)
}
if
errs
!=
nil
{
return
nil
,
errs
}
result
:=
c
.
ts
c
.
ts
=
nil
// result shall now be immutable
return
result
,
nil
}
func
(
c
*
Compiler
)
MustCompile
()
*
TypeSystem
{
...
...
schema/dmt/compile.go
View file @
1b282cfa
...
...
@@ -10,7 +10,7 @@ import (
// and so we've just chained it all together with switch statements;
// creating a separate interface per result type seems just not super relevant.
func
(
schdmt
Schema
)
Compile
()
(
*
schema
.
TypeSystem
,
error
)
{
func
(
schdmt
Schema
)
Compile
()
(
*
schema
.
TypeSystem
,
[]
error
)
{
c
:=
&
schema
.
Compiler
{}
typesdmt
:=
schdmt
.
FieldTypes
()
for
itr
:=
typesdmt
.
Iterator
();
!
itr
.
Done
();
{
...
...
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