nany
interface.hxx
1 #pragma once
2 #include "interface.h"
3 
4 
5 namespace ny {
6 
7 
8 inline bool ClassdefInterface::hasSelf() const {
9  return not (!pSelf);
10 }
11 
12 
13 inline Funcdef& ClassdefInterface::self() {
14  assert(hasSelf());
15  return *pSelf;
16 }
17 
18 
19 inline const Funcdef& ClassdefInterface::self() const {
20  assert(hasSelf());
21  return *pSelf;
22 }
23 
24 
25 inline bool ClassdefInterface::empty() const {
26  return pInterface.empty();
27 }
28 
29 
30 inline void ClassdefInterface::clear() {
31  pInterface.clear();
32  pInterface.shrink_to_fit();
33 }
34 
35 
36 inline void ClassdefInterface::add(Funcdef* funcdef) {
37  assert(funcdef != nullptr);
38  pInterface.push_back(funcdef);
39 }
40 
41 
42 template<class C>
43 inline void ClassdefInterface::eachUnresolved(const C& callback) {
44  for (auto& ptr : pInterface) {
45  auto& funcdef = *ptr;
46  if (not funcdef.isPartiallyResolved())
47  callback(funcdef);
48  }
49 }
50 
51 
52 } // namespace ny
bool isPartiallyResolved() const
Get if the funcdef is resolved or has overloads.
Definition: funcdef.hxx:56
bool empty() const
Get if the container is empty.
Definition: interface.hxx:25
Function definition.
Definition: funcdef.h:15
Definition: ast.cpp:6
void clear()
Empty the interface.
Definition: interface.hxx:30