Skip to content

Commit

Permalink
fixup(gen): adds the changes to the generator
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexandreBelling committed Oct 17, 2024
1 parent f85aad1 commit 7db76b0
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions prover/wizard/internal/generator/metadata.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,16 @@ func ({{ .RcvrName }} *{{ .TypeName }}) ListTags() []string {
return {{ .RcvrName }}.metadata.listTags()
}

func ({{ .RcvrName }} *{{ .TypeName }}) HasTag(tag string) bool {
tags := {{ .RcvrName }}.Tags()
for i := range tags {
if tags[i] == tag {
return true
}
}
return false
}

func ({{ .RcvrName }} *{{ .TypeName }}) String() string {
return {{.RcvrName}}.metadata.scope.getFullScope() + "/" + {{ .RcvrName }}.metadata.nameOrDefault({{ .RcvrName }}) + "/" + strconv.Itoa(int({{ .RcvrName }}.metadata.id))
}
Expand All @@ -56,24 +66,24 @@ func ({{ .RcvrName }} *{{ .TypeName }}) id() id {
{{- end }}

{{- if eq true .IsNoResultQuery }}
// ComputeResult does not return any result for [{{ .TypeName }}] because Global
// computeResult does not return any result for [{{ .TypeName }}] because Global
// constraints do not return results as they are purely constraints that must
// be satisfied.
func ({{ .RcvrName }} {{ .TypeName }}) ComputeResult(run Runtime) QueryResult {
func ({{ .RcvrName }} {{ .TypeName }}) computeResult(run Runtime) QueryResult {
return &QueryResNone{}
}

// ComputeResult does not return any result for [{{ .TypeName }}] because Global
// computeResult does not return any result for [{{ .TypeName }}] because Global
// constraints do not return results.
func ({{ .RcvrName }} {{ .TypeName }}) ComputeResultGnark(_ frontend.API, run GnarkRuntime) QueryResultGnark {
func ({{ .RcvrName }} {{ .TypeName }}) computeResultGnark(_ frontend.API, run RuntimeGnark) QueryResultGnark {
return &QueryResNoneGnark{}
}
{{- end}}

{{- if eq true .IsQueryWithResult }}
func ({{ .RcvrName }} {{ .TypeName }}) Check(run Runtime) error {
var (
v = {{ .RcvrName }}.ComputeResult(run).(*QueryResFE).R
v = {{ .RcvrName }}.computeResult(run).(*QueryResFE).R
qr2, okQr2 = run.tryGetQueryRes(&{{ .RcvrName }})
v2 = qr2.(*QueryResFE).R
)
Expand All @@ -89,10 +99,10 @@ func ({{ .RcvrName }} {{ .TypeName }}) Check(run Runtime) error {
return nil
}

func ({{ .RcvrName }} {{ .TypeName }}) CheckGnark(api frontend.API, run GnarkRuntime) {
func ({{ .RcvrName }} {{ .TypeName }}) CheckGnark(api frontend.API, run RuntimeGnark) {

var (
v = {{ .RcvrName }}.ComputeResultGnark(api, run).(*QueryResFEGnark).R
v = {{ .RcvrName }}.computeResultGnark(api, run).(*QueryResFEGnark).R
qr2, okQr2 = run.tryGetQueryRes(&{{ .RcvrName }})
v2 = qr2.(*QueryResFEGnark).R
)
Expand Down

0 comments on commit 7db76b0

Please sign in to comment.