From 2200f7ff71f82c94c41bbd292754acc8886fa498 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Tue, 7 Jul 2020 12:01:39 +0300 Subject: [PATCH] compiler: lowercase the first letter of methods in manifest In order to be compatable with NEP5 standards and C# node we have to keep the first letter of each manifest method lowercased. --- pkg/compiler/debug.go | 2 +- pkg/compiler/debug_test.go | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/pkg/compiler/debug.go b/pkg/compiler/debug.go index 69af761e3..5c9129710 100644 --- a/pkg/compiler/debug.go +++ b/pkg/compiler/debug.go @@ -269,7 +269,7 @@ func (m *MethodDebugInfo) ToManifestMethod() (manifest.Method, error) { if err != nil { return result, err } - result.Name = m.Name.Name + result.Name = strings.ToLower(string(m.Name.Name[0])) + m.Name.Name[1:] result.Parameters = parameters result.ReturnType = returnType return result, nil diff --git a/pkg/compiler/debug_test.go b/pkg/compiler/debug_test.go index 800f38b94..107456318 100644 --- a/pkg/compiler/debug_test.go +++ b/pkg/compiler/debug_test.go @@ -133,7 +133,7 @@ func unexportedMethod() int { return 1 } ABI: manifest.ABI{ Hash: hash.Hash160(buf), EntryPoint: manifest.Method{ - Name: "Main", + Name: "main", Parameters: []manifest.Parameter{ { Name: "op", @@ -144,7 +144,7 @@ func unexportedMethod() int { return 1 } }, Methods: []manifest.Method{ { - Name: "MethodInt", + Name: "methodInt", Parameters: []manifest.Parameter{ { Name: "a", @@ -154,27 +154,27 @@ func unexportedMethod() int { return 1 } ReturnType: smartcontract.IntegerType, }, { - Name: "MethodString", + Name: "methodString", Parameters: []manifest.Parameter{}, ReturnType: smartcontract.StringType, }, { - Name: "MethodByteArray", + Name: "methodByteArray", Parameters: []manifest.Parameter{}, ReturnType: smartcontract.ByteArrayType, }, { - Name: "MethodArray", + Name: "methodArray", Parameters: []manifest.Parameter{}, ReturnType: smartcontract.ArrayType, }, { - Name: "MethodStruct", + Name: "methodStruct", Parameters: []manifest.Parameter{}, ReturnType: smartcontract.ArrayType, }, { - Name: "MethodConcat", + Name: "methodConcat", Parameters: []manifest.Parameter{ { Name: "a",