pipelineutils.nim 1.1 KB

123456789101112131415161718192021222324252627
  1. import ast, options, lineinfos, pathutils, msgs, modulegraphs, packages
  2. proc skipCodegen*(config: ConfigRef; n: PNode): bool {.inline.} =
  3. # can be used by codegen passes to determine whether they should do
  4. # something with `n`. Currently, this ignores `n` and uses the global
  5. # error count instead.
  6. result = config.errorCounter > 0
  7. proc resolveMod*(conf: ConfigRef; module, relativeTo: string): FileIndex =
  8. let fullPath = findModule(conf, module, relativeTo)
  9. if fullPath.isEmpty:
  10. result = InvalidFileIdx
  11. else:
  12. result = fileInfoIdx(conf, fullPath)
  13. proc prepareConfigNotes*(graph: ModuleGraph; module: PSym) =
  14. # don't be verbose unless the module belongs to the main package:
  15. if graph.config.belongsToProjectPackage(module):
  16. graph.config.notes = graph.config.mainPackageNotes
  17. else:
  18. if graph.config.mainPackageNotes == {}: graph.config.mainPackageNotes = graph.config.notes
  19. graph.config.notes = graph.config.foreignPackageNotes
  20. proc moduleHasChanged*(graph: ModuleGraph; module: PSym): bool {.inline.} =
  21. result = true
  22. #module.id >= 0 or isDefined(graph.config, "nimBackendAssumesChange")