Package org.ek9lang.compiler.symbols
Class ExpressionSymbol
java.lang.Object
org.ek9lang.compiler.symbols.Symbol
org.ek9lang.compiler.symbols.ExpressionSymbol
- All Implemented Interfaces:
Serializable
,ISymbol
,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:
-
Nested Class Summary
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
ConstructorDescriptionExpressionSymbol
(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 ExpressionSymbol
boolean
Provide the name an end user would need to see on the screen.int
hashCode()
boolean
boolean
Only use on symbols, to see if they are directly defined as a constant.boolean
Even constants can be mutable until set.boolean
boolean
void
setDeclaredAsConstant
(boolean declaredAsConstant) void
void
setPromotionRequired
(boolean promotionRequired) void
setSourceToken
(IToken sourceToken) void
setUseStringOperator
(boolean useStringOperator) Methods inherited from class org.ek9lang.compiler.symbols.Symbol
clearInitialisedBy, cloneIntoSymbol, copySymbolProperties, getAssignableWeightTo, getAssignableWeightTo, getCategory, getFullyQualifiedName, getGenus, getInitialisedBy, getName, getParsedModule, getProduceFullyQualifiedName, getSourceToken, getSquirrelledData, getSymbolTypeAsString, getType, getUnCoercedAssignableWeightTo, isAssignableTo, isAssignableTo, isDevSource, isEk9Core, isExactSameType, isInjectionExpected, isLibSource, isMarkedPure, isNullAllowed, isPromotionSupported, isReferenced, putSquirrelledData, setCategory, setEk9Core, setGenus, setInitialisedBy, setInjectionExpected, setMarkedPure, setName, setNullAllowed, setParsedModule, setProduceFullyQualifiedName, setReferenced, setType, toString
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.ek9lang.compiler.symbols.ISymbol
isApplication, isConceptualTypeParameter, isControl, isExtensionOfInjectable, isFromLiteral, isFunction, isGenericInNature, isIncomingParameter, isInitialised, isInjectable, isLoopVariable, isMarkedAbstract, isMethod, isParameterisedType, isPrimitiveType, isPrivate, isPropertyField, isProtected, isPublic, isReturningParameter, isTemplateFunction, isTemplateType, isType, isVariable, setType
-
Constructor Details
-
ExpressionSymbol
Create a new expression based around an existing symbol. -
ExpressionSymbol
-
-
Method Details
-
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 -
cloneIntoExpressionSymbol
-
getFriendlyName
Description copied from interface:ISymbol
Provide 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:
getFriendlyName
in interfaceISymbol
- Overrides:
getFriendlyName
in classSymbol
- Returns:
- a user presentable of the symbol name.
-
isDeclaredAsConstant
public boolean isDeclaredAsConstant()Description copied from interface:ISymbol
Only 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:ISymbol
Even 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:
setNotMutable
in interfaceISymbol
- Overrides:
setNotMutable
in classSymbol
-
isPromotionRequired
public boolean isPromotionRequired() -
setPromotionRequired
public void setPromotionRequired(boolean promotionRequired) -
isUseStringOperator
public boolean isUseStringOperator() -
setUseStringOperator
public void setUseStringOperator(boolean useStringOperator) -
setSourceToken
- Specified by:
setSourceToken
in interfaceITokenReference
- Overrides:
setSourceToken
in classSymbol
-
equals
-
hashCode
public int hashCode()
-