#include <KeywordSelector.h>
Public Member Functions | |
KeywordSelector (IdentifierInfo *key, Location loc, Expr *expr) | |
KeywordSelector (IdentifierInfo *key, Location loc, TypeRef *tyRef) | |
IdentifierInfo * | getKeyword () const |
Returns the identifier info representing the keyword. | |
Location | getLocation () const |
Returns the location of the keyword for this selection. | |
bool | isTypeSelector () const |
Returns true if this selector has a type as its RHS. | |
bool | isExprSelector () const |
Returns true if this selector has an expression as its RHS. | |
Type * | getType () const |
void | setRHS (Expr *expr) |
void | setRHS (TypeRef *ref) |
Expr * | getExpression () |
const Expr * | getExpression () const |
TypeRef * | getTypeRef () |
const TypeRef * | getTypeRef () const |
Static Public Member Functions | |
static bool | classof (const KeywordSelector *node) |
Support isa and dyn_cast. | |
static bool | classof (const Ast *node) |
This class represents keyword selectors as used when forming (for example) subroutine calls or functor instantiations.
Since the right hand side of a keyword selector can be an expression or a type, depending on the context it appears in, we define two corresponding kinds of selectors. isTypeSelector returns true if its right-hand-side names a type. isExprSelector returns true if its right-hand-side denotes an expression. Several accessors are provided to retrieve the RHS as the needed type.
This class is a miscellaneous member of the AST hierarchy, as it does not belong to any one of its main branches (Type, Decl, Expr). This is a transient node used by the type checker to encapsulate a keyword selection, and does not appear in the final AST.
Definition at line 38 of file KeywordSelector.h.
comma::KeywordSelector::KeywordSelector | ( | IdentifierInfo * | key, | |
Location | loc, | |||
Expr * | expr | |||
) | [inline] |
Construct a keyword selection which targets an expression.
key | The argument keyword to be selected. | |
loc | The location of key . | |
expr | The expression associated with key . |
Definition at line 48 of file KeywordSelector.h.
comma::KeywordSelector::KeywordSelector | ( | IdentifierInfo * | key, | |
Location | loc, | |||
TypeRef * | tyRef | |||
) | [inline] |
Construct a keyword selection which targets a type.
key | The argument keywords to be selected. | |
loc | The location of key . | |
type | A TypeRef node encapsulating the type. |
Definition at line 59 of file KeywordSelector.h.
static bool comma::KeywordSelector::classof | ( | const Ast * | node | ) | [inline, static] |
Definition at line 109 of file KeywordSelector.h.
static bool comma::KeywordSelector::classof | ( | const KeywordSelector * | node | ) | [inline, static] |
Support isa and dyn_cast.
Reimplemented from comma::Ast.
Definition at line 108 of file KeywordSelector.h.
const Expr* comma::KeywordSelector::getExpression | ( | ) | const [inline] |
Sets the right hand side of this selector, overwriting the previous value.
Definition at line 86 of file KeywordSelector.h.
Expr* comma::KeywordSelector::getExpression | ( | ) | [inline] |
If this selector has an expression on its right hand side, returns the associated expression, otherwise null.
Definition at line 85 of file KeywordSelector.h.
IdentifierInfo* comma::KeywordSelector::getKeyword | ( | ) | const [inline] |
Returns the identifier info representing the keyword.
Definition at line 64 of file KeywordSelector.h.
Location comma::KeywordSelector::getLocation | ( | ) | const [inline, virtual] |
Returns the location of the keyword for this selection.
Reimplemented from comma::Ast.
Definition at line 67 of file KeywordSelector.h.
Type* comma::KeywordSelector::getType | ( | ) | const [inline] |
If this selector has an expression on its right hand side, and the expression is unambiguous, return the type of the associated expression and null otherwise.
Definition at line 92 of file KeywordSelector.h.
const TypeRef* comma::KeywordSelector::getTypeRef | ( | ) | const [inline] |
Sets the right hand side of this selector, overwriting the previous value.
Definition at line 104 of file KeywordSelector.h.
TypeRef* comma::KeywordSelector::getTypeRef | ( | ) | [inline] |
If this selector has a type on its right hand side, returns the associated TypeRef, otherwise null.
Definition at line 103 of file KeywordSelector.h.
bool comma::KeywordSelector::isExprSelector | ( | ) | const [inline] |
Returns true if this selector has an expression as its RHS.
Definition at line 73 of file KeywordSelector.h.
bool comma::KeywordSelector::isTypeSelector | ( | ) | const [inline] |
Returns true if this selector has a type as its RHS.
Definition at line 70 of file KeywordSelector.h.
void comma::KeywordSelector::setRHS | ( | TypeRef * | ref | ) | [inline] |
Sets the right hand side of this selector, overwriting the previous value.
Definition at line 79 of file KeywordSelector.h.
void comma::KeywordSelector::setRHS | ( | Expr * | expr | ) | [inline] |
Sets the right hand side of this selector, overwriting the previous value.
Definition at line 78 of file KeywordSelector.h.