veoflow 0.3.0 → 0.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bin/veoflow.mjs CHANGED
@@ -6,7 +6,7 @@ const here = dirname(fileURLToPath(import.meta.url));
6
6
  process.env.VEO_CHECKERS_MODULE ??= pathToFileURL(join(here, "../dist/checkers.mjs")).href;
7
7
  process.env.VEO_NATIVE_DIR ??= join(here, "../native");
8
8
  process.env.VEO_WEB_ROOT ??= join(here, "../web");
9
- process.env.VEO_VERSION = "0.3.0";
9
+ process.env.VEO_VERSION = "0.4.1";
10
10
  const { main } = await import("../dist/veo.mjs");
11
11
  const code = await main(process.argv.slice(2), {
12
12
  out: (line) => process.stdout.write(line + "\n"),
package/dist/checkers.mjs CHANGED
@@ -358,18 +358,19 @@ function adapterDef(files, call) {
358
358
  const defs = files.get(callee.file)?.definitions ?? [];
359
359
  if (callee.exact)
360
360
  return defs.find((d) => d.span.start.line === callee.at.line && d.span.start.column === callee.at.column) ?? null;
361
- if (callee.kind === "class") {
361
+ if (callee.kind === "class" || call.form === "new") {
362
362
  const names = call.form === "jsx" ? [`${callee.name}.render`, `${callee.name}.constructor`] : [`${callee.name}.constructor`];
363
363
  for (const n of names) {
364
364
  const d = defs.find((x) => x.qualifiedName === n || x.qualifiedName.endsWith(`.${n}`));
365
365
  if (d) return d;
366
366
  }
367
- return null;
367
+ if (callee.kind === "class") return null;
368
368
  }
369
369
  const named = defs.filter((d) => d.name === callee.name);
370
+ const next = named.filter((d) => before(callee.at, d.span)).sort((a, b) => a.span.start.offset - b.span.start.offset)[0] ?? null;
371
+ if (next && next.span.start.line === callee.at.line) return next;
370
372
  const inside = named.filter((d) => contains(d.span, callee.at)).sort((a, b) => size(a) - size(b));
371
- if (inside[0]) return inside[0];
372
- return named.filter((d) => before(callee.at, d.span)).sort((a, b) => a.span.start.offset - b.span.start.offset)[0] ?? null;
373
+ return inside[0] ?? next;
373
374
  }
374
375
  function compare(adapter, checker, references = 0, candidates = 0, inScope = () => true) {
375
376
  const files = new Map(adapter.map((f) => [f.path, f]));
@@ -416,6 +417,7 @@ function compare(adapter, checker, references = 0, candidates = 0, inScope = ()
416
417
  file: rec.file,
417
418
  line: rec.site.start.line,
418
419
  column: rec.site.start.column,
420
+ end: { line: rec.site.end.line, column: rec.site.end.column },
419
421
  adapter: adapterText,
420
422
  checker: checkerText
421
423
  });