NodePropertyName

Enum NodePropertyName 

Source
pub enum NodePropertyName {
Show 52 variants UnknownNodeProperty = 0, LineNumber = 2, ParserTypeName = 3, Order = 4, Name = 5, FullName = 6, IsExternal = 7, Value = 8, ColumnNumber = 11, LineNumberEnd = 12, Version = 13, EvaluationStrategy = 15, ColumnNumberEnd = 16, Language = 19, Content = 20, Code = 21, Signature = 22, DispatchType = 25, ModifierType = 26, ControlStructureType = 27, ArgumentIndex = 40, ClosureBindingId = 50, TypeFullName = 51, TypeDeclFullName = 52, InheritsFromTypeFullName = 53, MethodFullName = 54, AstParentType = 56, AstParentFullName = 57, DependencyGroupId = 58, Symbol = 100, MethodShortName = 102, PackageName = 103, ClassName = 104, NodeLabel = 105, Filename = 106, Overlays = 118, Hash = 120, ArgumentName = 130, Key = 131, ClassShortName = 132, AliasTypeFullName = 158, ClosureOriginalName = 159, IsVariadic = 221, Root = 1_199, DynamicTypeHintFullName = 1_591, PossibleTypes = 1_592, Index = 2_223, GenericSignature = 3_000, Offset = 3_812, OffsetEnd = 3_813, CanonicalName = 2_001_092, ContainedRef = 2_007_161,
}

Variants§

§

UnknownNodeProperty = 0

§

LineNumber = 2

This optional field provides the line number of the program construct represented by the node.

§

ParserTypeName = 3

AST node type name emitted by parser.

§

Order = 4

This integer indicates the position of the node among its siblings in the AST. The left-most child has an order of 0.

§

Name = 5

Name of represented object, e.g., method name (e.g. “run”)

§

FullName = 6

This is the fully-qualified name of an entity, e.g., the fully-qualified name of a method or type. The details of what constitutes a fully-qualified name are language specific. This field SHOULD be human readable.

§

IsExternal = 7

Indicates that the construct (METHOD or TYPE_DECL) is external, that is, it is referenced but not defined in the code (applies both to insular parsing and to library functions where we have header files only)

§

Value = 8

This property denotes a string value as used in a key-value pair.

§

ColumnNumber = 11

This optional fields provides the column number of the program construct represented by the node.

§

LineNumberEnd = 12

This optional fields provides the line number at which the program construct represented by the node ends.

§

Version = 13

A version, given as a string. Used, for example, in the META_DATA node to indicate which version of the CPG spec this CPG conforms to

§

EvaluationStrategy = 15

For formal method input parameters, output parameters, and return parameters, this field holds the evaluation strategy, which is one of the following:

  1. BY_REFERENCE indicates that the parameter is passed by reference, 2) BY_VALUE indicates that it is passed by value, that is, a copy is made,
  2. BY_SHARING the parameter is a pointer/reference and it is shared with the caller/callee. While a copy of the pointer is made, a copy of the object that it points to is not made.
§

ColumnNumberEnd = 16

This optional fields provides the column number at which the program construct represented by the node ends.

§

Language = 19

This field indicates which CPG language frontend generated the CPG. Frontend developers may freely choose a value that describes their frontend so long as it is not used by an existing frontend. Reserved values are to date: C, LLVM, GHIDRA, PHP.

§

Content = 20

Certain files, e.g., configuration files, may be included in the CPG as-is. For such files, the CONTENT field contains the files content.

§

Code = 21

This field holds the code snippet that the node represents.

§

Signature = 22

The method signature encodes the types of parameters in a string. The string SHOULD be human readable and suitable for differentiating methods with different parameter types sufficiently to allow for resolving of function overloading. The present specification does not enforce a strict format for the signature, that is, it can be chosen by the frontend implementor to fit the source language.

§

DispatchType = 25

This field holds the dispatch type of a call, which is either STATIC_DISPATCH or DYNAMIC_DISPATCH. For statically dispatched method calls, the call target is known at compile time while for dynamically dispatched calls, it can only be determined at runtime as it may depend on the type of an object (as is the case for virtual method calls) or calculation of an offset.

§

ModifierType = 26

The modifier type is a free-form string. The following are known modifier types: STATIC, PUBLIC, PROTECTED, PRIVATE, ABSTRACT, NATIVE, CONSTRUCTOR, VIRTUAL.

§

ControlStructureType = 27

The CONTROL_STRUCTURE_TYPE field indicates which kind of control structure a CONTROL_STRUCTURE node represents. The available types are the following: BREAK, CONTINUE, DO, WHILE, FOR, GOTO, IF, ELSE, TRY, THROW and SWITCH.

§

ArgumentIndex = 40

AST-children of CALL nodes have an argument index, that is used to match call-site arguments with callee parameters. Explicit parameters are numbered from 1 to N, while index 0 is reserved for implicit self / this parameter. CALLs without implicit parameter therefore have arguments starting with index 1. AST-children of BLOCK nodes may have an argument index as well; in this case, the last argument index determines the return expression of a BLOCK expression. If the PARAMETER_NAME field is set, then the ARGUMENT_INDEX field is ignored. It is suggested to set it to -1.

§

ClosureBindingId = 50

Identifier which uniquely describes a CLOSURE_BINDING. This property is used to match captured LOCAL nodes with the corresponding CLOSURE_BINDING nodes

§

TypeFullName = 51

This field contains the fully-qualified static type name of the program construct represented by a node. It is the name of an instantiated type, e.g., java.util.List<Integer>, rather than java.util.List\[T\]. If the type cannot be determined, this field should be set to the empty string.

§

TypeDeclFullName = 52

The static type decl of a TYPE. This property is matched against the FULL_NAME of TYPE_DECL nodes. It is required to have exactly one TYPE_DECL for each different TYPE_DECL_FULL_NAME

§

InheritsFromTypeFullName = 53

The static types a TYPE_DECL inherits from. This property is matched against the FULL_NAME of TYPE nodes and thus it is required to have at least one TYPE node for each TYPE_FULL_NAME

§

MethodFullName = 54

The FULL_NAME of a method. Used to link CALL and METHOD nodes. It is required to have exactly one METHOD node for each METHOD_FULL_NAME

§

AstParentType = 56

The type of the AST parent. Since this is only used in some parts of the graph, the list does not include all possible parents by intention. Possible parents: METHOD, TYPE_DECL, NAMESPACE_BLOCK.

§

AstParentFullName = 57

This field holds the FULL_NAME of the AST parent of an entity.

§

DependencyGroupId = 58

The group ID for a dependency

§

Symbol = 100

§

MethodShortName = 102

§

PackageName = 103

§

ClassName = 104

§

NodeLabel = 105

§

Filename = 106

The path of the source file this node was generated from, relative to the root path in the meta data node. This field must be set but may be set to the value <unknown> to indicate that no source file can be associated with the node, e.g., because the node represents an entity known to exist because it is referenced, but for which the file that is is declared in is unknown.

§

Overlays = 118

The field contains the names of the overlays applied to this CPG, in order of their application. Names are free-form strings, that is, this specification does not dictate them but rather requires tool producers and consumers to communicate them between each other.

§

Hash = 120

This property contains a hash value in the form of a string. Hashes can be used to summarize data, e.g., to summarize the contents of source files or sub graphs. Such summaries are useful to determine whether code has already been analyzed in incremental analysis pipelines. This property is optional to allow its calculation to be deferred or skipped if the hash is not needed.

§

ArgumentName = 130

For calls involving named parameters, the ARGUMENT_NAME field holds the name of the parameter initialized by the expression. For all other calls, this field is unset.

§

Key = 131

This property denotes a key of a key-value pair.

§

ClassShortName = 132

§

AliasTypeFullName = 158

This property holds the fully qualified name of the type that the node is a type alias of.

§

ClosureOriginalName = 159

The original name of the (potentially mangled) captured variable

§

IsVariadic = 221

Specifies whether a parameter is the variadic argument handling parameter of a variadic method. Only one parameter of a method is allowed to have this property set to true.

§

Root = 1_199

The path to the root directory of the source/binary this CPG is generated from.

§

DynamicTypeHintFullName = 1_591

Type hint for the dynamic type. These are observed to be verifiable at runtime.

§

PossibleTypes = 1_592

Similar to DYNAMIC_TYPE_HINT_FULL_NAME, but that this makes no guarantee that types within this property are correct. This property is used to capture observations between node interactions during a ‘may-analysis’.

§

Index = 2_223

Specifies an index, e.g., for a parameter or argument. Explicit parameters are numbered from 1 to N, while index 0 is reserved for implicit self / this parameter.

§

GenericSignature = 3_000

This field is experimental. It will likely be removed in the future without any notice. It stores type information for generic types and methods as well as type information for members and locals where the type either contains a type parameter reference or an instantiated type reference.

§

Offset = 3_812

Start offset into the CONTENT property of the corresponding FILE node. The offset is such that parts of the content can easily be accessed via content.substring(offset, offsetEnd). This means that the offset must be measured in utf16 encoding (i.e. neither in characters/codeunits nor in byte-offsets into a utf8 encoding). E.g. for METHOD nodes this start offset points to the start of the methods source code in the string holding the source code of the entire file.

§

OffsetEnd = 3_813

End offset (exclusive) into the CONTENT property of the corresponding FILE node. See OFFSET documentation for finer details. E.g. for METHOD nodes this end offset points to the first code position which is not part of the method.

§

CanonicalName = 2_001_092

This field holds the canonical name of a FIELD_IDENTIFIER. It is typically identical to the CODE field, but canonicalized according to source language semantics. Human readable names are preferable. FIELD_IDENTIFIER nodes must share identical CANONICAL_NAME if and only if they alias, e.g., in C-style unions (if the aliasing relationship is unknown or there are partial overlaps, then one must make a reasonable guess, and trade off between false negatives and false positives).

§

ContainedRef = 2_007_161

References to other nodes. This is not a real property; it exists here for the sake of serialization only. valueType and cardinality are meaningless.

Trait Implementations§

Source§

impl Clone for NodePropertyName

Source§

fn clone(&self) -> NodePropertyName

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for NodePropertyName

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for NodePropertyName

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Hash for NodePropertyName

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for NodePropertyName

Source§

fn cmp(&self, other: &NodePropertyName) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for NodePropertyName

Source§

fn eq(&self, other: &NodePropertyName) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for NodePropertyName

Source§

fn partial_cmp(&self, other: &NodePropertyName) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Serialize for NodePropertyName

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for NodePropertyName

Source§

impl Eq for NodePropertyName

Source§

impl StructuralPartialEq for NodePropertyName

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,