![]() |
Spicy
|
#include <attribute.h>
Public Member Functions | |
| const auto & | kind () const |
| auto | hasValue () const |
| Node * | value () const |
| Result< Expression * > | valueAsExpression () const |
| Result< std::string > | valueAsString () const |
| Result< int64_t > | valueAsInteger () const |
| Result< bool > | coerceValueTo (Builder *builder, QualifiedType *dst) |
| node::Properties | properties () const final |
Public Member Functions inherited from hilti::Node | |
| node::Tag | nodeTag () const |
| bool | hasParent () const |
| Node * | parent (int i=1) const |
| template<typename T > | |
| T * | parent () const |
| auto | pathLength () const |
| const auto & | meta () const |
| const auto & | location () const |
| void | setMeta (Meta m) |
| auto | scope () const |
| auto | getOrCreateScope () |
| void | clearScope () |
| Result< std::pair< Declaration *, ID > > | lookupID (const ID &id, const std::string_view &what) const |
| virtual bool | inheritScope () const |
| std::string | typename_ () const |
| uint64_t | identity () const |
| const auto & | children () const |
| template<typename T > | |
| T * | child (unsigned int i) const |
| template<typename T > | |
| T * | childTryAs (unsigned int i) const |
| Node * | child (unsigned int i) const |
| template<typename T > | |
| auto | children (int begin, std::optional< int > end) const |
| template<typename T > | |
| auto | children (int begin, std::optional< int > end) |
| template<typename T > | |
| node::Set< T > | childrenOfType () const |
| bool | hasChild (const Node *n, bool recurse=false) const |
| Node * | sibling (Node *n) const |
| void | addChild (ASTContext *ctx, Node *n) |
| void | addChildren (ASTContext *ctx, const Nodes &children) |
| void | removeChild (Node *n) |
| void | removeChildren (int begin, std::optional< int > end) |
| void | setChild (ASTContext *ctx, size_t idx, Node *n) |
| void | replaceChildren (ASTContext *ctx, const Nodes &children) |
| void | replaceChild (ASTContext *ctx, Node *old, Node *new_) |
| template<typename T > | |
| bool | isA () const |
| template<typename T > | |
| bool | isA_ () const |
| template<typename T > | |
| T * | as () const |
| template<typename T > | |
| T * | as () |
| template<typename T > | |
| const T * | tryAs () const |
| template<typename T > | |
| T * | tryAs () |
| template<typename T > | |
| T * | tryAs_ () |
| void | print (std::ostream &out, bool compact, bool user_visible) const |
| std::string | print () const |
| std::string | printRaw () const |
| operator std::string () const | |
| std::string | dump () const |
| std::string | renderSelf (bool include_location=true) const |
| void | addError (std::string msg, std::vector< std::string > context={}) |
| void | addError (std::string msg, node::ErrorPriority priority, std::vector< std::string > context={}) |
| void | addError (std::string msg, const Location &l, std::vector< std::string > context={}) |
| void | addError (std::string msg, Location l, node::ErrorPriority priority, std::vector< std::string > context={}) |
| bool | hasErrors () const |
| const auto & | errors () const |
| void | clearErrors () |
| void | clearChildren () |
| void | retain () |
| void | release () |
| bool | isRetained () const |
| virtual void | dispatch (visitor::Dispatcher &v)=0 |
| virtual std::string_view | branchTag () const |
| Node & | operator= (const Node &other)=delete |
| Node & | operator= (Node &&other) noexcept=delete |
Static Public Member Functions | |
| static auto | create (ASTContext *ctx, const attribute::Kind &kind, Expression *v, const Meta &m=Meta()) |
| static auto | create (ASTContext *ctx, const attribute::Kind &kind, const Meta &m=Meta()) |
Protected Member Functions | |
| Attribute (ASTContext *ctx, Nodes children, attribute::Kind kind, Meta m=Meta()) | |
| std::string | _dump () const override |
| HILTI_NODE_0 (Attribute, final) | |
Protected Member Functions inherited from hilti::Node | |
| Node (ASTContext *ctx, node::Tags node_tags, Nodes children, Meta meta) | |
| Node (ASTContext *ctx, node::Tags node_tags, Meta meta) | |
| Node (Node &&other)=default | |
| Node (const Node &other) | |
| virtual std::string | _typename () const |
| virtual Node * | _clone (ASTContext *ctx) const =0 |
Additional Inherited Members | |
Static Public Attributes inherited from hilti::Node | |
| static constexpr uint16_t | NodeLevel = 0 |
| static constexpr ::hilti::node::Tag | NodeTag = ::hilti::node::tag::Node |
| static constexpr ::hilti::node::Tags | NodeTags = {::hilti::node::tag::Node} |
AST node for an attribute.
|
overrideprotectedvirtual |
Returns additional information to include into the node's dump() output, as provided by derived classes.
Reimplemented from hilti::Node.
| Result< bool > Attribute::coerceValueTo | ( | Builder * | builder, |
| QualifiedType * | dst | ||
| ) |
Coerce the attribute's expression value to a specified type, modifying the node in place.
|
inlinestatic |
Factory for an attribute with no argument.
| kind | the attribute's internal representation |
| m | meta data to associate with the node |
|
inlinestatic |
Factory for an attribute coming with an argument. The argument must be an AST node representing an expression.
| kind | the attribute's internal representation |
| v | node representing the argument to associate with the attribute; must be an expression |
| m | meta data to associate with the node |
|
inline |
Returns true if an argument is associated with the attribute.
|
inline |
Returns the kind of the attribute, derived from its tag.
|
inlinefinalvirtual |
Returns any instance properties associated with the node. These are used (only) for debug logging. Derived classes should override this to add any properties they retain inside internal node member variables.
Reimplemented from hilti::Node.
|
inline |
Returns the attribute associated with the node.
| <tt>std::out_of_range</tt> | if the attribute does not have an argument |
| Result< Expression * > Attribute::valueAsExpression | ( | ) | const |
Returns the expression argument associated with the attribute.
| Result< int64_t > Attribute::valueAsInteger | ( | ) | const |
Returns the expression argument associated with the attribute as a signed integer, assuming it represents a constant integer value. Both signed and unsigned integer values are accepted, with the latter cased into signed for the return value
| Result< std::string > Attribute::valueAsString | ( | ) | const |
Returns the expression argument associated with the attribute as a string, assuming it represents a constant integer value.