abstract class Bindgen::Graph::Node
- Bindgen::Graph::Node
- Reference
- Object
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
- Bindgen::Graph::Alias
- Bindgen::Graph::Constant
- Bindgen::Graph::Container
- Bindgen::Graph::Enum
- Bindgen::Graph::Method
Defined in:
bindgen/graph/node.crConstructors
Instance Method Summary
-
#constant? : Bool
Is this node kind a constant in Crystal?
-
#crystal_prefix : String
Node-kind prefix for a nicely readable path, according to Crystal.
-
#diagnostics_path : String
Gives a humanly-readable path string, formatted for Crystal.
-
#find_root : Node
Finds the root of this node.
-
#full_path : Array(Node)
Gives a list of nodes, going from the root node all the way to this node.
-
#kind_name : String
The kind name of this node for diagnostic purposes.
-
#name : String
Name of this node.
-
#parent : Container | Nil
Parent node, or
nil
if it's tKeyErrorhis node has no parent. -
#parent=(parent : Container | Nil)
Parent node, or
nil
if it's tKeyErrorhis node has no parent. -
#path_name : String
Returns the qualified path name to this node, starting in the global scope.
-
#set_tag(name : String, value : String = "")
Sets the value of tag name to value.
-
#tag(name : String)
Returns the value of tag name.
-
#tag?(name : String)
Returns the value of tag name, if any.
-
#tags : Hash(String, String)
Tags.
-
#unspecific_parent : Container | Nil
Finds the parent node which is not a
PlatformSpecific
.
Constructor Detail
Instance Method Detail
Finds the root of this node. The root node is the one with a #parent
of nil
.
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.
Parent node, or nil
if it's tKeyErrorhis node has no parent.
Parent node, or nil
if it's tKeyErrorhis node has no parent.
Returns the qualified path name to this node, starting in the global
scope. PlatformSpecific
s are omitted.
See also #full_path
and #diagnostics_path
.
Sets the value of tag name to value. Raises if a tag of the same name is already set.
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.
Finds the parent node which is not a PlatformSpecific
.