MCPcopy Create free account
hub / github.com/NICUP14/MiniLang / Node

Class Node

src/Def.py:320–337  ·  view source on GitHub ↗

Represents a node of the AST (operation).

Source from the content-addressed store, hash-verified

318
319
320class Node:
321 """
322 Represents a node of the AST (operation).
323 """
324
325 def __init__(self, kind: NodeKind, ntype: VariableType, value: str, left: Optional[Node] = None, right: Optional[Node] = None, middle: Optional[Node] = None):
326 self.kind = kind
327 self.ntype = ntype
328 self.value = value
329 self.left = left
330 self.right = right
331 self.middle = middle
332
333 def __str__(self) -> str:
334 attrs = []
335 for key, value in vars(self).items():
336 attrs.append(f"{key}={value}")
337 return f"{self.__class__.__name__}({', '.join(attrs)})"
338
339
340class Operand:

Callers 15

gen_treeFunction · 0.90
cast_builtinMethod · 0.90
merge_fun_callMethod · 0.90
expand_macroMethod · 0.90
try_cast_refMethod · 0.90
inject_copy_argMethod · 0.90
_process_fun_argsMethod · 0.90
_fun_callMethod · 0.90
refMethod · 0.90
to_treeMethod · 0.90
compound_statementMethod · 0.90
namespace_statementMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected