Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
start: {
line: 0,
column: 0,
},
end: {
line: 0,
column: 1,
},
},
value: code,
};
// @ts-ignore
const scopeManager = new ScopeManager({});
// @ts-ignore
const globalScope = new Scope(scopeManager, 'module', null, ast, false);
preprocessNode(ast);
return {
ast,
scopeManager,
visitorKeys: KEYS,
services: {
convertNodeSourceSpanToLoc(sourceSpan: {
start: { line: number; col: any };
end: { line: number; col: any };
}) {
return {
start: {
line: sourceSpan.start.line + 1,
column: sourceSpan.start.col,
_nestTypeParamScope(node) {
if (!node.typeParameters) {
return null;
}
const parentScope = this.scopeManager.__currentScope;
const scope = new escope.Scope(
this.scopeManager,
"type-parameters",
parentScope,
node,
false,
);
this.scopeManager.__nestScope(scope);
for (let j = 0; j < node.typeParameters.params.length; j++) {
const name = node.typeParameters.params[j];
scope.__define(name, new Definition("TypeParameter", name, name));
if (name.typeAnnotation) {
this._checkIdentifierOrVisit(name);
}
}
scope.__define = function() {
function nestTypeParamScope(manager, node) {
var parentScope = manager.__currentScope;
var scope = new escope.Scope(
manager,
'type-parameters',
parentScope,
node,
false
);
manager.__nestScope(scope);
for (var j = 0; j < node.typeParameters.params.length; j++) {
var name = node.typeParameters.params[j];
scope.__define(name, new Definition('TypeParameter', name, name));
if (name.typeAnnotation) {
checkIdentifierOrVisit.call(this, name);
}
}
scope.__define = function() {
return parentScope.__define.apply(parentScope, arguments);
function nestTypeParamScope(manager, node) {
var parentScope = manager.__currentScope;
var scope = new escope.Scope(
manager,
'type-parameters',
parentScope,
node,
false
);
manager.__nestScope(scope);
for (var j = 0; j < node.typeParameters.params.length; j++) {
var name = node.typeParameters.params[j];
scope.__define(name, new Definition('TypeParameter', name, name));
if (name.typeAnnotation) {
checkIdentifierOrVisit.call(this, name);
}
}
scope.__define = function() {
return parentScope.__define.apply(parentScope, arguments);