sun::ast::ClassDefinitionAST
class · Source (opens in a new tab)
class sun::ast::ClassDefinitionAST : public sun::ast::ExprASTClass definition: class Name<T, U> implements Interface1<T>, Interface2 { fields and methods }.
Inherits
- sun::ast::ExprAST (public)
Public Functions
- ClassDefinitionAST
- addCompiledSpecialization
- addSpecialization
- classKeyword
- dotLabel
- forEachChildSlot
- getCompiledSpecializations
- getConstructor
- getDoc
- getFields
- getImplementedInterfaces
- getLifetimeParameters
- getMethods
- getMutableFields
- getMutableMethods
- getName
- getQualifiedName
- getSpecialization
- getSpecializations
- getType
- getTypeParameterNames
- getTypeParameters
- hasCompiledSpecialization
- hasGenericMethods
- hasQualifiedName
- hasSpecialization
- isGeneric
- isPacked
- isPartial
- setDoc
- setIsPacked
- setIsPartial
- setLifetimeParameters
- setQualifiedName
- toString
ClassDefinitionAST
public · function · Source (opens in a new tab)
sun::ast::ClassDefinitionAST::ClassDefinitionAST(std::string name, std::vector< TypeParameter > typeParams, std::vector< ImplementedInterfaceAST > interfaces, std::vector< ClassFieldDecl > fields, std::vector< ClassMethodDecl > methods, bool precompiled=false)Creates this syntax node and takes ownership of any supplied child expressions.
Related: TypeParameter, ImplementedInterfaceAST, ClassFieldDecl, ClassMethodDecl
addCompiledSpecialization
public · function · Source (opens in a new tab)
void sun::ast::ClassDefinitionAST::addCompiledSpecialization(std::string key)Record a specialization supplied by the imported bundle.
addSpecialization
public · function · Source (opens in a new tab)
void sun::ast::ClassDefinitionAST::addSpecialization(DeclarationId id, std::shared_ptr< ClassDefinitionAST > specializedAST) constSpecialization storage for generic classes Called by semantic analyzer when a generic class is instantiated.
Related: DeclarationId, ClassDefinitionAST
classKeyword
public · function · Source (opens in a new tab)
const char * sun::ast::ClassDefinitionAST::classKeyword() constKeyword that introduces this qualifiedName in source.
dotLabel
public · function · Source (opens in a new tab)
std::string sun::ast::ClassDefinitionAST::dotLabel() const overrideReturns the node label used in syntax-tree graph visualizations.
forEachChildSlot
public · function · Source (opens in a new tab)
void sun::ast::ClassDefinitionAST::forEachChildSlot(const ChildSlotFn &fn) overrideVisits replaceable child expressions so tree passes can rewrite them in place.
Related: ChildSlotFn
getCompiledSpecializations
public · function · Source (opens in a new tab)
const std::set< std::string > & sun::ast::ClassDefinitionAST::getCompiledSpecializations() constReturn the specializations already compiled into the bundle.
getConstructor
public · function · Source (opens in a new tab)
const ClassMethodDecl * sun::ast::ClassDefinitionAST::getConstructor() constFind the constructor (init method).
Related: ClassMethodDecl
getDoc
public · function · Source (opens in a new tab)
const std::string & sun::ast::ClassDefinitionAST::getDoc() constComment written above the class (see doc_comments.h).
Related: doc_comments.h
getFields
public · function · Source (opens in a new tab)
const std::vector< ClassFieldDecl > & sun::ast::ClassDefinitionAST::getFields() constProvides the field declarations belonging to this type.
Related: ClassFieldDecl
getImplementedInterfaces
public · function · Source (opens in a new tab)
const std::vector< ImplementedInterfaceAST > & sun::ast::ClassDefinitionAST::getImplementedInterfaces() constProvides the interfaces implemented by this class.
Related: ImplementedInterfaceAST
getLifetimeParameters
public · function · Source (opens in a new tab)
const std::vector< LifetimeParameter > & sun::ast::ClassDefinitionAST::getLifetimeParameters() constProvides the declared lifetime parameters used to check borrowed values.
Related: LifetimeParameter
getMethods
public · function · Source (opens in a new tab)
const std::vector< ClassMethodDecl > & sun::ast::ClassDefinitionAST::getMethods() constProvides the method declarations belonging to this type.
Related: ClassMethodDecl
getMutableFields
public · function · Source (opens in a new tab)
std::vector< ClassFieldDecl > & sun::ast::ClassDefinitionAST::getMutableFields()Provides mutable access to field declarations for later compiler passes.
Related: ClassFieldDecl
getMutableMethods
public · function · Source (opens in a new tab)
std::vector< ClassMethodDecl > & sun::ast::ClassDefinitionAST::getMutableMethods()Allow adding methods from extensions (mutable for merging).
Related: ClassMethodDecl
getName
public · function · Source (opens in a new tab)
const std::string & sun::ast::ClassDefinitionAST::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::ClassDefinitionAST::getQualifiedName() constQualified name (after semantic analysis qualifies it).
Related: sun::semantic_analysis::QualifiedName
getSpecialization
public · function · Source (opens in a new tab)
std::shared_ptr< ClassDefinitionAST > sun::ast::ClassDefinitionAST::getSpecialization(DeclarationId id) constLooks up the instance previously created for the supplied type arguments.
Related: ClassDefinitionAST, DeclarationId
getSpecializations
public · function · Source (opens in a new tab)
const std::map< DeclarationId, std::shared_ptr< ClassDefinitionAST > > & sun::ast::ClassDefinitionAST::getSpecializations() constProvides the concrete instances created from this generic declaration.
Related: DeclarationId, ClassDefinitionAST
getType
public · function · Source (opens in a new tab)
ASTNodeType sun::ast::ClassDefinitionAST::getType() const overrideReturns the syntax-node kind used to dispatch tree visitors.
Related: ASTNodeType
getTypeParameterNames
public · function · Source (opens in a new tab)
std::vector< std::string > sun::ast::ClassDefinitionAST::getTypeParameterNames() constReturns the names used to bind generic arguments during specialization.
getTypeParameters
public · function · Source (opens in a new tab)
const std::vector< TypeParameter > & sun::ast::ClassDefinitionAST::getTypeParameters() constProvides the generic parameters declared by this type or function.
Related: TypeParameter
hasCompiledSpecialization
public · function · Source (opens in a new tab)
bool sun::ast::ClassDefinitionAST::hasCompiledSpecialization(const std::string &key) constReport whether the bundle supplies this concrete class.
hasGenericMethods
public · function · Source (opens in a new tab)
bool sun::ast::ClassDefinitionAST::hasGenericMethods() constReports whether this object has generic methods.
hasQualifiedName
public · function · Source (opens in a new tab)
bool sun::ast::ClassDefinitionAST::hasQualifiedName() constReports whether a name including the enclosing scopes has been assigned.
hasSpecialization
public · function · Source (opens in a new tab)
bool sun::ast::ClassDefinitionAST::hasSpecialization(DeclarationId id) constReports whether an instance already exists for the supplied type arguments.
Related: DeclarationId
isGeneric
public · function · Source (opens in a new tab)
bool sun::ast::ClassDefinitionAST::isGeneric() constReports whether this declaration still has unbound type parameters.
isPacked
public · function · Source (opens in a new tab)
bool sun::ast::ClassDefinitionAST::isPacked() constPacked class support: "packed class X {}" lays fields out with no padding.
isPartial
public · function · Source (opens in a new tab)
bool sun::ast::ClassDefinitionAST::isPartial() constPartial class support: "partial class X {}" adds methods to existing class.
setDoc
public · function · Source (opens in a new tab)
void sun::ast::ClassDefinitionAST::setDoc(std::string doc)Stores the source documentation comment for this declaration.
setIsPacked
public · function · Source (opens in a new tab)
void sun::ast::ClassDefinitionAST::setIsPacked(bool v)Controls whether the class uses a packed memory layout.
setIsPartial
public · function · Source (opens in a new tab)
void sun::ast::ClassDefinitionAST::setIsPartial(bool v)Marks whether this class declaration extends a partial class.
setLifetimeParameters
public · function · Source (opens in a new tab)
void sun::ast::ClassDefinitionAST::setLifetimeParameters(std::vector< LifetimeParameter > params)Stores the declared lifetime parameters used to check borrowed values.
Related: LifetimeParameter
setQualifiedName
public · function · Source (opens in a new tab)
void sun::ast::ClassDefinitionAST::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::ClassDefinitionAST::toString() const overrideReturns a readable representation for diagnostics and debugging.
Protected Functions
ensureAnalysis
protected · function · Source (opens in a new tab)
void sun::ast::ClassDefinitionAST::ensureAnalysis() const overrideOverride to allocate ClassAnalysis instead of base ExprAnalysis.
Related: ClassAnalysis, ExprAnalysis
Private Functions
classAnalysis
private · function · Source (opens in a new tab)
ClassAnalysis & sun::ast::ClassDefinitionAST::classAnalysis() constAccess as ClassAnalysis.
Related: ClassAnalysis
Private Fields
- compiledSpecializations_
- doc_
- fields
- implementedInterfaces
- isPacked_
- isPartial_
- lifetimeParameters
- methods
- name
- typeParameters
compiledSpecializations_
private · variable · Source (opens in a new tab)
std::set<std::string> sun::ast::ClassDefinitionAST::compiledSpecializations_No documentation comment.
doc_
private · variable · Source (opens in a new tab)
std::string sun::ast::ClassDefinitionAST::doc_No documentation comment.
fields
private · variable · Source (opens in a new tab)
std::vector<ClassFieldDecl> sun::ast::ClassDefinitionAST::fieldsNo documentation comment.
Related: ClassFieldDecl
implementedInterfaces
private · variable · Source (opens in a new tab)
std::vector<ImplementedInterfaceAST> sun::ast::ClassDefinitionAST::implementedInterfacesNo documentation comment.
Related: ImplementedInterfaceAST
isPacked_
private · variable · Source (opens in a new tab)
bool sun::ast::ClassDefinitionAST::isPacked_ = falseNo documentation comment.
isPartial_
private · variable · Source (opens in a new tab)
bool sun::ast::ClassDefinitionAST::isPartial_ = falseNo documentation comment.
lifetimeParameters
private · variable · Source (opens in a new tab)
std::vector<LifetimeParameter> sun::ast::ClassDefinitionAST::lifetimeParametersNo documentation comment.
Related: LifetimeParameter
methods
private · variable · Source (opens in a new tab)
std::vector<ClassMethodDecl> sun::ast::ClassDefinitionAST::methodsNo documentation comment.
Related: ClassMethodDecl
name
private · variable · Source (opens in a new tab)
std::string sun::ast::ClassDefinitionAST::nameNo documentation comment.
typeParameters
private · variable · Source (opens in a new tab)
std::vector<TypeParameter> sun::ast::ClassDefinitionAST::typeParametersNo documentation comment.
Related: TypeParameter