Class AggregateWithTraitsSymbol
java.lang.Object
org.ek9lang.compiler.symbols.Symbol
org.ek9lang.compiler.symbols.ScopedSymbol
org.ek9lang.compiler.symbols.CaptureScopedSymbol
org.ek9lang.compiler.symbols.PossibleGenericSymbol
org.ek9lang.compiler.symbols.AggregateSymbol
org.ek9lang.compiler.symbols.AggregateWithTraitsSymbol
- All Implemented Interfaces:
Serializable, IAggregateSymbol, ICanBeGeneric, ICanCaptureVariables, IScope, IScopedSymbol, ISymbol, ISymbolNature, ITokenReference
An aggregate, but one that can have zero or more traits (like interfaces).
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface IScope
IScope.ScopeType -
Constructor Summary
ConstructorsConstructorDescriptionAggregateWithTraitsSymbol(String name, Optional<ISymbol> type, IScope enclosingScope) AggregateWithTraitsSymbol(String name, IScope enclosingScope) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAllowedExtender(IAggregateSymbol extenderSymbol) For use with constraining types to be limited to a declared set.voidaddTrait(AggregateWithTraitsSymbol traitSymbol) mark this aggregate as having additional 'trait'.Clone the symbol and re-parent if this symbol like a method should have a parent.protected AggregateWithTraitsSymbolbooleanGets all abstract methods in this aggregate and any super classes.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.Gets all traits this class implements directly or indirectly through supers that have constraints upon them.Get all methods on this and any supers or traits.Get all methods not marked as abstract in this or any supers.getAllSymbolsMatchingName(String symbolName) Return a list of all the symbols that match the name.Get all the traits this aggregate implements - this means all the traits any of these traits extends.doubleGet the traits that this aggregates implements.doubleinthashCode()booleanDoes this aggregate have the trait passed in as an immediate trait.booleanisAllowingExtensionBy(IAggregateSymbol extenderSymbol) Is the extender allowed to implement this aggregate (normally a trait).booleanbooleanisImplementingInSomeWay(IAggregateSymbol traitSymbol) Only really used by aggregates that can have one or more traits.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.resolveWithParentScope(SymbolSearch search) Resolve using super aggregate and or any traits we have.Methods inherited from class AggregateSymbol
addSubAggregateSymbol, addTraitsIfNotPresent, cloneIntoAggregateSymbol, define, getAggregateDescription, getAllAbstractMethodsInThisScopeOnly, getAllMethodInThisScopeOnly, getAllNonAbstractMethodsInThisScopeOnly, getAllOperators, getAnySuperTypeOrFunction, getApplication, getConstructors, getFriendlyName, getPipeSinkType, getPipeSourceType, getProperties, getSubAggregateSymbols, getSuperAggregate, getType, hasImmediateSuper, isExtensionOfInjectable, isInAggregateHierarchy, isInjectable, isMarkedAsDispatcher, methodNotPresent, methodsMatch, setAggregateDescription, setApplication, setInjectable, setMarkedAsDispatcher, setName, setPipeSinkType, setPipeSourceType, setSuperAggregate, setSuperAggregate, setTypeMethods inherited from class PossibleGenericSymbol
addGenericSymbolReference, addTypeParameterOrArgument, cloneIntoPossibleGenericSymbol, getAnyConceptualTypeParameters, getAnyGenericParamsAsFriendlyNames, getGenericSymbolReferences, getGenericType, getTypeParameterOrArguments, isConceptualTypeParameter, isGenericInNature, isOpenForExtension, isParameterisedType, resolve, resolveFromParameterTypes, resolveInThisScopeOnly, setConceptualTypeParameter, 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, setEncounteredExceptionToken, setMarkedPure, setOuterMostTypeOrFunction, setScopeTypeMethods inherited from class Symbol
clearInitialisedBy, cloneIntoSymbol, copySymbolProperties, 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, setNotMutable, setNullAllowed, setParsedModule, setProduceFullyQualifiedName, setReferenced, setSourceToken, toStringMethods inherited from interface IAggregateSymbol
getName, getScopeTypeMethods 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, 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, 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
-
AggregateWithTraitsSymbol
-
AggregateWithTraitsSymbol
-
-
Method Details
-
cloneIntoAggregateWithTraitsSymbol
protected AggregateWithTraitsSymbol cloneIntoAggregateWithTraitsSymbol(AggregateWithTraitsSymbol newCopy) -
addTrait
mark this aggregate as having additional 'trait'. -
hasImmediateTrait
Does this aggregate have the trait passed in as an immediate trait. i.e. one it implements itself. Note this is different from being compatible with the trait via hierarchy!- Parameters:
trait- The trait to check.- Returns:
- true if it does false otherwise.
-
addAllowedExtender
For use with constraining types to be limited to a declared set. -
getAllowedExtenders
-
isAllowingExtensionBy
Is the extender allowed to implement this aggregate (normally a trait).- Parameters:
extenderSymbol- The class (normally the one we are testing)- Returns:
- true if extending is allowed.
-
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 classAggregateSymbol
-
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 classAggregateSymbol
-
getUnCoercedAssignableCostTo
- Specified by:
getUnCoercedAssignableCostToin interfaceISymbol- Overrides:
getUnCoercedAssignableCostToin classAggregateSymbol
-
getAssignableCostTo
- Specified by:
getAssignableCostToin interfaceISymbol- Overrides:
getAssignableCostToin classSymbol
-
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- Overrides:
isImplementingInSomeWayin classAggregateSymbol
-
getTraits
Get the traits that this aggregates implements.- Returns:
- The list of traits.
-
getAllExtensionConstrainedTraits
Gets all traits this class implements directly or indirectly through supers that have constraints upon them. The list of constraining traits - no implication or check on what they are constrained to - that's up to the caller. -
getAllTraits
Get all the traits this aggregate implements - this means all the traits any of these traits extends. But also going up the class supers and getting those traits and any of the traits they extend.- Specified by:
getAllTraitsin interfaceIAggregateSymbol- Overrides:
getAllTraitsin classAggregateSymbol
-
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- Overrides:
getAllEffectiveMethodsin classAggregateSymbol- 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- Overrides:
getAllMethodsin classAggregateSymbol- Returns:
- the list
-
getAllAbstractMethods
Gets all abstract methods in this aggregate and any super classes.- Specified by:
getAllAbstractMethodsin interfaceIAggregateSymbol- Overrides:
getAllAbstractMethodsin classAggregateSymbol- Returns:
- A list of all the methods marked as abstract.
-
isExtensionConstrained
public boolean isExtensionConstrained() -
getAllNonAbstractMethods
Description copied from interface:IAggregateSymbolGet all methods not marked as abstract in this or any supers.- Specified by:
getAllNonAbstractMethodsin interfaceIAggregateSymbol- Overrides:
getAllNonAbstractMethodsin classAggregateSymbol- Returns:
- The list.
-
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 classAggregateSymbol
-
resolveMember
Description copied from class:AggregateSymbolJust try and resolve a member in this or super scopes.- Specified by:
resolveMemberin interfaceIAggregateSymbol- Specified by:
resolveMemberin interfaceIScope- Overrides:
resolveMemberin classAggregateSymbol
-
resolveWithParentScope
Resolve using super aggregate and or any traits we have. Look in our traits first then go to the normal AggregateSymbol resolution.- Overrides:
resolveWithParentScopein classScopedSymbol
-
equals
- Overrides:
equalsin classAggregateSymbol
-
hashCode
public int hashCode()- Overrides:
hashCodein classAggregateSymbol
-