From ab4b148b34b55427cf82f4dd67f0773aada301be Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 6 Dec 2018 18:53:57 +0100 Subject: prog: add Prog.Finalize Prog.Finalize combines assignSizesCall, SanitizeCall and validate. Intended for users who build own programs, so that we don't need to expose all individual methods. --- prog/prog.go | 8 ++++++++ prog/size.go | 4 ---- prog/validation.go | 4 ---- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'prog') diff --git a/prog/prog.go b/prog/prog.go index 575680882..69c76c019 100644 --- a/prog/prog.go +++ b/prog/prog.go @@ -20,6 +20,14 @@ type Call struct { Comment string } +func (p *Prog) Finalize() error { + for _, c := range p.Calls { + p.Target.assignSizesCall(c) + p.Target.SanitizeCall(c) + } + return p.validate() +} + type Arg interface { Type() Type Size() uint64 diff --git a/prog/size.go b/prog/size.go index a8f51bdef..c16e7f647 100644 --- a/prog/size.go +++ b/prog/size.go @@ -112,10 +112,6 @@ func (target *Target) assignSizesArray(args []Arg) { } } -func (target *Target) AssignSizesCall(c *Call) { - target.assignSizesCall(c) -} - func (target *Target) assignSizesCall(c *Call) { target.assignSizesArray(c.Args) } diff --git a/prog/validation.go b/prog/validation.go index e169ffa26..e7a015c64 100644 --- a/prog/validation.go +++ b/prog/validation.go @@ -23,10 +23,6 @@ type validCtx struct { uses map[Arg]Arg } -func (p *Prog) Validate() error { - return p.validate() -} - func (p *Prog) validate() error { ctx := &validCtx{ target: p.Target, -- cgit mrf-deployment