9 return static_cast<uint32_t
>(m_instances.size());
177 for (
auto& pair : m_children) {
178 if (not callback(*pair.second))
185 for (
auto& pair : m_children) {
186 if (not callback(*pair.second))
193 return (m_children.count(name) != 0);
199 assert(not needle.empty());
200 auto range = m_children.equal_range(needle);
201 for (
auto it = range.first; it != range.second; ++it) {
202 if (not callback(*(it->second)))
209 inline void Atom::eachChild(
const AnyString& needle,
const C& callback)
const {
210 assert(not needle.empty());
211 auto range = m_children.equal_range(needle);
212 for (
auto it = range.first; it != range.second; ++it) {
213 if (not callback(*(it->second)))
219 inline void Atom::Parameters::swap(
Parameters& rhs) {
220 std::swap(pData, rhs.pData);
228 uint32_t count = pData->count;
229 auto& params = pData->params;
230 for (uint32_t i = 0; i != count; ++i) {
231 auto& pair = params[i];
232 callback(i, pair.first, pair.second);
239 return (!!pData) ? pData.get()->count : 0;
249 assert(!!pData and index < pData->count);
250 return pData->params[index].first;
255 assert(!!pData and index < pData->count);
256 return pData->params[index].second;
260 inline const std::pair<AnyString, Vardef>& Atom::Parameters::operator [] (uint index)
const {
261 assert(!!pData and index < pData->count);
262 return pData->params[index];
267 return classinfo.nextFieldIndex *
sizeof(uint64_t);
272 return (uint32_t) m_children.size();
277 return not m_children.empty();
282 return Ref(*
this, index);
287 return (m_index < m_ref.m_instances.size())
288 ? m_ref.m_instances[m_index].ircode.get() :
nullptr;
293 assert(m_index < m_ref.m_instances.size());
294 return *(m_ref.m_instances[m_index].ircode.get());
299 return (m_index < m_ref.m_instances.size())
300 ? AnyString{m_ref.m_instances[m_index].symbol} :
311 m_ref.update(m_index, std::move(symbol), rettype);
316 m_ref.invalidate(m_index, signature);
317 return (uint32_t) - 1;
bool isPropertySetCustom() const
Get if the atom is a property setter (custom operator)
Definition: atom.hxx:138
bool isCapturedVariable() const
Get if the atom is a captured variable.
Definition: atom.hxx:108
Yuni::Flags< Flags > flags
Atom flags.
Definition: atom.h:422
Vardef returnType
The return type.
Definition: atom.h:477
bool hasMember(const AnyString &name) const
Get if this atom has a child member.
Definition: atom.hxx:192
uint32_t childrenCount() const
Get the number of children.
Definition: atom.hxx:271
bool isAnonymousClass() const
Get if the atom is an anonymous class.
Definition: atom.hxx:48
uint32_t size() const
Number of instances.
Definition: atom.hxx:8
bool isPropertySet() const
Get if the atom is a property setter.
Definition: atom.hxx:133
Yuni::Flags< Category > category
Atom Category.
Definition: atom.h:424
bool empty() const
Get if empty.
Definition: atom.hxx:243
bool hasGenericParameters() const
Get if the atom has generic type parameters.
Definition: atom.hxx:163
const Vardef & vardef(uint index) const
Var def.
Definition: atom.hxx:254
static CLID AtomMapID(uint32_t atomid)
Create a CLID for an atom id.
Definition: clid.hxx:9
bool isCtor() const
Get if the atom is a constructor.
Definition: atom.hxx:58
bool isVoid() const
Get if the clid is valid (aka != 0)
Definition: clid.hxx:21
Definition: signature.h:15
const AnyString & name(uint index) const
Parameter name.
Definition: atom.hxx:248
bool isMemberVarDefaultInit() const
Is a constructor.
Definition: atom.hxx:113
Class definition.
Definition: classdef.h:24
bool hasChildren() const
Get if this atom owns children (sub-classes, methods...)
Definition: atom.hxx:276
bool isCloneCtor() const
Get if the atom is a clone constructor.
Definition: atom.hxx:68
bool isUnittest() const
Get if the atom is an unittest.
Definition: atom.hxx:148
CLID clid() const
Get the clid for this atom.
Definition: atom.hxx:33
bool hasReturnType() const
Get if the atom has a return type.
Definition: atom.hxx:158
bool isFunctor() const
Get if the atom is a functor (operator ())
Definition: atom.hxx:103
When the atom is copy constructor.
const Type type
Flag to determine whether this entry is a blueprint or a namespace.
Definition: atom.h:459
bool isPublicOrPublished() const
Get if the atom is publicly accessible.
Definition: atom.hxx:153
void update(YString &&symbol, const Classdef &rettype)
Update atom instance.
Definition: atom.hxx:310
ir::Sequence & ircode()
Get the attached IR sequence.
Definition: atom.hxx:292
bool isPropertyGet() const
Get if the atom is a property getter.
Definition: atom.hxx:128
Atom * parentScope()
Get the parent atom (if any)
Definition: atom.hxx:13
uint32_t atomid
Atom unique ID (32-bits only, used for classification)
Definition: atom.h:420
bool isClass() const
Get if the atom is a class.
Definition: atom.hxx:43
AnyString symbolname() const
Get the symbol name of the instantiation (with fully qualified types)
Definition: atom.hxx:298
bool isUnit() const
Get if the atom is an unit.
Definition: atom.hxx:73
void eachChild(const C &callback)
Iterate through all children.
Definition: atom.hxx:176
void each(const T &callback) const
Iterate through all parameters.
Definition: atom.hxx:226
Parameters tmplparams
Template parameters.
Definition: atom.h:481
Atom * scopeForNameResolution
A different scope for name resolution, if not null (for plugs/outlets)
Definition: atom.h:487
When the atom has a class as parent.
bool isContextual() const
Get if the atom is contextual.
Definition: atom.hxx:168
uint32_t id() const
Instance ID.
Definition: atom.hxx:305
property set, custom operator, for future uses
When the atom is a constructor.
uint32_t invalidate(const Signature &)
Mark the instantiation (and its signature) as invalid (always returns -1)
Definition: atom.hxx:315
When the atom is the destructor.
define a part of a namespace
uint size() const
Get the total number of parameters.
Definition: atom.hxx:238
nyvisibility_t visibility
Visibility.
Definition: atom.h:461
Definition of a single class or function.
Definition: atom.h:37
bool isDtor() const
Get if the atom is a destructor.
Definition: atom.hxx:63
bool isProperty() const
Get if the atom is a property (get or set)
Definition: atom.hxx:143
struct ny::Atom::@2 classinfo
Various information for classdef only.
bool isFunction() const
Get if the atom is a function.
Definition: atom.hxx:83
bool isView() const
Get if the atom is a view.
Definition: atom.hxx:98
bool shortcircuitValue
Shortcircuit value (if applicable)
Definition: atom.h:138
bool isSpecial() const
Get if the atom is a special atom (operator, view...)
Definition: atom.hxx:93
AnyString name() const
Atom name.
Definition: atom.hxx:22
Atom * parent
Parent node.
Definition: atom.h:463
Allow this atom (and the sub-functions) to capture variables.
ir::Sequence * ircodeIfExists()
Get the attached IR sequence, if any.
Definition: atom.hxx:286
bool isNamespace() const
Get if the atom is a namespace.
Definition: atom.hxx:38
bool isClassMember() const
Get if the atom is a class member (function or variable)
Definition: atom.hxx:123
uint64_t runtimeSizeof() const
Size at runtime (sizeof)
Definition: atom.hxx:266
bool isTypeAlias() const
Is a type alias.
Definition: atom.hxx:78
bool callable() const
Get if the atom is callable (can be called like a function)
Definition: atom.hxx:53
bool canCaptureVariabes() const
Get if the atom can capture out-of-scope variables.
Definition: atom.hxx:27
Default variable initialization.
bool isMemberVariable() const
Get if the atom is a member variable.
Definition: atom.hxx:118
Definition: sequence.h:22
Ref operator[](uint32_t index)
Retrieve information about the Nth instantiation of this atom.
Definition: atom.hxx:281
CLID clid
Attached type (class id)
Definition: vardef.h:34
bool isOperator() const
Get if the atom is an operator.
Definition: atom.hxx:88