MCPcopy Create free account
hub / github.com/CPChain/chain / Next

Method Next

core/asm/asm.go:45–80  ·  view source on GitHub ↗

Returns true if there is a next instruction and moves on.

()

Source from the content-addressed store, hash-verified

43
44// Returns true if there is a next instruction and moves on.
45func (it *instructionIterator) Next() bool {
46 if it.error != nil || uint64(len(it.code)) <= it.pc {
47 // We previously reached an error or the end.
48 return false
49 }
50
51 if it.started {
52 // Since the iteration has been already started we move to the next instruction.
53 if it.arg != nil {
54 it.pc += uint64(len(it.arg))
55 }
56 it.pc++
57 } else {
58 // We start the iteration from the first instruction.
59 it.started = true
60 }
61
62 if uint64(len(it.code)) <= it.pc {
63 // We reached the end.
64 return false
65 }
66
67 it.op = vm.OpCode(it.code[it.pc])
68 if it.op.IsPush() {
69 a := uint64(it.op) - uint64(vm.PUSH1) + 1
70 u := it.pc + 1 + a
71 if uint64(len(it.code)) <= it.pc || uint64(len(it.code)) < u {
72 it.error = fmt.Errorf("incomplete push instruction at %v", it.pc)
73 return false
74 }
75 it.arg = it.code[it.pc+1 : u]
76 } else {
77 it.arg = nil
78 }
79 return true
80}
81
82// Returns any error that may have been encountered.
83func (it *instructionIterator) Error() error {

Callers 12

TestLDBDatabase_IteratorFunction · 0.45
PrintDisassembledFunction · 0.45
DisassembleFunction · 0.45
deletePatternFunction · 0.45
ExportPreimagesFunction · 0.45
storageRangeAtFunction · 0.45
getModifiedAccountsMethod · 0.45
forEachKeyFunction · 0.45
findCallerFunction · 0.45

Calls 1

IsPushMethod · 0.80

Tested by 5

TestLDBDatabase_IteratorFunction · 0.36
forEachKeyFunction · 0.36