Class AggregateSymbol
- All Implemented Interfaces:
Serializable, IAggregateSymbol, ICanBeGeneric, ICanCaptureVariables, IScope, IScopedSymbol, ISymbol, ISymbolNature, ITokenReference
- Direct Known Subclasses:
AggregateWithTraitsSymbol, AnyTypeSymbol
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface IScope
IScope.ScopeType -
Constructor Summary
ConstructorsConstructorDescriptionAggregateSymbol(String name, Optional<ISymbol> type, IScope enclosingScope) A simple straight forward aggregate type, like a class or record.AggregateSymbol(String name, IScope enclosingScope) A simple straight forward aggregate type, like a class or record.AggregateSymbol(String name, IScope enclosingScope, List<ISymbol> typeParameterOrArguments) An aggregate that can be parameterised, i.e. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBlockCallEntry(BlockCallEntry entry) Add a block call entry from a block statement in an application block.voidaddInjectionField(ISymbol field) Record that a field on this aggregate is marked for injection.voidaddRegistration(RegistrationData registration) Add a registration from a 'register' statement in an application block.protected voidaddTraitsIfNotPresent(List<AggregateWithTraitsSymbol> exiting, List<AggregateWithTraitsSymbol> additions) Clone the symbol and re-parent if this symbol like a method should have a parent.protected AggregateSymbolcloneIntoAggregateSymbol(AggregateSymbol newCopy) voidDefine a Symbol in this scope.booleanTwo symbols are the same symbol when they agree on name, category, genus, mutability AND the declaration site they came from.Typically used for synthetically generated aggregates.Gets all abstract methods in this aggregate and any super classes.Get all methods in this scope only that are abstract.Gets all methods that are effective, by this I mean if supers (classes or traits) have the same method name but, it has been overridden then we would only retain the 'overridden' one as that has taken effect.All methods abstract and non-abstract in this scope.Get all methods on this and any supers or traits.Get all methods not marked as abstract in this or any supers.Get all methods in this scope only that are not abstract.Get all operators on this and any supers or traits.getAllSymbolsMatchingName(String symbolName) Return a list of all the symbols that match the name.Get all block call entries from block statements in this application.The constraint model for a CLASS_CONSTRAINED aggregate, or null if none/not modellable.A list of all the defined constructors.Provides a friendly name of this aggregate that could be presented to the developer.Get all fields marked for injection on this aggregate.Provides access to the properties on this aggregate - but only this aggregate.Get all registrations from 'register' statements in this application.getType()doubleinthashCode()Mixes in exactly the fieldsSymbol.equals(Object)compares, and nothing else.booleanhasImmediateSuper(IAggregateSymbol theSuper) booleanWhile this aggregate itself might not able been marked as injectable Does this extend an aggregate that is marked as injectable.booleanisImplementingInSomeWay(IAggregateSymbol aggregate) Only really used by aggregates that can have one or more traits.booleanisInAggregateHierarchy(IAggregateSymbol theAggregateToCheck) Does the aggregate passed in exist in this type hierarchy.booleanSome classes generated can be injected and others not.booleanIs this aggregate a dispatcher or just a normal class component whatever.protected booleanmethodNotPresent(List<MethodSymbol> defined, MethodSymbol checkMethod) protected booleanmethodsMatch(MethodSymbol m1, MethodSymbol m2) resolveMatchingMethods(MethodSymbolSearch search, MethodSymbolSearchResult result) Looks in scope and parent scopes.resolveMember(SymbolSearch search) Just try and resolve a member in this or super scopes.voidsetAggregateDescription(String aggregateDescription) Typically used for synthetically generated aggregates.voidsetApplication(AggregateSymbol application) voidsetConstraint(ConstraintExpr constraint) voidsetInjectable(boolean injectable) voidsetMarkedAsDispatcher(boolean markedAsDispatcher) voidsetPipeSinkType(Optional<String> pipeSinkType) voidsetPipeSourceType(Optional<String> pipeSourceType) voidsetSuperAggregate(Optional<IAggregateSymbol> superAggregate) Set the 'super' of this type.voidsetSuperAggregate(IAggregateSymbol baseSymbol) Methods inherited from class PossibleGenericSymbol
addGenericSymbolReference, addTypeParameterOrArgument, cloneIntoPossibleGenericSymbol, getAnyConceptualTypeParameters, getAnyGenericParamsAsFriendlyNames, getDefinitionContext, getGenericSymbolReferences, getGenericType, getTypeParameterOrArguments, isConceptualTypeParameter, isGenericInNature, isOpenForExtension, isParameterisedType, resolve, resolveFromParameterTypes, resolveInThisScopeOnly, setConceptualTypeParameter, setDefinitionContext, setGenericType, setGenericType, setOpenForExtensionMethods inherited from class CaptureScopedSymbol
cloneIntoCaptureScopedSymbol, getCapturedVariables, getModuleScope, getPrivateVariablesForDisplay, isMarkedAbstract, resolveExcludingCapturedVariables, setCapturedVariables, setCapturedVariables, setCapturedVariablesVisibility, setMarkedAbstract, setModuleScopeMethods inherited from class ScopedSymbol
cloneIntoScopeSymbol, copyScopedSymbolProperties, findNearestDynamicBlockScopeInEnclosingScopes, findNearestNonBlockScopeInEnclosingScopes, getActualScope, getEnclosingScope, getEncounteredExceptionToken, getFriendlyScopeName, getOuterMostTypeOrFunction, getScopeName, getScopeType, getSymbolsForThisScope, isMarkedPure, isMutable, isNotMarkedPure, isScopeAMatchForEnclosingScope, isTerminatedNormally, resolveMatchingMethodsInThisScopeOnly, resolveWithParentScope, setEncounteredExceptionToken, setMarkedPure, setOuterMostTypeOrFunction, setScopeTypeMethods inherited from class Symbol
clearInitialisedBy, cloneIntoSymbol, copySymbolProperties, getAssignableCostTo, getAssignableCostTo, getCategory, getFullyQualifiedName, getGenus, getInitialisedBy, getName, getParsedModule, getProduceFullyQualifiedName, getSourceToken, getSquirrelledData, getSymbolTypeAsString, isAssignableTo, isAssignableTo, isDevSource, isEk9Core, isExactSameType, isInjectionExpected, isLibSource, isNullAllowed, isPromotionSupported, isReferenced, putSquirrelledData, setCategory, setEk9Core, setGenus, setInitialisedBy, setInjectionExpected, setName, setNotMutable, setNullAllowed, setParsedModule, setProduceFullyQualifiedName, setReferenced, setSourceToken, toStringMethods inherited from interface IAggregateSymbol
getAllExtensionConstrainedTraits, getName, getScopeType, getTraits, isExtensionConstrainedMethods inherited from interface ICanBeGeneric
addGenericSymbolReference, addTypeParameterOrArgument, getAnyConceptualTypeParameters, getGenericSymbolReferences, getGenericType, getTypeParameterOrArguments, isOpenForExtensionMethods inherited from interface IScope
findNearestDynamicBlockScopeInEnclosingScopes, findNearestNonBlockScopeInEnclosingScopes, getEnclosingScope, getEncounteredExceptionToken, getFriendlyScopeName, getScopeName, getSymbolsForThisScope, isMarkedPure, isScopeAMatchForEnclosingScope, isTerminatedNormally, resolve, resolveInThisScopeOnly, resolveMatchingMethodsInThisScopeOnly, setEncounteredExceptionTokenMethods inherited from interface ISymbol
clearInitialisedBy, getAssignableCostTo, getAssignableCostTo, getFullyQualifiedName, getInitialisedBy, getParsedModule, getSourceToken, getSquirrelledData, isAssignableTo, isAssignableTo, isDeclaredAsConstant, isDevSource, isExactSameType, isFromLiteral, isIncomingParameter, isInitialised, isInjectionExpected, isLibSource, isLoopVariable, isMarkedAbstract, isMarkedPure, isMutable, isNullAllowed, isPrivate, isPromotionSupported, isPropertyField, isProtected, isPublic, isReferenced, isReturningParameter, putSquirrelledData, setInitialisedBy, setInjectionExpected, setName, setNotMutable, setNullAllowed, setParsedModule, setReferenced, setTypeMethods inherited from interface ISymbolNature
getCategory, getGenus, isApplication, isConceptualTypeParameter, isConstant, isControl, isEk9Core, isFunction, isGenericInNature, isMethod, isParameterisedType, isPrimitiveType, isTemplateFunction, isTemplateType, isType, isVariable, setGenusMethods inherited from interface ITokenReference
setSourceToken
-
Constructor Details
-
AggregateSymbol
-
AggregateSymbol
-
AggregateSymbol
-
-
Method Details
-
clone
Description copied from interface:ISymbolClone the symbol and re-parent if this symbol like a method should have a parent. Other symbols like VariableSymbols are un-parented- Specified by:
clonein interfaceIAggregateSymbol- Specified by:
clonein interfaceIScope- Specified by:
clonein interfaceIScopedSymbol- Specified by:
clonein interfaceISymbol- Overrides:
clonein classPossibleGenericSymbol
-
cloneIntoAggregateSymbol
-
getApplication
-
setApplication
-
addInjectionField
Record that a field on this aggregate is marked for injection. -
getInjectionFields
-
addRegistration
Add a registration from a 'register' statement in an application block. -
getRegistrations
Get all registrations from 'register' statements in this application. -
addBlockCallEntry
Add a block call entry from a block statement in an application block. -
getBlockCallEntries
Get all block call entries from block statements in this application. -
define
-
getAnySuperTypeOrFunction
- Overrides:
getAnySuperTypeOrFunctionin classScopedSymbol
-
getFriendlyName
Provides a friendly name of this aggregate that could be presented to the developer.- Specified by:
getFriendlyNamein interfaceISymbol- Overrides:
getFriendlyNamein classPossibleGenericSymbol- Returns:
- The friendly name - especially useful for anonymous dynamic types.
-
getAggregateDescription
Typically used for synthetically generated aggregates.- Specified by:
getAggregateDescriptionin interfaceIAggregateSymbol- Returns:
- A description or the friendly name of no description has been set.
-
setAggregateDescription
Typically used for synthetically generated aggregates. -
getPipeSinkType
- Specified by:
getPipeSinkTypein interfaceIAggregateSymbol
-
setPipeSinkType
-
getPipeSourceType
-
setPipeSourceType
-
isMarkedAsDispatcher
public boolean isMarkedAsDispatcher()Description copied from interface:IAggregateSymbolIs this aggregate a dispatcher or just a normal class component whatever.- Specified by:
isMarkedAsDispatcherin interfaceIAggregateSymbol- Returns:
- true if marked as a dispatcher.
-
setMarkedAsDispatcher
public void setMarkedAsDispatcher(boolean markedAsDispatcher) - Specified by:
setMarkedAsDispatcherin interfaceIAggregateSymbol
-
getConstraint
The constraint model for a CLASS_CONSTRAINED aggregate, or null if none/not modellable. -
setConstraint
-
isInjectable
public boolean isInjectable()Description copied from interface:ISymbolSome classes generated can be injected and others not.- Specified by:
isInjectablein interfaceISymbol- Returns:
- true if this can be injected, false if not.
-
setInjectable
public void setInjectable(boolean injectable) -
getAllAbstractMethods
Gets all abstract methods in this aggregate and any super classes.- Specified by:
getAllAbstractMethodsin interfaceIAggregateSymbol- Returns:
- A list of all the methods marked as abstract.
-
getProperties
Provides access to the properties on this aggregate - but only this aggregate.- Specified by:
getPropertiesin interfaceIAggregateSymbol- Returns:
- The list of properties.
-
getConstructors
Description copied from interface:IAggregateSymbolA list of all the defined constructors.- Specified by:
getConstructorsin interfaceIAggregateSymbol- Returns:
- The list of constructors
-
getAllEffectiveMethods
Description copied from interface:IAggregateSymbolGets all methods that are effective, by this I mean if supers (classes or traits) have the same method name but, it has been overridden then we would only retain the 'overridden' one as that has taken effect. In the case of a trait that has multiple traits where the same method has been overridden in the trait only one method is now in effect. However, if there are multiple traits (or a super has the same method name) we would end up with 'duplicate' methods of the same name in this list 'CheckConflictingMethods' will need to detect this.- Specified by:
getAllEffectiveMethodsin interfaceIAggregateSymbol- Returns:
- A List of methods that are in effect.
-
getAllMethods
Description copied from interface:IAggregateSymbolGet all methods on this and any supers or traits.- Specified by:
getAllMethodsin interfaceIAggregateSymbol- Returns:
- the list
-
getAllOperators
Description copied from interface:IAggregateSymbolGet all operators on this and any supers or traits.- Specified by:
getAllOperatorsin interfaceIAggregateSymbol- Returns:
- the list
-
getAllNonAbstractMethods
Description copied from interface:IAggregateSymbolGet all methods not marked as abstract in this or any supers.- Specified by:
getAllNonAbstractMethodsin interfaceIAggregateSymbol- Returns:
- The list.
-
getAllNonAbstractMethodsInThisScopeOnly
Description copied from interface:IAggregateSymbolGet all methods in this scope only that are not abstract.- Specified by:
getAllNonAbstractMethodsInThisScopeOnlyin interfaceIAggregateSymbol- Returns:
- The list
-
getAllAbstractMethodsInThisScopeOnly
Description copied from interface:IAggregateSymbolGet all methods in this scope only that are abstract.- Specified by:
getAllAbstractMethodsInThisScopeOnlyin interfaceIAggregateSymbol- Returns:
- The list
-
getAllMethodInThisScopeOnly
Description copied from interface:IAggregateSymbolAll methods abstract and non-abstract in this scope.- Specified by:
getAllMethodInThisScopeOnlyin interfaceIAggregateSymbol
-
isImplementingInSomeWay
Description copied from interface:IAggregateSymbolOnly really used by aggregates that can have one or more traits. But also super classes or super traits. So can either be implementing directly, super, super - super or traits and supe traits.- Specified by:
isImplementingInSomeWayin interfaceIAggregateSymbol
-
getAllTraits
- Specified by:
getAllTraitsin interfaceIAggregateSymbol
-
addTraitsIfNotPresent
protected void addTraitsIfNotPresent(List<AggregateWithTraitsSymbol> exiting, List<AggregateWithTraitsSymbol> additions) -
isExtensionOfInjectable
public boolean isExtensionOfInjectable()Description copied from interface:ISymbolWhile this aggregate itself might not able been marked as injectable Does this extend an aggregate that is marked as injectable.- Specified by:
isExtensionOfInjectablein interfaceISymbol- Returns:
- true if this is injectable or any of its supers area
-
getUnCoercedAssignableCostTo
- Specified by:
getUnCoercedAssignableCostToin interfaceISymbol- Overrides:
getUnCoercedAssignableCostToin classSymbol
-
getSuperAggregate
- Specified by:
getSuperAggregatein interfaceIAggregateSymbol
-
setSuperAggregate
Set the 'super' of this type.- Specified by:
setSuperAggregatein interfaceIAggregateSymbol
-
setSuperAggregate
- Specified by:
setSuperAggregatein interfaceIAggregateSymbol
-
hasImmediateSuper
-
isInAggregateHierarchy
Does the aggregate passed in exist in this type hierarchy. This does include a check that this is the same aggregate.- Specified by:
isInAggregateHierarchyin interfaceIAggregateSymbol
-
setType
-
getType
-
getAllSymbolsMatchingName
Description copied from interface:IScopeReturn a list of all the symbols that match the name. So for class and traits this must include supers and traits.- Specified by:
getAllSymbolsMatchingNamein interfaceIScope- Overrides:
getAllSymbolsMatchingNamein classScopedSymbol
-
resolveMatchingMethods
public MethodSymbolSearchResult resolveMatchingMethods(MethodSymbolSearch search, MethodSymbolSearchResult result) Description copied from interface:IScopeLooks in scope and parent scopes.- Specified by:
resolveMatchingMethodsin interfaceIAggregateSymbol- Specified by:
resolveMatchingMethodsin interfaceIScope- Overrides:
resolveMatchingMethodsin classScopedSymbol
-
resolveMember
Just try and resolve a member in this or super scopes.- Specified by:
resolveMemberin interfaceIAggregateSymbol- Specified by:
resolveMemberin interfaceIScope- Overrides:
resolveMemberin classScopedSymbol
-
methodNotPresent
-
methodsMatch
-
equals
Description copied from class:SymbolTwo symbols are the same symbol when they agree on name, category, genus, mutability AND the declaration site they came from.The source token is part of identity deliberately. Name alone is not enough: symbol names are unqualified here, so two unrelated variables both called
count, or two types calledFooin different modules, would otherwise compare equal. The compiler relies on telling those apart -CodeFlowMapkeys initialisation state onMap<IScope, Map<ISymbol, SymbolAccess>>, and conflating two same-named declarations there makes flow analysis attribute one variable's initialisation to another.That distinction used to be present ONLY in
Symbol.hashCode(), which is why this looked like it worked: two same-named symbols compared equal yet hashed apart, so hash collections usually - but not reliably - kept them separate, while any directequalscall saw them as one. Encoding it here makes the two agree. SeeSymbolEqualsHashCodeContractTest.- Overrides:
equalsin classPossibleGenericSymbol
-
hashCode
public int hashCode()Description copied from class:SymbolMixes in exactly the fieldsSymbol.equals(Object)compares, and nothing else.A hashCode may legitimately use FEWER fields than equals (that only causes collisions, which are correct), but never MORE: any extra field makes two symbols that compare equal land in different buckets, so a HashSet silently holds visible duplicates and a HashMap lookup misses an entry that is present. This method used to mix in purity, which no equals at THIS level consults - purity belongs in
FunctionSymbol, the level whose equals compares it. The source token stays, and is now matched bySymbol.equals(Object). SeeSymbolEqualsHashCodeContractTest.- Overrides:
hashCodein classPossibleGenericSymbol
-