in src/Linters/ASTLinter.hack [46:109]
final public async function getLintErrorsAsync(
): Awaitable<vec<ASTLintError>> {
$ast = await __Private\ASTCache::get()->fetchAsync($this->getFile());
$this->ast = $ast;
$targets = dict[];
$ancestor = static::getAncestorType();
if ($ancestor === Script::class) {
$context = $ast as this::TContext;
$targets = Vec\map(
$ast->getDescendantsByType<this::TNode>(),
$node ==> tuple($context, $node),
);
} else {
foreach ($ast->getDescendantsByType<this::TContext>() as $context) {
foreach ($context->getDescendantsByType<this::TNode>() as $node) {
$targets[$node->getUniqueID()] = tuple($context, $node);
}
}
}
$errors = vec[];
foreach ($targets as list($context, $node)) {
try {
$error = $this->getLintErrorForNode($context, $node);
} catch (LinterException $e) {
if ($e->getPosition() !== null) {
throw $e;
}
try {
$position = find_position($this->getAST(), $node);
} catch (\Throwable $_) {
throw $e;
}
throw new LinterException(
$e->getLinterClass(),
$e->getFileBeingLinted(),
$e->getRawMessage(),
$position,
$e->getPrevious(),
);
} catch (\Throwable $t) {
try {
$position = find_position($this->getAST(), $node);
} catch (\Throwable $_) {
throw $t;
}
throw new LinterException(
static::class,
$this->getFile()->getPath(),
$t->getMessage(),
$position,
$t,
);
}
if (
$error !== null &&
!SuppressASTLinter\is_linter_error_suppressed($this, $node, $ast)
) {
$errors[] = $error;
}
}
return $errors;
}