compiler: check range first, analyze funcs then

Type data is added while walking through function ins/outs even if we're to
throw this function away. But we don't need it, these types are not used, so
we can deal with the main part of #3071 by optimizing this out.

Signed-off-by: Roman Khimov <roman@nspcc.ru>
This commit is contained in:
Roman Khimov 2023-11-21 17:48:53 +03:00
parent 7f9e2e5047
commit a5d041a1ac
6 changed files with 2 additions and 2638 deletions

View file

@ -206,10 +206,10 @@ func (c *codegen) emitDebugInfo(contract []byte) *DebugInfo {
start := len(d.Methods)
d.NamedTypes = make(map[string]binding.ExtendedType)
for name, scope := range c.funcs {
m := c.methodInfoFromScope(name, scope, d.NamedTypes)
if m.Range.Start == m.Range.End {
if scope.rng.Start == scope.rng.End {
continue
}
m := c.methodInfoFromScope(name, scope, d.NamedTypes)
d.Methods = append(d.Methods, *m)
}
sort.Slice(d.Methods[start:], func(i, j int) bool {