PiotrDabkowski/Js2Py

how get js function code

dreamfly32 opened this issue · 1 comments

in js,function.toString() can get function code
image
in my,i need get function local var , so what should i do? thanks

If just executing the code is not an option, maybe you can extract what you need from the bytecode disassembly?

import js2py
import dis

context = js2py.EvalJs()  
context.execute('''
function sum(a, b) {
    return a + b
}
''')

print(dis.dis(context.sum._obj.code))