Js2Py
Js2Py copied to clipboard
how get js function code
in js,function.toString() can get function code
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))