compiler: deduplicate autoguessed event names, fix #3088
Make them stable wrt parameter order and use proper names in event structures as well. Signed-off-by: Roman Khimov <roman@nspcc.ru>
This commit is contained in:
parent
a5d041a1ac
commit
5370034955
2 changed files with 50 additions and 8 deletions
|
@ -388,12 +388,6 @@ func CompileAndSave(src string, o *Options) ([]byte, error) {
|
|||
}
|
||||
}
|
||||
eBindingName := rpcbinding.ToEventBindingName(eventName)
|
||||
for typeName, extType := range exampleUsage.ExtTypes {
|
||||
if _, ok := cfg.NamedTypes[typeName]; !ok {
|
||||
cfg.NamedTypes[typeName] = extType
|
||||
}
|
||||
}
|
||||
|
||||
for _, p := range exampleUsage.Params {
|
||||
pBindingName := rpcbinding.ToParameterBindingName(p.Name)
|
||||
pname := eBindingName + "." + pBindingName
|
||||
|
@ -403,6 +397,15 @@ func CompileAndSave(src string, o *Options) ([]byte, error) {
|
|||
}
|
||||
}
|
||||
if p.ExtendedType != nil {
|
||||
typeName := p.ExtendedType.Name
|
||||
if extType, ok := exampleUsage.ExtTypes[typeName]; ok {
|
||||
for _, ok := cfg.NamedTypes[typeName]; ok; _, ok = cfg.NamedTypes[typeName] {
|
||||
typeName = typeName + "X"
|
||||
}
|
||||
extType.Name = typeName
|
||||
p.ExtendedType.Name = typeName
|
||||
cfg.NamedTypes[typeName] = extType
|
||||
}
|
||||
if _, ok := cfg.Types[pname]; !ok {
|
||||
cfg.Types[pname] = *p.ExtendedType
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue