abstract class Bindgen::Graph::Node

Overview

A node in the method graph. Base class of all elements in the graph.

To add a Node into a Container pass the container instance as parent to #initialize. This lets you quickly build hierarchies.

Direct Known Subclasses

Defined in:

bindgen/graph/node.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new(name : String, parent : Container | Nil = nil) #

[View source]

Instance Method Detail

def constant? : Bool #

Is this node kind a constant in Crystal?


[View source]
def crystal_prefix : String #

Node-kind prefix for a nicely readable path, according to Crystal.


[View source]
def diagnostics_path : String #

Gives a humanly-readable path string, formatted for Crystal.


[View source]
def find_root : Node #

Finds the root of this node. The root node is the one with a #parent of nil.


[View source]
def full_path : Array(Node) #

Gives a list of nodes, going from the root node all the way to this node. This node will be the last item in the result, and the root will be the first.

The result list does not contain any PlatformSpecific nodes, even if one was encountered while traversing.


[View source]
def kind_name : String #

The kind name of this node for diagnostic purposes.


[View source]
def name : String #

Name of this node.


[View source]
def parent : Container | Nil #

Parent node, or nil if it's tKeyErrorhis node has no parent.


[View source]
def parent=(parent : Container | Nil) #

Parent node, or nil if it's tKeyErrorhis node has no parent.


[View source]
def path_name : String #

Returns the qualified path name to this node, starting in the global scope. PlatformSpecifics are omitted.

See also #full_path and #diagnostics_path.


[View source]
def set_tag(name : String, value : String = "") #

Sets the value of tag name to value. Raises if a tag of the same name is already set.


[View source]
def tag(name : String) #

Returns the value of tag name.


[View source]
def tag?(name : String) #

Returns the value of tag name, if any.


[View source]
def tags : Hash(String, String) #

Tags. Can be used to store flag-like data, as signal between processors. Also see the x_TAG constants in sub-classes of Node.

Before you use tags, check if you can get the information you require on some other way, e.g. infer through other existing properties.


[View source]
def unspecific_parent : Container | Nil #

Finds the parent node which is not a PlatformSpecific.


[View source]