File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change @@ -47,12 +47,13 @@ const opcodeMnemonics = [
4747] ;
4848
4949class Instruction {
50- constructor ( opcode , operands ) {
50+ constructor ( opcode , operands , bytecodeOffset ) {
5151 if ( typeof opcode !== 'number' ) throw TypeError ( 'opcode must be a number' ) ;
5252 if ( ! Array . isArray ( operands ) ) throw TypeError ( 'operands must be an array' ) ;
5353
5454 this . opcode = opcode ;
5555 this . operands = operands ;
56+ this . bytecodeOffset = bytecodeOffset ;
5657 }
5758
5859 toString ( ) {
@@ -163,7 +164,7 @@ class InstructionParser {
163164
164165 while ( offset < bytecode . length ) {
165166 const current = bytecode [ offset ++ ] ;
166- const instruction = new Instruction ( current , [ ] ) ;
167+ const instruction = new Instruction ( current , [ ] , offset - 1 ) ;
167168
168169 switch ( current ) {
169170 // https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-6.html#jvms-6.5.lookupswitch
You can’t perform that action at this time.
0 commit comments