sun::ast::VariableCreationAST
class · Source (opens in a new tab)
class sun::ast::VariableCreationAST : public sun::ast::ExprASTA variable declaration with its type, initializer, and binding properties.
Inherits
- sun::ast::ExprAST (public)
Public Functions
- VariableCreationAST
- dotLabel
- forEachChildSlot
- getDoc
- getGlobalInit
- getImportedConstant
- getLinkName
- getName
- getQualifiedName
- getType
- getTypeAnnotation
- getValue
- hasExplicitCAbi
- hasLinkName
- hasQualifiedName
- hasTypeAnnotation
- hasValue
- isCExtern
- isConst
- setCExtern
- setDoc
- setExplicitCAbi
- setGlobalInit
- setImportedConstant
- setLinkName
- setQualifiedName
- toString
VariableCreationAST
public · function · Source (opens in a new tab)
sun::ast::VariableCreationAST::VariableCreationAST(std::string name, std::unique_ptr< ExprAST > value, std::optional< TypeAnnotation > type=std::nullopt, bool isConst=false)Creates this syntax node and takes ownership of any supplied child expressions.
Related: ExprAST, TypeAnnotation
dotLabel
public · function · Source (opens in a new tab)
std::string sun::ast::VariableCreationAST::dotLabel() const overrideReturns the node label used in syntax-tree graph visualizations.
forEachChildSlot
public · function · Source (opens in a new tab)
void sun::ast::VariableCreationAST::forEachChildSlot(const ChildSlotFn &fn) overrideVisits replaceable child expressions so tree passes can rewrite them in place.
Related: ChildSlotFn
getDoc
public · function · Source (opens in a new tab)
const std::string & sun::ast::VariableCreationAST::getDoc() constComment written above the declaration (see doc_comments.h).
Related: doc_comments.h
getGlobalInit
public · function · Source (opens in a new tab)
const sun::semantic_analysis::constants::GlobalInitRecord * sun::ast::VariableCreationAST::getGlobalInit() constHow this file-scope variable gets its first value: computed at compile time and written into the program, or computed by the startup function.
Null until analysis has decided, and for a variable that is not at file scope.
Related: sun::semantic_analysis::constants::GlobalInitRecord
getImportedConstant
public · function · Source (opens in a new tab)
const std::optional< sun::semantic_analysis::constants::ConstantValue > & sun::ast::VariableCreationAST::getImportedConstant() constThe compile-time value a library published for this global, if any.
Only a global read from a bundle has one.
Related: sun::semantic_analysis::constants::ConstantValue
getLinkName
public · function · Source (opens in a new tab)
const std::string & sun::ast::VariableCreationAST::getLinkName() constReturns the link name stored by this object.
getName
public · function · Source (opens in a new tab)
const std::string & sun::ast::VariableCreationAST::getName() constReturns the declared name used to identify this object.
getQualifiedName
public · function · Source (opens in a new tab)
const sun::semantic_analysis::QualifiedName & sun::ast::VariableCreationAST::getQualifiedName() constQualified name (after semantic analysis qualifies it).
Related: sun::semantic_analysis::QualifiedName
getType
public · function · Source (opens in a new tab)
ASTNodeType sun::ast::VariableCreationAST::getType() const overrideReturns the syntax-node kind used to dispatch tree visitors.
Related: ASTNodeType
getTypeAnnotation
public · function · Source (opens in a new tab)
const std::optional< TypeAnnotation > & sun::ast::VariableCreationAST::getTypeAnnotation() constReturns the type annotation stored by this object.
Related: TypeAnnotation
getValue
public · function · Source (opens in a new tab)
const ExprAST * sun::ast::VariableCreationAST::getValue() constReturns the value represented by this object.
Related: ExprAST
hasExplicitCAbi
public · function · Source (opens in a new tab)
bool sun::ast::VariableCreationAST::hasExplicitCAbi() constReports whether this object has explicit c ABI.
hasLinkName
public · function · Source (opens in a new tab)
bool sun::ast::VariableCreationAST::hasLinkName() constReports whether an explicit linker symbol name is present.
hasQualifiedName
public · function · Source (opens in a new tab)
bool sun::ast::VariableCreationAST::hasQualifiedName() constReports whether a name including the enclosing scopes has been assigned.
hasTypeAnnotation
public · function · Source (opens in a new tab)
bool sun::ast::VariableCreationAST::hasTypeAnnotation() constReports whether this object has type annotation.
hasValue
public · function · Source (opens in a new tab)
bool sun::ast::VariableCreationAST::hasValue() constReports whether this object has value.
isCExtern
public · function · Source (opens in a new tab)
bool sun::ast::VariableCreationAST::isCExtern() constReports whether this syntax node represents a declaration using the C calling convention.
isConst
public · function · Source (opens in a new tab)
bool sun::ast::VariableCreationAST::isConst() constReports whether this syntax node represents an immutable declaration.
setCExtern
public · function · Source (opens in a new tab)
void sun::ast::VariableCreationAST::setCExtern(bool value)Marks whether the function uses the C calling convention.
setDoc
public · function · Source (opens in a new tab)
void sun::ast::VariableCreationAST::setDoc(std::string doc)Stores the source documentation comment for this declaration.
setExplicitCAbi
public · function · Source (opens in a new tab)
void sun::ast::VariableCreationAST::setExplicitCAbi(bool value)Records whether the declaration explicitly uses the C calling convention.
setGlobalInit
public · function · Source (opens in a new tab)
void sun::ast::VariableCreationAST::setGlobalInit(sun::semantic_analysis::constants::GlobalInitRecord record) constRecords the decision made for this file-scope variable.
Related: sun::semantic_analysis::constants::GlobalInitRecord
setImportedConstant
public · function · Source (opens in a new tab)
void sun::ast::VariableCreationAST::setImportedConstant(sun::semantic_analysis::constants::ConstantValue value)Records the value read from a bundle for this global.
Related: sun::semantic_analysis::constants::ConstantValue
setLinkName
public · function · Source (opens in a new tab)
void sun::ast::VariableCreationAST::setLinkName(std::string name)Updates the link name stored by this object.
setQualifiedName
public · function · Source (opens in a new tab)
void sun::ast::VariableCreationAST::setQualifiedName(sun::semantic_analysis::QualifiedName qname)Records the declaration name together with its enclosing scopes.
Related: sun::semantic_analysis::QualifiedName
toString
public · function · Source (opens in a new tab)
std::string sun::ast::VariableCreationAST::toString() const overrideReturns a readable representation for diagnostics and debugging.
Protected Functions
ensureAnalysis
protected · function · Source (opens in a new tab)
void sun::ast::VariableCreationAST::ensureAnalysis() const overrideOverride to allocate VariableAnalysis instead of base ExprAnalysis.
Related: VariableAnalysis, ExprAnalysis
Private Functions
varAnalysis
private · function · Source (opens in a new tab)
VariableAnalysis & sun::ast::VariableCreationAST::varAnalysis() constAccess as VariableAnalysis.
Related: VariableAnalysis
Private Fields
doc_
private · variable · Source (opens in a new tab)
std::string sun::ast::VariableCreationAST::doc_No documentation comment.
explicitCAbi_
private · variable · Source (opens in a new tab)
bool sun::ast::VariableCreationAST::explicitCAbi_ = falseNo documentation comment.
importedConstant_
private · variable · Source (opens in a new tab)
std::optional<sun::semantic_analysis::constants::ConstantValue> sun::ast::VariableCreationAST::importedConstant_No documentation comment.
Related: sun::semantic_analysis::constants::ConstantValue
isCExtern_
private · variable · Source (opens in a new tab)
bool sun::ast::VariableCreationAST::isCExtern_ = falseNo documentation comment.
isConst_
private · variable · Source (opens in a new tab)
bool sun::ast::VariableCreationAST::isConst_No documentation comment.
linkName_
private · variable · Source (opens in a new tab)
std::optional<std::string> sun::ast::VariableCreationAST::linkName_No documentation comment.
name
private · variable · Source (opens in a new tab)
std::string sun::ast::VariableCreationAST::nameNo documentation comment.
typeAnnotation
private · variable · Source (opens in a new tab)
std::optional<TypeAnnotation> sun::ast::VariableCreationAST::typeAnnotationNo documentation comment.
Related: TypeAnnotation
value
private · variable · Source (opens in a new tab)
std::unique_ptr<ExprAST> sun::ast::VariableCreationAST::valueNo documentation comment.
Related: ExprAST