Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function getMethodInfos() {
const methodInfos = new KeyValueCache();
for (const node of inspector.getWrappedNodes()) {
// todo: what is going on here? Why does this need to be filled
getMethodInfoForNode(node); // fill this
const nodeBase = node.getBase();
if (nodeBase != null)
fillBase(node, nodeBase);
fillMixinable(node, node);
}
const allowedBaseNames = ["Node", "Expression", "BooleanLiteral"];
for (const kindToWrapperMapping of kindToWrapperMappings.filter(v => allowedBaseNames.indexOf(v.wrapperName) >= 0)) {
for (const syntaxKindName of kindToWrapperMapping.syntaxKindNames) {
methodInfos.set(syntaxKindName, {
name: syntaxKindName,
wrapperName: kindToWrapperMapping.wrapperName,
function renameNode(node: Node) {
errors.throwIfWhitespaceOrNotString(newName, nameof(newName));
if (node.getText() === newName)
return;
const renameLocations = languageService.findRenameLocations(node, options);
const renameLocationsBySourceFile = new KeyValueCache();
for (const renameLocation of renameLocations) {
const locations = renameLocationsBySourceFile.getOrCreate(renameLocation.getSourceFile(), () => []);
locations.push(renameLocation);
}
for (const [sourceFile, locations] of renameLocationsBySourceFile.getEntries()) {
replaceSourceFileTextForRename({
sourceFile,
renameLocations: locations,
newName
});
}
}
}
function getAccessors() {
type GetOrSetArray = (GetAccessorDeclaration | SetAccessorDeclaration)[];
const result = new KeyValueCache();
for (const accessor of [...classDec.getGetAccessors(), ...classDec.getSetAccessors()]) {
if (accessor.isStatic() === isStatic && accessor.getScope() === Scope.Public)
result.getOrCreate(accessor.getName(), () => []).push(accessor);
}
return result.getValuesAsArray();
}
}
*getAllByDepth() {
const dirLevels = new KeyValueCache();
let depth = 0;
this.getOrphans().forEach(addToDirLevels);
depth = Math.min(...Array.from(dirLevels.getKeys()));
while (dirLevels.getSize() > 0) {
for (const dir of dirLevels.get(depth) || []) {
yield dir;
dir.getDirectories().forEach(addToDirLevels);
}
dirLevels.removeByKey(depth);
depth++;
}
function addToDirLevels(dir: Directory) {
const dirDepth = dir._getDepth();