|
enum class | Type {
Public = 0
, Protected = 1
, Static = 2
, Final = 3
,
Abstract = 4
, Native = 5
, NumModifiers = 6
} |
|
|
void | set (parsetree::Modifier target) |
| Will clear + set the modifier given a parsetree::Modifier Will also set the location of the modifier. More...
|
|
bool | set (ast::Modifiers::Type target) |
| Will union the modifier with the current modifiers. More...
|
|
bool | set (ast::Modifiers target) |
| Will union the modifiers with the current modifiers. More...
|
|
auto | getLocationsMasked (Modifiers target) const |
| Returns an iterator over the locations of the modifiers that are set in both this Modifiers object and the given Modifiers object. More...
|
|
auto | getLocation (Type modifier) const |
| Returns the location of the given modifier. Returns an undefined location if the modifier is not set.
|
|
bool | isPublic () const |
|
bool | isProtected () const |
|
bool | isStatic () const |
|
bool | isFinal () const |
|
bool | isAbstract () const |
|
bool | isNative () const |
|
std::string | toString () const |
|
Definition at line 265 of file AstNode.h.
◆ getLocationsMasked()
auto ast::Modifiers::getLocationsMasked |
( |
Modifiers |
target | ) |
const |
|
inline |
Returns an iterator over the locations of the modifiers that are set in both this Modifiers object and the given Modifiers object.
- Parameters
-
target | The set of modifiers to intersect |
Definition at line 308 of file AstNode.h.
309 auto masked = target.modifiers & modifiers;
310 return std::views::iota(0, (
int)Type::NumModifiers) |
312 [masked](
int i) {
return (masked & (1 << i)) != 0; }) |
313 std::views::transform([
this](
int i) {
return modifierLocations[i]; });
◆ set() [1/3]
Will union the modifiers with the current modifiers.
- Parameters
-
target | The set of modifiers to union |
- Returns
- True if any of the modifiers were already set
Definition at line 295 of file AstNode.h.
297 for(
int i = 0; i < (int)Type::NumModifiers; i++) {
298 if(test(target.modifiers, (Type)i)) {
299 wasSet |=
set((Type)i);
void set(parsetree::Modifier target)
Will clear + set the modifier given a parsetree::Modifier Will also set the location of the modifier.
References set().
◆ set() [2/3]
bool ast::Modifiers::set |
( |
ast::Modifiers::Type |
target | ) |
|
|
inline |
Will union the modifier with the current modifiers.
- Parameters
-
modifier | The modifier to union with this Modifiers object |
- Returns
- True if the modifier was already set
Definition at line 286 of file AstNode.h.
287 bool wasSet = test(modifiers, target);
288 modifiers |= (1 << (uint8_t)target);
Referenced by set().
◆ set() [3/3]
Will clear + set the modifier given a parsetree::Modifier Will also set the location of the modifier.
- Parameters
-
modifier | The modifier to assign to this Modifiers object |
Definition at line 5 of file Modifiers.cc.
7 switch(target.get_type()) {
8 case parsetree::Modifier::Type::Public:
9 modifier = Type::Public;
11 case parsetree::Modifier::Type::Protected:
12 modifier = Type::Protected;
14 case parsetree::Modifier::Type::Static:
15 modifier = Type::Static;
17 case parsetree::Modifier::Type::Final:
18 modifier = Type::Final;
20 case parsetree::Modifier::Type::Abstract:
21 modifier = Type::Abstract;
23 case parsetree::Modifier::Type::Native:
24 modifier = Type::Native;
27 assert(
false &&
"Unknown modifier type");
30 modifierLocations[(int)modifier] = target.
location();
SourceRange location() const
Get the location of the node.
References parsetree::Node::location(), and set().
The documentation for this class was generated from the following files: