Closed ChrisAcrobat closed 2 years ago
I'll investigate some more, but I get different results when I use the combined acorn_interpreter.js
or the them separata (acorn.js
, interpreter.js
).
If I first do:
interpreter = new Interpreter(someSafeDependencies);
interpreter.run(); // Init system dependencies.
And then do:
stepsRemaining = 1000; // someSafeDependencies should not affect stepsRemaining.
interpreter.appendCode(jsCode);
while(interpreter.step() && 0 < stepsRemaining){
stepsRemaining--;
}
Then it starts to step after someSafeDependencies
, right?
For a moment it looked like then do
happened twice or something, but it sorted it self out. Apparently global function onmessage
caused problem for me when I tried to override it (I was sure it worked last week, but I guess not.), but I fixed it by adding let onmessage = null;
to someSafeDependencies
.
So now everything works when I use them separata (acorn.js, interpreter.js), but not combined acorn_interpreter.js
. Then I still get interpreter.ast is undefined
.
Maybe relates to #229?
Yes, the documentation specifically calls out:
Another limitation is that serialization reaches beyond the public API, and thus does not work with the compressed bundle (acorn_interpreter.js).
The .ast
property is also not listed in the public API, thus it gets renamed (looking at the source, it appears to be called .ka
today, but that may change with every recompression).
If you need access to non-public functions or properties, then you should use the uncompressed version.
Sorry, I interpreted that differently when read it quickly and thought that it wouldn't affect my use case. Thanks for the help!
I have compared against the public demo, but I can't see what I am doing wrong (if any). Property interpreter.ast in function
recordAcornConstructons
isundefined
for me for some reason when I try to serialize seedrandom.js. The code is taken through Babel.Babel.transform(seedrandomSource, {'presets': ['es2015']}).code