compiler: convert to manifest only methods from main pkg

manifest.json should contain only methods from the package where `Main`
function located.
This commit is contained in:
Anna Shaleva 2020-07-07 13:42:15 +03:00
parent c2dccb6314
commit f37831d173

View file

@ -341,8 +341,9 @@ func parsePairJSON(data []byte, sep string) (string, string, error) {
// Note: manifest is taken from the external source, however it can be generated ad-hoc. See #1038. // Note: manifest is taken from the external source, however it can be generated ad-hoc. See #1038.
func (di *DebugInfo) convertToManifest(fs smartcontract.PropertyState) (*manifest.Manifest, error) { func (di *DebugInfo) convertToManifest(fs smartcontract.PropertyState) (*manifest.Manifest, error) {
var ( var (
entryPoint manifest.Method entryPoint manifest.Method
err error mainNamespace string
err error
) )
for _, method := range di.Methods { for _, method := range di.Methods {
if method.Name.Name == mainIdent { if method.Name.Name == mainIdent {
@ -350,6 +351,7 @@ func (di *DebugInfo) convertToManifest(fs smartcontract.PropertyState) (*manifes
if err != nil { if err != nil {
return nil, err return nil, err
} }
mainNamespace = method.Name.Namespace
break break
} }
} }
@ -358,7 +360,7 @@ func (di *DebugInfo) convertToManifest(fs smartcontract.PropertyState) (*manifes
} }
methods := make([]manifest.Method, 0) methods := make([]manifest.Method, 0)
for _, method := range di.Methods { for _, method := range di.Methods {
if method.Name.Name != mainIdent && method.IsExported { if method.Name.Name != mainIdent && method.IsExported && method.Name.Namespace == mainNamespace {
mMethod, err := method.ToManifestMethod() mMethod, err := method.ToManifestMethod()
if err != nil { if err != nil {
return nil, err return nil, err