Error using Gulp+RapydScript: TypeError: Cannot read property 'comments_before' of undefined
I have an error when I run a Gulp task with some codes (the most simple codes compiles ok). If I compile the code using the CLI all is good.
{ [TypeError: Cannot read property 'comments_before' of undefined] name: 'TypeError', message: 'Cannot read property \'comments_before\' of undefined', stack: 'TypeError: Cannot read property \'comments_before\' of undefined\n at Throw.ast.Node.add_comments (node_modules/rapydscript/lib/rapydscript.js:7276:83)\n at Throw.ast.Node.print (node_modules/rapydscript/lib/rapydscript.js:7254:22)\n at node_modules/rapydscript/lib/rapydscript.js:7435:26\n at Array.forEach (native)\n at display_body (node_modules/rapydscript/lib/rapydscript.js:7432:18)\n at display_complex_body (node_modules/rapydscript/lib/rapydscript.js:7590:13)\n at node_modules/rapydscript/lib/rapydscript.js:7779:25\n at node_modules/rapydscript/lib/rapydscript.js:6939:23\n at Stream.with_indent (node_modules/rapydscript/lib/rapydscript.js:6832:20)\n at Object.with_block (node_modules/rapydscript/lib/rapydscript.js:6938:13)',
I could run my gulp task commenting out this code (line 7276 in rapydscript.js):
Line 7276
/* if (self instanceof ast.Exit && self.value && self.value.start.comments_before.length > 0) { comments = (comments || []).concat(self.value.start.comments_before); self.value.start.comments_before = []; }*/
Best regards.
Should be fixed now.
Hi Atsepkov, In my case, the error still happen.
[10:41:25] { TypeError: Cannot set property 'comments_before' of undefined at Throw.ast.Node.add_comments (node_modules\rapydscript\lib\rapydscr ipt.js:7278:58)
I modify the rapydscript.js this way:
Line 7276
if (self instanceof ast.Exit && self.value) { comments = (comments || []); //self.value.start.comments_before = []; }
And then it is working fine.
I have installed the version: "rapydscript": "^0.5.55" rapydscript.js.txt
Ok, I'll take a look again.