'use strict'; const createsBlockScope = require("../scope/creates-block-scope"); const createsFunctionScope = require("../scope/creates-function-scope"); /* FIXME: Find a better solution for this? */ const FUNCTION_SCOPE = 1; const BLOCK_SCOPE = 2; module.exports = function () { let scopeId = 0; return { onEnter: function onEnter(node) { if (createsFunctionScope(node)) { node._scopeId = scopeId++; node._scopeType = FUNCTION_SCOPE; } if (createsBlockScope(node)) { node._scopeId = scopeId++; node._scopeType = BLOCK_SCOPE; } } }; };