Package org.ek9lang.compiler.symbols
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
,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 org.ek9lang.compiler.symbols.IScope
IScope.ScopeType
Nested classes/interfaces inherited from interface org.ek9lang.compiler.symbols.ISymbol
ISymbol.SymbolCategory, ISymbol.SymbolGenus
-
Field Summary
Fields inherited from interface org.ek9lang.compiler.symbols.ISymbol
NOT_ASSIGNABLE
-
Constructor Summary
ConstructorDescriptionAggregateWithTraitsSymbol
(String name, Optional<ISymbol> type, IScope enclosingScope) AggregateWithTraitsSymbol
(String name, IScope enclosingScope) -
Method Summary
Modifier and TypeMethodDescriptionvoid
addAllowedExtender
(IAggregateSymbol extenderSymbol) For use with constraining types to be limited to a declared set.void
addTrait
(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 AggregateWithTraitsSymbol
boolean
Gets all abstract methods in this aggregate and any super classes.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.double
Get the traits that this aggregates implements.double
int
hashCode()
boolean
Does this aggregate have the trait passed in as an immediate trait.boolean
isAllowingExtensionBy
(IAggregateSymbol extenderSymbol) Is the extender allowed to implement this aggregate (normally a trait).boolean
boolean
isImplementingInSomeWay
(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 org.ek9lang.compiler.symbols.AggregateSymbol
addSubAggregateSymbol, addTraitsIfNotPresent, cloneIntoAggregateSymbol, define, getAggregateDescription, getAllAbstractMethodsInThisScopeOnly, getAllMethodInThisScopeOnly, getAllNonAbstractMethodsInThisScopeOnly, getAllOperators, getAnySuperTypeOrFunction, getConstructors, getFriendlyName, getPipeSinkType, getPipeSourceType, getProperties, getSubAggregateSymbols, getSuperAggregate, getType, hasImmediateSuper, isExtensionOfInjectable, isInAggregateHierarchy, isInjectable, isMarkedAsDispatcher, setAggregateDescription, setInjectable, setMarkedAsDispatcher, setName, setPipeSinkType, setPipeSourceType, setSuperAggregate, setSuperAggregate, setType
Methods inherited from class org.ek9lang.compiler.symbols.PossibleGenericSymbol
addGenericSymbolReference, addTypeParameterOrArgument, cloneIntoPossibleGenericSymbol, getAnyConceptualTypeParameters, getAnyGenericParamsAsFriendlyNames, getGenericSymbolReferences, getGenericType, getTypeParameterOrArguments, isConceptualTypeParameter, isGenericInNature, isOpenForExtension, isParameterisedType, resolve, resolveFromParameterTypes, resolveInThisScopeOnly, setConceptualTypeParameter, setGenericType, setGenericType, setOpenForExtension
Methods inherited from class org.ek9lang.compiler.symbols.CaptureScopedSymbol
cloneIntoCaptureScopedSymbol, getCapturedVariables, getModuleScope, getPrivateVariablesForDisplay, isMarkedAbstract, resolveExcludingCapturedVariables, setCapturedVariables, setCapturedVariables, setCapturedVariablesVisibility, setMarkedAbstract, setModuleScope
Methods inherited from class org.ek9lang.compiler.symbols.ScopedSymbol
cloneIntoScopeSymbol, copyScopedSymbolProperties, findNearestDynamicBlockScopeInEnclosingScopes, findNearestNonBlockScopeInEnclosingScopes, getActualScope, getEnclosingScope, getEncounteredExceptionToken, getFriendlyScopeName, getOuterMostTypeOrFunction, getScopeName, getScopeType, getSymbolsForThisScope, isMarkedPure, isMutable, isNotMarkedPure, isScopeAMatchForEnclosingScope, isTerminatedNormally, resolveMatchingMethodsInThisScopeOnly, setEncounteredExceptionToken, setMarkedPure, setOuterMostTypeOrFunction, setScopeType
Methods inherited from class org.ek9lang.compiler.symbols.Symbol
clearInitialisedBy, cloneIntoSymbol, copySymbolProperties, getAssignableWeightTo, 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, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.ek9lang.compiler.symbols.IAggregateSymbol
getName, getScopeType
Methods inherited from interface org.ek9lang.compiler.symbols.ICanBeGeneric
addGenericSymbolReference, addTypeParameterOrArgument, getAnyConceptualTypeParameters, getGenericSymbolReferences, getGenericType, getTypeParameterOrArguments, isOpenForExtension
Methods inherited from interface org.ek9lang.compiler.symbols.IScope
findNearestDynamicBlockScopeInEnclosingScopes, findNearestNonBlockScopeInEnclosingScopes, getEnclosingScope, getEncounteredExceptionToken, getFriendlyScopeName, getScopeName, getSymbolsForThisScope, isMarkedPure, isScopeAMatchForEnclosingScope, isTerminatedNormally, resolve, resolveInThisScopeOnly, resolveMatchingMethodsInThisScopeOnly, setEncounteredExceptionToken
Methods inherited from interface org.ek9lang.compiler.symbols.ISymbol
clearInitialisedBy, getAssignableWeightTo, getCategory, getFullyQualifiedName, getGenus, getInitialisedBy, getParsedModule, getSourceToken, getSquirrelledData, isApplication, isAssignableTo, isAssignableTo, isConceptualTypeParameter, isConstant, isControl, isDeclaredAsConstant, isDevSource, isEk9Core, isExactSameType, isFromLiteral, isFunction, isGenericInNature, isIncomingParameter, isInitialised, isInjectionExpected, isLibSource, isLoopVariable, isMarkedAbstract, isMarkedPure, isMethod, isMutable, isNullAllowed, isParameterisedType, isPrimitiveType, isPrivate, isPromotionSupported, isPropertyField, isProtected, isPublic, isReferenced, isReturningParameter, isTemplateFunction, isTemplateType, isType, isVariable, putSquirrelledData, setGenus, setInitialisedBy, setInjectionExpected, setNotMutable, setNullAllowed, setParsedModule, setReferenced, setType
Methods inherited from interface org.ek9lang.compiler.symbols.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:IScope
Return a list of all the symbols that match the name. So for class and traits this must include supers and traits.- Specified by:
getAllSymbolsMatchingName
in interfaceIScope
- Overrides:
getAllSymbolsMatchingName
in classAggregateSymbol
-
clone
Description copied from interface:ISymbol
Clone the symbol and re-parent if this symbol like a method should have a parent. Other symbols like VariableSymbols are un-parented- Specified by:
clone
in interfaceIAggregateSymbol
- Specified by:
clone
in interfaceIScope
- Specified by:
clone
in interfaceIScopedSymbol
- Specified by:
clone
in interfaceISymbol
- Overrides:
clone
in classAggregateSymbol
-
getUnCoercedAssignableWeightTo
- Specified by:
getUnCoercedAssignableWeightTo
in interfaceISymbol
- Overrides:
getUnCoercedAssignableWeightTo
in classAggregateSymbol
-
getAssignableWeightTo
- Specified by:
getAssignableWeightTo
in interfaceISymbol
- Overrides:
getAssignableWeightTo
in classSymbol
-
isImplementingInSomeWay
Description copied from interface:IAggregateSymbol
Only 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:
isImplementingInSomeWay
in interfaceIAggregateSymbol
- Overrides:
isImplementingInSomeWay
in 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:
getAllTraits
in interfaceIAggregateSymbol
- Overrides:
getAllTraits
in classAggregateSymbol
-
getAllMethods
Description copied from interface:IAggregateSymbol
Get all methods on this and any supers or traits.- Specified by:
getAllMethods
in interfaceIAggregateSymbol
- Overrides:
getAllMethods
in classAggregateSymbol
- Returns:
- the list
-
getAllAbstractMethods
Gets all abstract methods in this aggregate and any super classes.- Specified by:
getAllAbstractMethods
in interfaceIAggregateSymbol
- Overrides:
getAllAbstractMethods
in classAggregateSymbol
- Returns:
- A list of all the methods marked as abstract.
-
isExtensionConstrained
public boolean isExtensionConstrained() -
getAllNonAbstractMethods
Description copied from interface:IAggregateSymbol
Get all methods not marked as abstract in this or any supers.- Specified by:
getAllNonAbstractMethods
in interfaceIAggregateSymbol
- Overrides:
getAllNonAbstractMethods
in classAggregateSymbol
- Returns:
- The list.
-
resolveMatchingMethods
public MethodSymbolSearchResult resolveMatchingMethods(MethodSymbolSearch search, MethodSymbolSearchResult result) Description copied from interface:IScope
Looks in scope and parent scopes.- Specified by:
resolveMatchingMethods
in interfaceIAggregateSymbol
- Specified by:
resolveMatchingMethods
in interfaceIScope
- Overrides:
resolveMatchingMethods
in classAggregateSymbol
-
resolveMember
Description copied from class:AggregateSymbol
Just try and resolve a member in this or super scopes.- Specified by:
resolveMember
in interfaceIAggregateSymbol
- Specified by:
resolveMember
in interfaceIScope
- Overrides:
resolveMember
in 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:
resolveWithParentScope
in classScopedSymbol
-
equals
- Overrides:
equals
in classAggregateSymbol
-
hashCode
public int hashCode()- Overrides:
hashCode
in classAggregateSymbol
-