mirror of
https://github.com/Ed94/pikuma_ps1.git
synced 2026-08-03 22:28:47 +00:00
progress
This commit is contained in:
@@ -337,8 +337,13 @@ function M.run(ctx)
|
|||||||
local dir_atoms = 0
|
local dir_atoms = 0
|
||||||
local dir_errors = {}
|
local dir_errors = {}
|
||||||
local dir_warnings = {}
|
local dir_warnings = {}
|
||||||
|
-- Per-source validate() results, cached for the report pass (it reads from this instead of re-validating each source).
|
||||||
|
ctx.flags = ctx.flags or {}
|
||||||
|
ctx.flags._annot_source_results = ctx.flags._annot_source_results or {}
|
||||||
for _, src in ipairs(dir_sources) do
|
for _, src in ipairs(dir_sources) do
|
||||||
local result = validate(ctx, src)
|
local result = validate(ctx, src)
|
||||||
|
result.source = src.path -- tag for downstream rendering
|
||||||
|
ctx.flags._annot_source_results[src.path] = result -- stash so report.lua reads from cache instead of re-running validate()
|
||||||
dir_atoms = dir_atoms + #result.atoms
|
dir_atoms = dir_atoms + #result.atoms
|
||||||
for _, e in ipairs(result.errors) do
|
for _, e in ipairs(result.errors) do
|
||||||
dir_errors[#dir_errors + 1] = { line = e.line, msg = e.msg, source = src.path }
|
dir_errors[#dir_errors + 1] = { line = e.line, msg = e.msg, source = src.path }
|
||||||
|
|||||||
@@ -346,20 +346,23 @@ end
|
|||||||
-- Orchestration helpers
|
-- Orchestration helpers
|
||||||
-- ════════════════════════════════════════════════════════════════════════════
|
-- ════════════════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
-- (internal) Validate each source in `dir_sources` via the annotation pass, tagging each result with `result.source = src.path` for downstream rendering.
|
-- (internal) Pull per-source validate() results from the annotation pass's stash.
|
||||||
|
-- The annotation pass runs first in the dep chain and caches results in `ctx.flags._annot_source_results`; we read from there instead of re-validating each source.
|
||||||
-- Returns the list of module results + the flat list of all results (for the project-wide summary).
|
-- Returns the list of module results + the flat list of all results (for the project-wide summary).
|
||||||
-- @param ctx PassCtx
|
-- @param ctx PassCtx
|
||||||
-- @param dir_sources SourceFile[]
|
-- @param dir_sources SourceFile[]
|
||||||
-- @return AnnotationResult[], AnnotationResult[]
|
-- @return AnnotationResult[], AnnotationResult[]
|
||||||
local function validate_module_sources(ctx, dir_sources)
|
local function lookup_module_results(ctx, dir_sources)
|
||||||
local annotation = require("passes.annotation")
|
local src_cache = (ctx.flags and ctx.flags._annot_source_results) or {}
|
||||||
local module_results = {}
|
local module_results = {}
|
||||||
local all_results = {}
|
local all_results = {}
|
||||||
for _, src in ipairs(dir_sources) do
|
for _, src in ipairs(dir_sources) do
|
||||||
local result = annotation.validate(ctx, src)
|
local result = src_cache[src.path]
|
||||||
result.source = src.path
|
if result then
|
||||||
module_results[#module_results + 1] = result
|
result.source = src.path -- defensive (annotation tags it too; this guards against cache misses from earlier iterations)
|
||||||
all_results[#all_results + 1] = result
|
module_results[#module_results + 1] = result
|
||||||
|
all_results[#all_results + 1] = result
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return module_results, all_results
|
return module_results, all_results
|
||||||
end
|
end
|
||||||
@@ -411,7 +414,7 @@ function M.run(ctx)
|
|||||||
|
|
||||||
if entry.atoms_count > 0 or #(by_dir[entry.dir] or {}) > 0 then
|
if entry.atoms_count > 0 or #(by_dir[entry.dir] or {}) > 0 then
|
||||||
local dir_sources = by_dir[entry.dir] or {}
|
local dir_sources = by_dir[entry.dir] or {}
|
||||||
local module_results, all_results = validate_module_sources(ctx, dir_sources)
|
local module_results, all_results = lookup_module_results(ctx, dir_sources)
|
||||||
for _, r in ipairs(all_results) do
|
for _, r in ipairs(all_results) do
|
||||||
all_results_for_summary[#all_results_for_summary + 1] = r
|
all_results_for_summary[#all_results_for_summary + 1] = r
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user