Skip to content

Commit 5d87c42

Browse files
committed
Remove to_json function from preprocessor nodes
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>
1 parent 35608c6 commit 5d87c42

File tree

1 file changed

+0
-40
lines changed

1 file changed

+0
-40
lines changed

codebasin/preprocessor.py

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -551,12 +551,6 @@ def add_child(self, child):
551551
self.children.append(child)
552552
child.parent = self
553553

554-
def to_json(self, assoc):
555-
return {
556-
"platforms": list(assoc[self]),
557-
"children": [x.to_json(assoc) for x in self.children],
558-
}
559-
560554
@staticmethod
561555
def is_start_node():
562556
"""
@@ -614,17 +608,6 @@ def __compute_file_hash(self):
614608

615609
return hasher.hexdigest()
616610

617-
def to_json(self, assoc):
618-
parent_json = super().to_json(assoc)
619-
mydict = {
620-
"type": "file",
621-
"file": self.filename,
622-
"name": os.path.basename(self.filename),
623-
"sloc": self.total_sloc,
624-
}
625-
parent_json.update(mydict)
626-
return parent_json
627-
628611
def __repr__(self):
629612
return _representation_string(self, attrs=["filename"])
630613

@@ -653,23 +636,6 @@ def __init__(self, start_line=-1, end_line=-1, num_lines=0, source=None):
653636
self.num_lines = num_lines
654637
self.source = source
655638

656-
def to_json(self, assoc):
657-
parent_json = super().to_json(assoc)
658-
if self.source:
659-
source = "\n".join(self.source)
660-
else:
661-
source = None
662-
663-
mydict = {
664-
"type": "code",
665-
"start_line": self.start_line,
666-
"end_line": self.end_line,
667-
"sloc": self.num_lines,
668-
"source": source,
669-
}
670-
parent_json.update(mydict)
671-
return parent_json
672-
673639
def __repr__(self):
674640
return _representation_string(
675641
self,
@@ -707,12 +673,6 @@ class DirectiveNode(CodeNode):
707673
def __init__(self):
708674
super().__init__()
709675

710-
def to_json(self, assoc):
711-
parent_json = super().to_json(assoc)
712-
mydict = {"type": "directive", "source": "\n".join(self.spelling())}
713-
parent_json.update(mydict)
714-
return parent_json
715-
716676

717677
class UnrecognizedDirectiveNode(DirectiveNode):
718678
"""

0 commit comments

Comments
 (0)