mirror of
https://github.com/github/codeql-action.git
synced 2026-11-14 08:41:24 +00:00
21 lines
488 B
JavaScript
21 lines
488 B
JavaScript
'use strict';
|
|
|
|
const functionTypes = new Set([
|
|
'FunctionDeclaration',
|
|
'FunctionExpression',
|
|
'ArrowFunctionExpression',
|
|
]);
|
|
|
|
module.exports = (context, badBrowser) => ({
|
|
AwaitExpression(node) {
|
|
let currentNode = node;
|
|
while (currentNode.parent) {
|
|
currentNode = currentNode.parent;
|
|
if (functionTypes.has(currentNode.type) && currentNode.async) {
|
|
return;
|
|
}
|
|
}
|
|
context.report(node, `Top-level await is not supported in ${badBrowser}`)
|
|
},
|
|
})
|