Skip to content

Commit

Permalink
Remove to_json function from preprocessor nodes
Browse files Browse the repository at this point in the history
The JSON format produced by these functions was undocumented and
was only being used by the --dump option.

Signed-off-by: John Pennycook <john.pennycook@intel.com>
  • Loading branch information
Pennycook committed Apr 3, 2024
1 parent 2a307f1 commit 7f5bbcb
Showing 1 changed file with 0 additions and 40 deletions.
40 changes: 0 additions & 40 deletions codebasin/preprocessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,12 +551,6 @@ def add_child(self, child):
self.children.append(child)
child.parent = self

def to_json(self, assoc):
return {
"platforms": list(assoc[self]),
"children": [x.to_json(assoc) for x in self.children],
}

@staticmethod
def is_start_node():
"""
Expand Down Expand Up @@ -614,17 +608,6 @@ def __compute_file_hash(self):

return hasher.hexdigest()

def to_json(self, assoc):
parent_json = super().to_json(assoc)
mydict = {
"type": "file",
"file": self.filename,
"name": os.path.basename(self.filename),
"sloc": self.total_sloc,
}
parent_json.update(mydict)
return parent_json

def __repr__(self):
return _representation_string(self, attrs=["filename"])

Expand Down Expand Up @@ -653,23 +636,6 @@ def __init__(self, start_line=-1, end_line=-1, num_lines=0, source=None):
self.num_lines = num_lines
self.source = source

def to_json(self, assoc):
parent_json = super().to_json(assoc)
if self.source:
source = "\n".join(self.source)
else:
source = None

mydict = {
"type": "code",
"start_line": self.start_line,
"end_line": self.end_line,
"sloc": self.num_lines,
"source": source,
}
parent_json.update(mydict)
return parent_json

def __repr__(self):
return _representation_string(
self,
Expand Down Expand Up @@ -707,12 +673,6 @@ class DirectiveNode(CodeNode):
def __init__(self):
super().__init__()

def to_json(self, assoc):
parent_json = super().to_json(assoc)
mydict = {"type": "directive", "source": "\n".join(self.spelling())}
parent_json.update(mydict)
return parent_json


class UnrecognizedDirectiveNode(DirectiveNode):
"""
Expand Down

0 comments on commit 7f5bbcb

Please sign in to comment.