File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change @@ -135,8 +135,10 @@ public static string GetOperandString(this Instruction instruction)
135135 static readonly Lazy < IReadOnlyDictionary < uint , string > > sysCallNames = new Lazy < IReadOnlyDictionary < uint , string > > (
136136 ( ) => ApplicationEngine . Services . ToImmutableDictionary ( kvp => kvp . Value . Hash , kvp => kvp . Value . Name ) ) ;
137137
138- public static string GetComment ( this Instruction instruction , int ip )
138+ public static string GetComment ( this Instruction instruction , int ip , MethodToken [ ] ? tokens = null )
139139 {
140+ tokens ??= Array . Empty < MethodToken > ( ) ;
141+
140142 switch ( instruction . OpCode )
141143 {
142144 case OpCode . PUSHINT8 :
@@ -162,8 +164,18 @@ public static string GetComment(this Instruction instruction, int ip)
162164 }
163165 case OpCode . SYSCALL :
164166 return sysCallNames . Value . TryGetValue ( instruction . TokenU32 , out var name )
165- ? name
167+ ? $ " { name } SysCall"
166168 : $ "Unknown SysCall { instruction . TokenU32 } ";
169+ case OpCode . CALLT :
170+ {
171+ int index = instruction . TokenU16 ;
172+ if ( index >= tokens . Length )
173+ return $ "Unknown token { instruction . TokenU16 } ";
174+ var token = tokens [ index ] ;
175+ var contract = NativeContract . Contracts . SingleOrDefault ( c => c . Hash == token . Hash ) ;
176+ var tokenName = contract is null ? $ "{ token . Hash } " : contract . Name ;
177+ return $ "{ tokenName } .{ token . Method } token call";
178+ }
167179 case OpCode . INITSLOT :
168180 return $ "{ instruction . TokenU8 } local variables, { instruction . TokenU8_1 } arguments";
169181 case OpCode . JMP_L :
You can’t perform that action at this time.
0 commit comments