ConstantValueNodeA node that represents a constant value from a TypeNode and a ValueNode.
| Attribute | Type | Description |
|---|---|---|
kind |
"constantValueNode" |
The node discriminator. |
| Attribute | Type | Description |
|---|---|---|
type |
TypeNode |
The type of the constant. |
value |
ValueNode |
The value of the constant. |
constantValueNode(type, value)Helper function that creates a ConstantValueNode object from a type and a value node
const node = constantValueNode(numberTypeNode('u32'), numberValueNode(42));
constantValueNodeFromString(encoding, data)Helper function that creates a ConstantValueNode object of type StringTypeNode from an encoding and a string of data.
constantValueNodeFromString('utf8', 'Hello');
// Equivalent to:
constantValueNode(stringTypeNode('utf8'), stringValueNode('Hello'));
constantValueNodeFromBytes(encoding, data)Helper function that creates a ConstantValueNode object of type BytesTypeNode from an encoding and a string of data.
constantValueNodeFromBytes('base16', 'FF99CC');
// Equivalent to:
constantValueNode(bytesTypeNode(), bytesValueNode('base16', 'FF99CC'));