Closed Hyunwooksuh closed 2 years ago
Great bug report. The first thing that jumps out is that the error is on line 3570 of acorn.js. This is odd, since acorn.js only has 1727 lines. So I'd probably start looking at what's in your acorn file. It's not the one that JS-Interpreter uses.
Thank you sir!
if amend acorn.js as below, it works! the version is "acorn": "^8.7.0", and on the demo, you shared the acorn with version 8.7 the arcon line length is 5626 (acorn.js)
if you allow, I could make a pr for it!
1) Node update
var Node = function Node(parser, pos, loc) {
this.type = "";
this.start = pos;
this.end = 0;
if (parser) {
if (parser.options.locations)
{ this.loc = new SourceLocation(parser, loc); }
if (parser.options.directSourceFile)
{ this.sourceFile = parser.options.directSourceFile; }
if (parser.options.ranges)
{ this.range = [pos, 0]; }
}
};
2) Position update
var Position = function Position(line, col) {
this.line = line;
this.column = col;
};
Position.prototype.offset = function offset (n) {
return new Position(this.line, this.column + n)
};
var SourceLocation = function SourceLocation(p, start, end) {
this.start = start;
this.end = end;
if (p) {
if (p.sourceFile !== null) { this.source = p.sourceFile; }
}
};
JS-Interpreter ships with Acorn version 0.4.1 (from late 2013). The reason for using this ancient version is because after that time, Acorn started supporting ES6, something JS-Interpreter absolutely does not support. So we froze at that version. Version 0.4.1 is also much smaller and faster than the current version, which is also good.
and on the demo, you shared the acorn with version 8.7
Which demo is this? The only one I know of is this: https://neil.fraser.name/software/JS-Interpreter/demos/serialize.html
oh, I didn't know that JS interpreter ships with the ancient version for that reason! Thank you for your explanation. :)
First of all, it's an honor to use your amazing application. Thanks to you, I could make my own code editor!
The thing is: as I use React.js for my project, with the characteristic of re-rendering of React.js, I had to serialize the "step procedure" in redux. but whenever I try on app, there comes a error as below:
Uncaught TypeError: Cannot read properties of undefined (reading 'options')
the error point is NODE_CONSTRUCTOR, which is interpreter.ast.constructor function.
As explained in your demo and previous issues, I tried none-compressed version, which I used
acorn.js
andinterpreter.js
seperately. but the error keeps arousing.Is there any way that I can debug this error? Thank you sincerely