compiler: remove entrypoint from debug info

part of #1088
This commit is contained in:
Anna Shaleva 2020-06-24 08:55:24 +03:00
parent 4d07d72677
commit 6cc3d9bcc3
2 changed files with 10 additions and 13 deletions

View file

@ -16,11 +16,10 @@ import (
// DebugInfo represents smart-contract debug information.
type DebugInfo struct {
Hash util.Uint160 `json:"hash"`
EntryPoint string `json:"entrypoint"`
Documents []string `json:"documents"`
Methods []MethodDebugInfo `json:"methods"`
Events []EventDebugInfo `json:"events"`
Hash util.Uint160 `json:"hash"`
Documents []string `json:"documents"`
Methods []MethodDebugInfo `json:"methods"`
Events []EventDebugInfo `json:"events"`
}
// MethodDebugInfo represents smart-contract's method debug information.
@ -134,9 +133,8 @@ func (c *codegen) saveSequencePoint(n ast.Node) {
func (c *codegen) emitDebugInfo(contract []byte) *DebugInfo {
d := &DebugInfo{
Hash: hash.Hash160(contract),
EntryPoint: mainIdent,
Events: []EventDebugInfo{},
Hash: hash.Hash160(contract),
Events: []EventDebugInfo{},
}
for name, scope := range c.funcs {
m := c.methodInfoFromScope(name, scope)
@ -318,7 +316,7 @@ func parsePairJSON(data []byte, sep string) (string, string, error) {
func (di *DebugInfo) convertToABI(fs smartcontract.PropertyState) ABI {
methods := make([]Method, 0)
for _, method := range di.Methods {
if method.Name.Name == di.EntryPoint {
if method.Name.Name == mainIdent {
methods = append(methods, Method{
Name: method.Name.Name,
Parameters: method.Parameters,
@ -340,7 +338,7 @@ func (di *DebugInfo) convertToABI(fs smartcontract.PropertyState) ABI {
HasStorage: fs&smartcontract.HasStorage != 0,
IsPayable: fs&smartcontract.IsPayable != 0,
},
EntryPoint: di.EntryPoint,
EntryPoint: mainIdent,
Functions: methods,
Events: events,
}

View file

@ -178,9 +178,8 @@ func TestSequencePoints(t *testing.T) {
func TestDebugInfo_MarshalJSON(t *testing.T) {
d := &DebugInfo{
Hash: util.Uint160{10, 11, 12, 13},
EntryPoint: "main",
Documents: []string{"/path/to/file"},
Hash: util.Uint160{10, 11, 12, 13},
Documents: []string{"/path/to/file"},
Methods: []MethodDebugInfo{
{
ID: "id1",