You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constAcorn=require('acorn')constParser=Acorn.ParserconstparseExpressionAt=Parser.parseExpressionAt.bind(Parser)conststr='try { assert(condition, message)\n'+' } catch (e) {\n'+' throw e\n'+' }\n'+'\n'+'// Now run tests\n'+'\n'+'console.log(\'Call assert proxy with slightly minified whitespace\')\n'+'try {\n'+' assertProxySlightlyMinified(0)\n'+' console.error(`assertProxySlightlyMinified(0); failed to cause an exception`)\n'+'} catch (e) {\n'+' console.log(`assertProxySlightlyMinified(0); generated exception: ${e}`)\n'+'}\n'+'\n'+'console.log(\'Finished tests\')'constres=Parser.parseExpressionAt(str,0)console.log(res)
C:\Users\Himself65\Desktop\github\test>node index.js
C:\Users\Himself65\Desktop\github\test\node_modules\acorn\dist\acorn.js:2838
throw err
^
SyntaxError: Unexpected token (1:0)
at Parser.pp$4.raise (C:\Users\Himself65\Desktop\github\test\node_modules\?[4macorn?[24m\dist\acorn.js:2836:15)
at Parser.pp.unexpected (C:\Users\Himself65\Desktop\github\test\node_modules\?[4macorn?[24m\dist\acorn.js:689:10)
at Parser.pp$3.parseExprAtom (C:\Users\Himself65\Desktop\github\test\node_modules\?[4macorn?[24m\dist\acorn.js:2260:12)
at Parser.pp$3.parseExprSubscripts (C:\Users\Himself65\Desktop\github\test\node_modules\?[4macorn?[24m\dist\acorn.js:2089:21)
at Parser.pp$3.parseMaybeUnary (C:\Users\Himself65\Desktop\github\test\node_modules\?[4macorn?[24m\dist\acorn.js:2066:19)
at Parser.pp$3.parseExprOps (C:\Users\Himself65\Desktop\github\test\node_modules\?[4macorn?[24m\dist\acorn.js:2010:21)
at Parser.pp$3.parseMaybeConditional (C:\Users\Himself65\Desktop\github\test\node_modules\?[4macorn?[24m\dist\acorn.js:1993:21)
at Parser.pp$3.parseMaybeAssign (C:\Users\Himself65\Desktop\github\test\node_modules\?[4macorn?[24m\dist\acorn.js:1968:21)
at Parser.pp$3.parseExpression (C:\Users\Himself65\Desktop\github\test\node_modules\?[4macorn?[24m\dist\acorn.js:1933:21)
at Function.parseExpressionAt (C:\Users\Himself65\Desktop\github\test\node_modules\?[4macorn?[24m\dist\acorn.js:582:19) {
pos: ?[33m0?[39m,
loc: Position { line: ?[33m1?[39m, column: ?[33m0?[39m },
raisedAt: ?[33m3?[39m
}
but it success when remove try {
constAcorn=require('acorn')constParser=Acorn.ParserconstparseExpressionAt=Parser.parseExpressionAt.bind(Parser)conststr=' assert(condition, message)\n'+' } catch (e) {\n'+' throw e\n'+' }\n'+'\n'+'// Now run tests\n'+'\n'+'console.log(\'Call assert proxy with slightly minified whitespace\')\n'+'try {\n'+' assertProxySlightlyMinified(0)\n'+' console.error(`assertProxySlightlyMinified(0); failed to cause an exception`)\n'+'} catch (e) {\n'+' console.log(`assertProxySlightlyMinified(0); generated exception: ${e}`)\n'+'}\n'+'\n'+'console.log(\'Finished tests\')'constres=Parser.parseExpressionAt(str,0)console.log(res)
related issue nodejs/node#30872
but it success when remove
try {
The text was updated successfully, but these errors were encountered: