Class MethodSymbol
java.lang.Object
org.ek9lang.compiler.symbols.Symbol
org.ek9lang.compiler.symbols.ScopedSymbol
org.ek9lang.compiler.symbols.MethodSymbol
- All Implemented Interfaces:
Serializable, IMayReturnSymbol, IScope, IScopedSymbol, ISymbol, ISymbolNature, ITokenReference
- Direct Known Subclasses:
CallSymbol, ServiceOperationSymbol, StreamCallSymbol
Represents some type of method that exists on an aggregate type scope.
Or it could just be a function type concept at the module level.
So it really is some type of callable 'thing' that has a scope of its own.
This scope is used to hold incoming parameters.
It can also have some form of visibility/access modifiers and holds the concept
of being overridable in terms of inheritance. In some cases it may also be
defined as one of the 'operators' such as '+' or '$' for example.
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface IScope
IScope.ScopeType -
Constructor Summary
ConstructorsConstructorDescriptionMethodSymbol(String name, Optional<ISymbol> type, IScope enclosingScope) Create new method symbol of a specific name with an enclosing scope (i.e.MethodSymbol(String name, IScope enclosingScope) Create new method symbol of a specific name with an enclosing scope (i.e.MethodSymbol(String name, ISymbol type, IScope enclosingScope) Typically used for cloning constructors. -
Method Summary
Modifier and TypeMethodDescriptionClone the symbol and re-parent if this symbol like a method should have a parent.protected MethodSymbolcloneIntoMethodSymbol(MethodSymbol newCopy) copyMethodProperties(MethodSymbol newCopy) Just copies the properties over.protected StringdoGetFriendlyName(String withName, Optional<ISymbol> theType) booleanAdded convenience method to make the parameters a bit more obvious.Provide the name an end user would need to see on the screen.For actual methods this will be the aggregate they are part of.Provide a symbol that is returned from this method.inthashCode()booleanbooleanbooleanbooleanisExactSignatureMatchTo(MethodSymbol toMethod) This method just checks that the signature has exactly the same types as parameters.booleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanbooleanisParameterSignatureMatchTo(List<ISymbol> params) Very important method; that checks if the parameter list provided can match the parameters declared for this method.booleanbooleanbooleanisPublic()booleanSome methods have a named return symbol 'like rtn as String' for example.booleanisSignatureMatchTo(MethodSymbol toMethod) Does the signature of this method match that of the method passed in.booleanbooleanprotected voidjustSetReturningSymbol(VariableSymbol returningSymbol) resolve(SymbolSearch search) Find the nearest symbol of that name up the scope tree.resolveInThisScopeOnly(SymbolSearch search) Just look in own scope.voidsetAccessModifier(String accessModifier) voidsetCallParameters(List<ISymbol> params) Typically used when making synthetic methods you want to add in all the params from another method or something.setConstructor(boolean constructor) voidsetEk9ReturnsThis(boolean ek9ReturnsThis) voidsetMarkedAbstract(boolean markedAbstract) voidsetMarkedAsDispatcher(boolean markedAsDispatcher) voidsetMarkedNoClone(boolean markedNoClone) setOperator(boolean operator) voidsetOverride(boolean override) voidsetReturningSymbol(VariableSymbol returningSymbol) Sets the returning symbol (variable not just type).voidsetSynthetic(boolean synthetic) voidsetUsedAsProxyForDelegate(String delegateName) Set this method to be marked so at it delegates any calls to a delegate.toString()Methods inherited from class ScopedSymbol
cloneIntoScopeSymbol, copyScopedSymbolProperties, define, findNearestDynamicBlockScopeInEnclosingScopes, findNearestNonBlockScopeInEnclosingScopes, getActualScope, getAllSymbolsMatchingName, getAnySuperTypeOrFunction, getEnclosingScope, getEncounteredExceptionToken, getFriendlyScopeName, getOuterMostTypeOrFunction, getScopeName, getScopeType, getSymbolsForThisScope, isMarkedPure, isMutable, isNotMarkedPure, isScopeAMatchForEnclosingScope, isTerminatedNormally, resolveMatchingMethods, resolveMatchingMethodsInThisScopeOnly, resolveMember, resolveWithParentScope, setEncounteredExceptionToken, setMarkedPure, setOuterMostTypeOrFunction, setScopeTypeMethods inherited from class Symbol
clearInitialisedBy, cloneIntoSymbol, copySymbolProperties, getAssignableCostTo, getAssignableCostTo, getCategory, getFullyQualifiedName, getGenus, getInitialisedBy, getName, getParsedModule, getProduceFullyQualifiedName, getSourceToken, getSquirrelledData, getSymbolTypeAsString, getType, getUnCoercedAssignableCostTo, isAssignableTo, isAssignableTo, isDevSource, isEk9Core, isExactSameType, isInjectionExpected, isLibSource, isNullAllowed, isPromotionSupported, isReferenced, putSquirrelledData, setCategory, setEk9Core, setGenus, setInitialisedBy, setInjectionExpected, setName, setNotMutable, setNullAllowed, setParsedModule, setProduceFullyQualifiedName, setReferenced, setSourceToken, setTypeMethods inherited from interface ISymbol
clearInitialisedBy, getAssignableCostTo, getAssignableCostTo, getFullyQualifiedName, getInitialisedBy, getName, getParsedModule, getSourceToken, getSquirrelledData, getType, getUnCoercedAssignableCostTo, isAssignableTo, isAssignableTo, isDeclaredAsConstant, isDevSource, isExactSameType, isExtensionOfInjectable, isFromLiteral, isIncomingParameter, isInitialised, isInjectable, isInjectionExpected, isLibSource, isLoopVariable, isNullAllowed, isPromotionSupported, isPropertyField, isReferenced, isReturningParameter, putSquirrelledData, setInitialisedBy, setInjectionExpected, setName, setNotMutable, setNullAllowed, setParsedModule, setReferenced, setType, setTypeMethods inherited from interface ISymbolNature
getCategory, getGenus, isApplication, isConceptualTypeParameter, isControl, isEk9Core, isFunction, isGenericInNature, isMethod, isParameterisedType, isPrimitiveType, isTemplateFunction, isTemplateType, isType, isVariable, setGenusMethods inherited from interface ITokenReference
setSourceToken
-
Constructor Details
-
MethodSymbol
-
MethodSymbol
-
MethodSymbol
-
-
Method Details
-
getParentScope
For actual methods this will be the aggregate they are part of. -
clone
-
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 interfaceIScope- Specified by:
clonein interfaceIScopedSymbol- Specified by:
clonein interfaceISymbol- Overrides:
clonein classScopedSymbol
-
cloneIntoMethodSymbol
-
copyMethodProperties
Just copies the properties over. -
resolveInThisScopeOnly
Description copied from interface:IScopeJust look in own scope.- Specified by:
resolveInThisScopeOnlyin interfaceIScope- Overrides:
resolveInThisScopeOnlyin classScopedSymbol
-
resolve
Description copied from interface:IScopeFind the nearest symbol of that name up the scope tree.- Specified by:
resolvein interfaceIScope- Overrides:
resolvein classScopedSymbol
-
isSynthetic
public boolean isSynthetic() -
setSynthetic
public void setSynthetic(boolean synthetic) -
isOverride
public boolean isOverride() -
setOverride
public void setOverride(boolean override) -
getAccessModifier
-
setAccessModifier
-
isPrivate
-
isProtected
public boolean isProtected()- Specified by:
isProtectedin interfaceISymbol
-
isPublic
-
isUsedAsProxyForDelegate
public boolean isUsedAsProxyForDelegate() -
getUsedAsProxyForDelegate
-
setUsedAsProxyForDelegate
Set this method to be marked so at it delegates any calls to a delegate. -
isEk9ReturnsThis
public boolean isEk9ReturnsThis() -
setEk9ReturnsThis
public void setEk9ReturnsThis(boolean ek9ReturnsThis) -
isMarkedNoClone
public boolean isMarkedNoClone() -
setMarkedNoClone
public void setMarkedNoClone(boolean markedNoClone) -
isMarkedAsDispatcher
public boolean isMarkedAsDispatcher() -
setMarkedAsDispatcher
public void setMarkedAsDispatcher(boolean markedAsDispatcher) -
isMarkedAbstract
public boolean isMarkedAbstract()- Specified by:
isMarkedAbstractin interfaceISymbol
-
setMarkedAbstract
public void setMarkedAbstract(boolean markedAbstract) -
isNotMarkedAbstract
public boolean isNotMarkedAbstract() -
isConstant
public boolean isConstant()- Specified by:
isConstantin interfaceISymbolNature
-
isConstructor
public boolean isConstructor() -
setConstructor
-
isNotConstructor
public boolean isNotConstructor() -
isOperator
public boolean isOperator() -
setOperator
-
isNotOperator
public boolean isNotOperator() -
isReturningSymbolPresent
public boolean isReturningSymbolPresent()Some methods have a named return symbol 'like rtn as String' for example. In other cases a method will not return anything (We use 'Void') in the case as the 'type'. So when a Returning Symbol is set we use the type of the returning variable as the type return on the method.- Specified by:
isReturningSymbolPresentin interfaceIMayReturnSymbol
-
getReturningSymbol
Provide a symbol that is returned from this method. Note in EK9 this is not just a type but actually a variable symbol (that has a type).- Specified by:
getReturningSymbolin interfaceIMayReturnSymbol
-
setReturningSymbol
Sets the returning symbol (variable not just type).- Specified by:
setReturningSymbolin interfaceIMayReturnSymbol
-
justSetReturningSymbol
-
isSignatureMatchTo
Does the signature of this method match that of the method passed in. Not the name of the method just the signature of the parameter types and special treatment for the return type - this can be coerced back or be a super type. This also takes into account polymorphism and promotions. -
isExactSignatureMatchTo
This method just checks that the signature has exactly the same types as parameters. So this is 'exact' in addition it does not check the return type at all, nor the method name. It just focuses on the number order and type of the parameters matching. -
isParameterSignatureMatchTo
-
getCallParameters
-
setCallParameters
-
getFriendlyName
Description copied from interface:ISymbolProvide the name an end user would need to see on the screen. Normally this is just 'getName' but in the case of Templates We use a very nasty internal naming for List of SomeClass - which will probably be something like _List_hashed_version_of_ComeClass and the end user needs to see 'List of SomeClass' for it to be meaningful.- Specified by:
getFriendlyNamein interfaceISymbol- Overrides:
getFriendlyNamein classSymbol- Returns:
- a user presentable of the symbol name.
-
doGetFriendlyName
-
equals
- Overrides:
equalsin classScopedSymbol
-
hashCode
public int hashCode()- Overrides:
hashCodein classScopedSymbol
-
toString
-