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. // DebugInfo represents smart-contract debug information.
type DebugInfo struct { type DebugInfo struct {
Hash util.Uint160 `json:"hash"` Hash util.Uint160 `json:"hash"`
EntryPoint string `json:"entrypoint"` Documents []string `json:"documents"`
Documents []string `json:"documents"` Methods []MethodDebugInfo `json:"methods"`
Methods []MethodDebugInfo `json:"methods"` Events []EventDebugInfo `json:"events"`
Events []EventDebugInfo `json:"events"`
} }
// MethodDebugInfo represents smart-contract's method debug information. // 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 { func (c *codegen) emitDebugInfo(contract []byte) *DebugInfo {
d := &DebugInfo{ d := &DebugInfo{
Hash: hash.Hash160(contract), Hash: hash.Hash160(contract),
EntryPoint: mainIdent, Events: []EventDebugInfo{},
Events: []EventDebugInfo{},
} }
for name, scope := range c.funcs { for name, scope := range c.funcs {
m := c.methodInfoFromScope(name, scope) 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 { func (di *DebugInfo) convertToABI(fs smartcontract.PropertyState) ABI {
methods := make([]Method, 0) methods := make([]Method, 0)
for _, method := range di.Methods { for _, method := range di.Methods {
if method.Name.Name == di.EntryPoint { if method.Name.Name == mainIdent {
methods = append(methods, Method{ methods = append(methods, Method{
Name: method.Name.Name, Name: method.Name.Name,
Parameters: method.Parameters, Parameters: method.Parameters,
@ -340,7 +338,7 @@ func (di *DebugInfo) convertToABI(fs smartcontract.PropertyState) ABI {
HasStorage: fs&smartcontract.HasStorage != 0, HasStorage: fs&smartcontract.HasStorage != 0,
IsPayable: fs&smartcontract.IsPayable != 0, IsPayable: fs&smartcontract.IsPayable != 0,
}, },
EntryPoint: di.EntryPoint, EntryPoint: mainIdent,
Functions: methods, Functions: methods,
Events: events, Events: events,
} }

View file

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