Question: is it possible to store source code in bytecode? #215
-
How complex it will be to add to store source of function/class etc to bytecode? Let say. I have js code like this:
When it will be compile it to bytecode and then run the output will not be as expected. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 4 replies
-
Converted to a discussion because that should already Just Work(TM) after commit b478329. If it doesn't, please provide more details. |
Beta Was this translation helpful? Give feedback.
-
Works here:
|
Beta Was this translation helpful? Give feedback.
-
Thank you for the answer. Probably you didn't understand me. This is an example that demonstrates the problem: $ git describe --tags
$ ./qjsc -e ./test.js -o test.c $ ./a.out
$ ./qjs ./test.js
As you can see using previously generated bytecode the source code in not available. Probably this is expected result by many to minimize bytecode size. Source code is not saved during bytes code save. |
Beta Was this translation helpful? Give feedback.
-
Stripping the source from applications compiled to C should be an option if no longer the default. Quickjs has the extension "use strip" pseudo directive for this purpose. A command line option should be added too. |
Beta Was this translation helpful? Give feedback.
Okay, I've turned it back into an issue: #217