All files

src/compiler/project_frontend.panack

Green: covered; red: known zero; amber: unavailable. Blank lines are outside the executable-start-line denominator.

    1 pub import project/src/compiler/loader::{LoadedProject}
    2 import project/src/compiler/loader::{ProjectPreparationContext, loaded_package_binding_graph}
    3 pub import project/src/project_model/package_project::{ManifestDependencyProject}
    4 pub import stdlib/package_filesystem::{FilesystemRootIdentity}
    5 import project/src/compiler/module_emission::{ModuleBindingGraph, ModuleEmissionResult, module_emission_program}
    6 pub import project/src/compiler/module_bindings::{ModuleIdentity}
    7 pub import project/src/compiler/parser::{Program}
    8 pub import project/src/compiler/types::{Diagnostic}
    9 
   10 pub pure namespace_gate_diagnostic(diagnostic: Diagnostic): Bool {
   11   diagnostic.message == "namespace syntax is parsed but execution is not yet supported (language namespace migration pending)"
   12 }
   13 
   14 // Prepare the exact executable declaration set for compiler tooling. Namespace
   15 // loading retains a temporary parser gate in diagnostics; the checked identity
   16 // pipeline is authoritative for every project and emits one shared program for
   17 // compile, inventory, coverage, and source-map commands.
   18 pub pure prepare_project_program(
   19   project: LoadedProject,
   20   project_root: Str,
   21   stdlib_root: Str,
   22   entry: ModuleIdentity
   23 ): Result[Program, [Diagnostic]] {
   24   prepare_project_program_with_dependencies(
   25     project, project_root, stdlib_root, entry, false, FilesystemRootIdentity(0, 0), []
   26   )
   27 }
   28 
   29 pub pure prepare_project_program_with_dependencies(
   30   project: LoadedProject,
   31   project_root: Str,
   32   stdlib_root: Str,
   33   entry: ModuleIdentity,
   34   package_confined: Bool,
   35   package_root_identity: FilesystemRootIdentity,
   36   dependencies: [ManifestDependencyProject]
   37 ): Result[Program, [Diagnostic]] {
   38   mut diagnostics: [Diagnostic] = []
   39   for diagnostic in project.diagnostics {
   40     if !namespace_gate_diagnostic(diagnostic) {
   41       diagnostics = diagnostics.append(diagnostic)
   42     }
   43   }
   44   if diagnostics.len() > 0 {
   45     Error(diagnostics)
   46   } else {
   47     requested: ProjectPreparationContext = ProjectPreparationContext(
   48       project_root, stdlib_root, entry,
   49       package_confined, package_root_identity, dependencies
   50     )
   51     if project.identity_ready && project.effects_checked && project.preparation == Some(requested) {
   52       Ok(project.program)
   53     } else {
   54       graph: ModuleBindingGraph = loaded_package_binding_graph(
   55         project.modules,
   56         project_root,
   57         stdlib_root,
   58         package_confined,
   59         package_root_identity,
   60         dependencies
   61       )
   62       emitted: ModuleEmissionResult = module_emission_program(
   63         graph,
   64         project.modules,
   65         project.module_signatures,
   66         project.module_bodies,
   67         entry
   68       )
   69       if emitted.diagnostics.len() > 0 {
   70         Error(emitted.diagnostics)
   71       } else {
   72         Ok(emitted.program)
   73       }
   74     }
   75   }
   76 }
   77 

Functions

[
  {
    "id": "declaration/8",
    "name": "namespace_gate_diagnostic",
    "line": 10,
    "state": "covered",
    "entries": "3"
  },
  {
    "id": "declaration/9",
    "name": "prepare_project_program",
    "line": 18,
    "state": "covered",
    "entries": "2"
  },
  {
    "id": "declaration/10",
    "name": "prepare_project_program_with_dependencies",
    "line": 29,
    "state": "covered",
    "entries": "85"
  }
]

Source branch outcomes

[
  {
    "id": "declaration/10/statement/1/decision/body",
    "outcome": "body",
    "line": 39,
    "state": "covered",
    "hits": "3"
  },
  {
    "id": "declaration/10/statement/1/decision/exit",
    "outcome": "exit",
    "line": 39,
    "state": "covered",
    "hits": "85"
  },
  {
    "id": "declaration/10/statement/1/body/tail/decision/true",
    "outcome": "true",
    "line": 40,
    "state": "covered",
    "hits": "3"
  },
  {
    "id": "declaration/10/statement/1/body/tail/decision/false",
    "outcome": "false",
    "line": 40,
    "state": "zero",
    "hits": "0"
  },
  {
    "id": "declaration/10/tail/decision/true",
    "outcome": "true",
    "line": 44,
    "state": "covered",
    "hits": "3"
  },
  {
    "id": "declaration/10/tail/decision/false",
    "outcome": "false",
    "line": 44,
    "state": "covered",
    "hits": "82"
  },
  {
    "id": "declaration/10/tail/false/tail/decision/true",
    "outcome": "true",
    "line": 51,
    "state": "covered",
    "hits": "10"
  },
  {
    "id": "declaration/10/tail/false/tail/decision/false",
    "outcome": "false",
    "line": 51,
    "state": "covered",
    "hits": "72"
  },
  {
    "id": "declaration/10/tail/false/tail/condition/decision/evaluate-right",
    "outcome": "evaluate-right",
    "line": 51,
    "state": "covered",
    "hits": "76"
  },
  {
    "id": "declaration/10/tail/false/tail/condition/decision/skip-right",
    "outcome": "skip-right",
    "line": 51,
    "state": "covered",
    "hits": "6"
  },
  {
    "id": "declaration/10/tail/false/tail/condition/left/decision/evaluate-right",
    "outcome": "evaluate-right",
    "line": 51,
    "state": "covered",
    "hits": "79"
  },
  {
    "id": "declaration/10/tail/false/tail/condition/left/decision/skip-right",
    "outcome": "skip-right",
    "line": 51,
    "state": "covered",
    "hits": "3"
  },
  {
    "id": "declaration/10/tail/false/tail/false/tail/decision/true",
    "outcome": "true",
    "line": 69,
    "state": "zero",
    "hits": "0"
  },
  {
    "id": "declaration/10/tail/false/tail/false/tail/decision/false",
    "outcome": "false",
    "line": 69,
    "state": "covered",
    "hits": "72"
  }
]

Reviewed declaration exclusions

[
  {
    "id": "declaration/0",
    "reason": "import",
    "line": 1
  },
  {
    "id": "declaration/1",
    "reason": "import",
    "line": 2
  },
  {
    "id": "declaration/2",
    "reason": "import",
    "line": 3
  },
  {
    "id": "declaration/3",
    "reason": "import",
    "line": 4
  },
  {
    "id": "declaration/4",
    "reason": "import",
    "line": 5
  },
  {
    "id": "declaration/5",
    "reason": "import",
    "line": 6
  },
  {
    "id": "declaration/6",
    "reason": "import",
    "line": 7
  },
  {
    "id": "declaration/7",
    "reason": "import",
    "line": 8
  }
]