Class ExpressionSymbol
java.lang.Object
org.ek9lang.compiler.symbols.Symbol
org.ek9lang.compiler.symbols.ExpressionSymbol
- All Implemented Interfaces:
Serializable, ISymbol, ISymbolNature, ITokenReference
While we don't add these in the scoped structures when compiling.
We do use these to augment the parse tree for the appropriate context.
We do this so that we can work out what type of result will be returned from an expression.
See methods like isExactSameType and isAssignableTo for type checking in the Symbol class.
The idea is to augment the parse tree with these expression symbols so that once we've been
through sufficient passes of the tree we have sufficient information to add in any
promotions/coercions and also check the type of parameters on operations are compatible.
We can then add in explicit IR type conversions if needed.
This information will also be used in the semantic analysis phase.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionExpressionSymbol(String name) ExpressionSymbol(ISymbol symbol) Create a new expression based around an existing symbol. -
Method Summary
Modifier and TypeMethodDescriptionClone the symbol and re-parent if this symbol like a method should have a parent.protected ExpressionSymbolbooleanProvide the name an end user would need to see on the screen.inthashCode()booleanbooleanOnly use on symbols, to see if they are directly defined as a constant.booleanEven constants can be mutable until set.booleanbooleanvoidsetDeclaredAsConstant(boolean declaredAsConstant) voidvoidsetPromotionRequired(boolean promotionRequired) voidsetSourceToken(IToken sourceToken) voidsetUseStringOperator(boolean useStringOperator) Methods 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, isMarkedPure, isNullAllowed, isPromotionSupported, isReferenced, putSquirrelledData, setCategory, setEk9Core, setGenus, setInitialisedBy, setInjectionExpected, setMarkedPure, setName, setNullAllowed, setParsedModule, setProduceFullyQualifiedName, setReferenced, setType, toStringMethods inherited from interface ISymbol
isExtensionOfInjectable, isFromLiteral, isIncomingParameter, isInitialised, isInjectable, isLoopVariable, isMarkedAbstract, isPrivate, isPropertyField, isProtected, isPublic, isReturningParameter, setTypeMethods inherited from interface ISymbolNature
isApplication, isConceptualTypeParameter, isControl, isFunction, isGenericInNature, isMethod, isParameterisedType, isPrimitiveType, isTemplateFunction, isTemplateType, isType, isVariable
-
Constructor Details
-
ExpressionSymbol
Create a new expression based around an existing symbol. -
ExpressionSymbol
-
-
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 -
cloneIntoExpressionSymbol
-
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.
-
isDeclaredAsConstant
public boolean isDeclaredAsConstant()Description copied from interface:ISymbolOnly use on symbols, to see if they are directly defined as a constant. -
setDeclaredAsConstant
public void setDeclaredAsConstant(boolean declaredAsConstant) -
isMutable
public boolean isMutable()Description copied from interface:ISymbolEven constants can be mutable until set. then they change to being none mutable. Likewise in 'pure' scopes a variable can be mutable until it is first set then none mutable. -
isConstant
public boolean isConstant() -
setNotMutable
public void setNotMutable()- Specified by:
setNotMutablein interfaceISymbol- Overrides:
setNotMutablein classSymbol
-
isPromotionRequired
public boolean isPromotionRequired() -
setPromotionRequired
public void setPromotionRequired(boolean promotionRequired) -
isUseStringOperator
public boolean isUseStringOperator() -
setUseStringOperator
public void setUseStringOperator(boolean useStringOperator) -
setSourceToken
- Specified by:
setSourceTokenin interfaceITokenReference- Overrides:
setSourceTokenin classSymbol
-
equals
-
hashCode
-