Skip to content

Commit

Permalink
build dep graph with tuples instead of # (#73)
Browse files Browse the repository at this point in the history
  • Loading branch information
akashsurwase1 authored Mar 26, 2024
1 parent 26645ea commit fd621dc
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions trlc/trlc.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,15 +349,15 @@ def build_graph(self):
parser = container[file_name]
parser.parse_preamble(kind)
pkg_name = parser.cu.package.name
if pkg_name + "#rsl" not in graph:
graph[pkg_name + "#rsl"] = set()
graph[pkg_name + "#check"] = set([pkg_name + "#rsl"])
graph[pkg_name + "#trlc"] = set([pkg_name + "#rsl",
pkg_name + "#check"])
files[pkg_name + "#rsl"] = set()
files[pkg_name + "#check"] = set()
files[pkg_name + "#trlc"] = set()
files[pkg_name + "#" + kind].add(file_name)
if (pkg_name , "rsl") not in graph:
graph[(pkg_name , "rsl")] = set()
graph[(pkg_name , "check")] = set([(pkg_name , "rsl")])
graph[(pkg_name , "trlc")] = set([(pkg_name , "rsl"),
(pkg_name , "check")])
files[(pkg_name , "rsl")] = set()
files[(pkg_name , "check")] = set()
files[(pkg_name , "trlc")] = set()
files[(pkg_name , kind)].add(file_name)
except TRLC_Error:
ok = False
self.files_with_preamble_errors.add(file_name)
Expand All @@ -373,18 +373,18 @@ def build_graph(self):
pkg_name = parser.cu.package.name
parser.cu.resolve_imports(self.mh, self.stab)

graph[pkg_name + "#" + kind] |= \
{imported_pkg.name + "#" + kind
graph[(pkg_name , kind)] |= \
{(imported_pkg.name , kind)
for imported_pkg in parser.cu.imports}

# Build closure for our files
work_list = {parser.cu.package.name + "#" + "rsl"
work_list = {(parser.cu.package.name , "rsl")
for parser in self.rsl_files.values()
if parser.cu.package and parser.primary}
work_list |= {parser.cu.package.name + "#" + "check"
work_list |= {(parser.cu.package.name , "check")
for parser in self.check_files.values()
if parser.cu.package and parser.primary}
work_list |= {parser.cu.package.name + "#" + "trlc"
work_list |= {(parser.cu.package.name , "trlc")
for parser in self.trlc_files.values()
if parser.cu.package and parser.primary}
work_list &= set(graph)
Expand Down Expand Up @@ -415,7 +415,7 @@ def parse_rsl_files(self):
ok = True

# Select RSL files that we should parse
rsl_map = {parser.cu.package.name + "#rsl": parser
rsl_map = {(parser.cu.package.name , "rsl"): parser
for parser in self.rsl_files.values()
if parser.cu.package and (parser.primary or
parser.secondary)}
Expand Down

0 comments on commit fd621dc

Please sign in to comment.