class documentation

class Binding: (source)

View In Hierarchy

A Binding assigns a binding to a (specific) variable. Bindings will therefore be stored in a dictionary in the Variable class, mapping strings to Binding instances. Depending on context, a Binding might also be called a "Source" (if it's used for creating another binding) or a "goal" (if we want to find a solution for a path through the program that assigns it). A binding has history ("origins"): It knows where the binding was originally retrieved from, before being assigned to something else here. Origins contain, through source_sets, "sources", which are other bindings.

Method __init__ Initialize a new Binding. Usually called through Variable.AddBinding.
Method __repr__ Undocumented
Method AddOrigin Add another possible origin to this binding.
Method AssignToNewVariable Assign this binding to a new variable.
Method CopyOrigins Copy the origins from another binding.
Method FindOrigin Return an Origin instance for a CFGNode, or None.
Method HasSource Does this binding depend on a given source?
Method IsVisible Can we "see" this binding from the current cfg node?
Class Variable __slots__ Undocumented
Instance Variable data Undocumented
Instance Variable id Undocumented
Instance Variable origins Undocumented
Instance Variable program Undocumented
Instance Variable variable Undocumented
Method _FindOrAddOrigin Undocumented
Instance Variable _cfgnode_to_origin Undocumented
def __init__(self, program, id_num, variable, data): (source)

Initialize a new Binding. Usually called through Variable.AddBinding.

def __repr__(self): (source)

Undocumented

def AddOrigin(self, where, source_set): (source)

Add another possible origin to this binding.

def AssignToNewVariable(self, where=None): (source)

Assign this binding to a new variable.

def CopyOrigins(self, other_binding, where, additional_sources=None): (source)

Copy the origins from another binding.

def FindOrigin(self, cfg_node): (source)

Return an Origin instance for a CFGNode, or None.

def HasSource(self, binding): (source)

Does this binding depend on a given source?

def IsVisible(self, viewpoint): (source)

Can we "see" this binding from the current cfg node? This will run a solver to determine whether there's a path through the program that makes our variable have this binding at the given CFG node. Arguments: viewpoint: The CFG node at which this binding is possible / not possible. Returns: True if there is at least one path through the program in which the binding was assigned (and not overwritten afterwards), and all the bindings it depends on were assigned (and not overwritten) before that, etc.

__slots__: tuple[str, ...] = (source)

Undocumented

Undocumented

Undocumented

Undocumented

Undocumented

variable = (source)

Undocumented

def _FindOrAddOrigin(self, cfg_node): (source)

Undocumented

_cfgnode_to_origin: dict = (source)

Undocumented