mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-11 15:34:26 +00:00
accounts/abi: fix case of generated java functions (#18372)
This commit is contained in:
parent
e58441b317
commit
75c14d2cdb
1 changed files with 7 additions and 4 deletions
|
|
@ -322,7 +322,7 @@ var namedType = map[Lang]func(string, abi.Type) string{
|
||||||
// methodNormalizer is a name transformer that modifies Solidity method names to
|
// methodNormalizer is a name transformer that modifies Solidity method names to
|
||||||
// conform to target language naming concentions.
|
// conform to target language naming concentions.
|
||||||
var methodNormalizer = map[Lang]func(string) string{
|
var methodNormalizer = map[Lang]func(string) string{
|
||||||
LangGo: capitalise,
|
LangGo: abi.ToCamelCase,
|
||||||
}
|
}
|
||||||
|
|
||||||
// capitalise makes a camel-case string which starts with an upper case character.
|
// capitalise makes a camel-case string which starts with an upper case character.
|
||||||
|
|
@ -332,9 +332,12 @@ func capitalise(input string) string {
|
||||||
|
|
||||||
// decapitalise makes a camel-case string which starts with a lower case character.
|
// decapitalise makes a camel-case string which starts with a lower case character.
|
||||||
func decapitalise(input string) string {
|
func decapitalise(input string) string {
|
||||||
// NOTE: This is the current behavior, it doesn't match the comment
|
if len(input) == 0 {
|
||||||
// above and needs to be investigated.
|
return input
|
||||||
return abi.ToCamelCase(input)
|
}
|
||||||
|
|
||||||
|
goForm := abi.ToCamelCase(input)
|
||||||
|
return strings.ToLower(goForm[:1]) + goForm[1:]
|
||||||
}
|
}
|
||||||
|
|
||||||
// structured checks whether a list of ABI data types has enough information to
|
// structured checks whether a list of ABI data types has enough information to
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue