async is only a reserved word in specific contexts; as a plain identifier it is valid, and V8/Node accept it. The parser currently rejects two such cases:
// 1. calling a function named `async`
function async(cb) { return cb; }
async(1); // SyntaxError: expected token 'identifier', got '1'
// 2. binding named `async`
const async = 5; // SyntaxError: abrupt end
async;
These already work, so async is accepted as a property/method name but not as a binding or a call target:
const o = { async: 1 }; o.async; // ok
const o = { async() {} }; o.async(); // ok
This isn't purely academic: the widely used asynckit package (a transitive dependency of axios, form-data, …) calls a function it names async, so loading axios fails with the error above.
Possibly a regression or an uncovered case from #2275 / #2936, which added async-as-identifier support.
Environment: boa_engine main at commit 39cd112.
asyncis only a reserved word in specific contexts; as a plain identifier it is valid, and V8/Node accept it. The parser currently rejects two such cases:These already work, so
asyncis accepted as a property/method name but not as a binding or a call target:This isn't purely academic: the widely used
asynckitpackage (a transitive dependency ofaxios,form-data, …) calls a function it namesasync, so loadingaxiosfails with the error above.Possibly a regression or an uncovered case from #2275 / #2936, which added
async-as-identifier support.Environment: boa_engine
mainat commit39cd112.