3 #include "ast/AstNode.h"
4 #include "diagnostics/Location.h"
15 string_view name,
Expr* init, ScopeID
const* scope)
noexcept
22 Type const* type()
const {
return type_; }
23 Type* mut_type()
const {
return type_; }
27 bool hasInit()
const {
return init_ !=
nullptr; }
28 Expr const* init()
const {
return init_; }
29 Expr* mut_init() {
return init_; }
31 ScopeID
const* scope()
const {
return scope_; }
37 ScopeID
const*
const scope_;
46 string_view name,
Expr* init, ScopeID
const* scope)
noexcept
47 :
TypedDecl{alloc, location, type, name, init, scope} {}
49 std::ostream& print(std::ostream& os,
int indentation = 0)
const override;
50 int printDotNode(DotPrinter& dp)
const override;
60 Type* type, string_view name,
Expr* init,
61 ScopeID
const* scope)
noexcept
62 :
TypedDecl{alloc, location, type, name, init, scope},
63 modifiers_{modifiers} {};
65 std::ostream& print(std::ostream& os,
int indentation = 0)
const override;
66 int printDotNode(DotPrinter& dp)
const override;
68 auto modifiers()
const {
return modifiers_; }
71 auto parentDecl = dyn_cast<
Decl>(parent);
72 assert(parentDecl &&
"Parent must be a Decl");
73 if(modifiers_.isStatic()) {
75 canonicalName_ +=
".";