You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
js-analyzer/src/ast/scope/creates-function-scope.js

18 lines
416 B
JavaScript

'use strict';
/*
special case: in a function...
if defaults: function param env + body declaration env
if no defaults: single shared env
this is to keep default-expressions from seeing the body-declared variables
*/
module.exports = function createsFunctionScope(node) {
return (
node.type === "FunctionDeclaration" ||
node.type === "FunctionExpression" ||
node.type === "ArrowFunctionExpression"
);
};