mirror of
https://github.com/nspcc-dev/neo-go.git
synced 2024-12-23 13:41:37 +00:00
compiler: make DebugInfo.convertToManifest public
Allow to generate manifest when using compiler as a library.
This commit is contained in:
parent
7d8fead1fd
commit
04bf357fa5
3 changed files with 4 additions and 4 deletions
|
@ -134,7 +134,7 @@ func CompileAndSave(src string, o *Options) ([]byte, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if o.ManifestFile != "" {
|
if o.ManifestFile != "" {
|
||||||
m, err := di.convertToManifest(o.ContractFeatures)
|
m, err := di.ConvertToManifest(o.ContractFeatures)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return b, errors.Wrap(err, "failed to convert debug info to manifest")
|
return b, errors.Wrap(err, "failed to convert debug info to manifest")
|
||||||
}
|
}
|
||||||
|
|
|
@ -338,9 +338,9 @@ func parsePairJSON(data []byte, sep string) (string, string, error) {
|
||||||
return ss[0], ss[1], nil
|
return ss[0], ss[1], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// convertToManifest converts contract to the manifest.Manifest struct for debugger.
|
// ConvertToManifest converts contract to the manifest.Manifest struct for debugger.
|
||||||
// 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 (
|
||||||
mainNamespace string
|
mainNamespace string
|
||||||
err error
|
err error
|
||||||
|
|
|
@ -127,7 +127,7 @@ func unexportedMethod() int { return 1 }
|
||||||
}
|
}
|
||||||
|
|
||||||
t.Run("convert to Manifest", func(t *testing.T) {
|
t.Run("convert to Manifest", func(t *testing.T) {
|
||||||
actual, err := d.convertToManifest(smartcontract.HasStorage)
|
actual, err := d.ConvertToManifest(smartcontract.HasStorage)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
// note: offsets are hard to predict, so we just take them from the output
|
// note: offsets are hard to predict, so we just take them from the output
|
||||||
expected := &manifest.Manifest{
|
expected := &manifest.Manifest{
|
||||||
|
|
Loading…
Reference in a new issue