diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2018-12-06 18:53:57 +0100 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-12-06 18:56:08 +0100 |
| commit | ab4b148b34b55427cf82f4dd67f0773aada301be (patch) | |
| tree | 2e8c7b5c4ad7f7722a357b43bfbce68f2505ee69 /prog | |
| parent | ceaec61a833bf78e2aa2a1feb964e1915d3f465b (diff) | |
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.
Diffstat (limited to 'prog')
| -rw-r--r-- | prog/prog.go | 8 | ||||
| -rw-r--r-- | prog/size.go | 4 | ||||
| -rw-r--r-- | prog/validation.go | 4 |
3 files changed, 8 insertions, 8 deletions
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, |
