1414// You should have received a copy of the GNU Lesser General Public License
1515// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.
1616
17- // Provides support for dealing with EVM assembly instructions (e.g., disassembling them).
17+ // Package asm provides support for dealing with EVM assembly instructions (e.g., disassembling them).
1818package asm
1919
2020import (
@@ -34,14 +34,14 @@ type instructionIterator struct {
3434 started bool
3535}
3636
37- // Create a new instruction iterator.
37+ // NewInstructionIterator create a new instruction iterator.
3838func NewInstructionIterator (code []byte ) * instructionIterator {
3939 it := new (instructionIterator )
4040 it .code = code
4141 return it
4242}
4343
44- // Returns true if there is a next instruction and moves on.
44+ // Next returns true if there is a next instruction and moves on.
4545func (it * instructionIterator ) Next () bool {
4646 if it .error != nil || uint64 (len (it .code )) <= it .pc {
4747 // We previously reached an error or the end.
@@ -79,27 +79,27 @@ func (it *instructionIterator) Next() bool {
7979 return true
8080}
8181
82- // Returns any error that may have been encountered.
82+ // Error returns any error that may have been encountered.
8383func (it * instructionIterator ) Error () error {
8484 return it .error
8585}
8686
87- // Returns the PC of the current instruction.
87+ // PC returns the PC of the current instruction.
8888func (it * instructionIterator ) PC () uint64 {
8989 return it .pc
9090}
9191
92- // Returns the opcode of the current instruction.
92+ // Op returns the opcode of the current instruction.
9393func (it * instructionIterator ) Op () vm.OpCode {
9494 return it .op
9595}
9696
97- // Returns the argument of the current instruction.
97+ // Arg returns the argument of the current instruction.
9898func (it * instructionIterator ) Arg () []byte {
9999 return it .arg
100100}
101101
102- // Pretty -print all disassembled EVM instructions to stdout.
102+ // PrintDisassembled pretty -print all disassembled EVM instructions to stdout.
103103func PrintDisassembled (code string ) error {
104104 script , err := hex .DecodeString (code )
105105 if err != nil {
@@ -117,7 +117,7 @@ func PrintDisassembled(code string) error {
117117 return it .Error ()
118118}
119119
120- // Return all disassembled EVM instructions in human-readable format.
120+ // Disassemble returns all disassembled EVM instructions in human-readable format.
121121func Disassemble (script []byte ) ([]string , error ) {
122122 instrs := make ([]string , 0 )
123123
0 commit comments