Package org.ek9lang.compiler.common
Class TypedSymbolAccess
java.lang.Object
org.ek9lang.compiler.common.RuleSupport
org.ek9lang.compiler.common.TypedSymbolAccess
- Direct Known Subclasses:
AccessLeftAndRightOrError
,AccessToSymbolOrError
,AllTextBodiesPresentOrError
,AssignmentExpressionOrError
,AssignmentOrError
,AssignmentStatementOrError
,AssignmentStatementOrError
,AugmentAggregateWithTraitMethods
,AutoMatchSuperFunctionSignature
,CallOrError
,CaseExpressionOrError
,CheckConflictingMethods
,ControlIsBooleanOrError
,DefaultOperatorsOrError
,DictUseOrError
,DynamicCaptureOrError
,DynamicFunctionBodyPresentOrError
,DynamicFunctionOrError
,EnumeratedTypeOrError
,ExceptionTypeOrError
,ExpressionOrError
,ForLoopOrError
,ForRangeOrError
,ForStatementExpressionOrError
,FunctionDelegateOrError
,FunctionOrError
,FunctionOverridesOrError
,GetGuardVariable
,GetIteratorType
,GuardExpressionOrError
,HeadTailSkipOrError
,IdentifierAsPropertyOrError
,IdentifierAssignmentOrError
,IdentifierOrError
,IdentifierReferenceOrError
,IdentifierReferenceOrError
,IfStatementOrError
,IfStatementOrError
,InstructionBlockVariablesOrError
,LhsAndRhsAssignmentOrError
,ListUseOrError
,MethodOrError
,MethodOverridesOrError
,MethodSymbolSearchForExpression
,NoDelegateMethodClashesOrError
,NoDuplicatedPropertyNamesOrError
,NotAbstractOrError
,NoTraitByVariablesOrError
,ObjectAccessExpressionOrError
,ObjectAccessStartOrError
,OperationCallOrError
,OperatorOrError
,OperatorTest
,ParameterTypesExactMatchOrError
,PipelinePartOrError
,PossibleExpressionConstruct
,PreFlowStatementOrError
,PrimaryOrError
,ProcessDynamicFunctionEntry
,ProcessGuardExpression
,ProcessWhileControlVariable
,PropertyFieldOrError
,PureModifierOrError
,PureProcessingInPureContextOrError
,RangeOrError
,RequiredOperatorPresentOrError
,ResolveByTraitVariables
,ResolveFunctionOrDelegateByNameOrError
,ResolveFunctionOrError
,ResolveIdentifierReferenceCallOrError
,ResolveMethodOrError
,ReturningVariableOrError
,ServiceOperationOrError
,ServiceRegistrationOrError
,SetTypeFromReturningParam
,StatementOrError
,StreamAssemblyOrError
,StreamCatOrError
,StreamExpressionOrError
,StreamExpressionTerminationOrError
,StreamForOrError
,StreamFunctionArgumentsOrError
,StreamFunctionOrError
,StreamStatementOrError
,StreamStatementTerminationOrError
,SwitchStatementExpressionOrError
,SymbolFromContextOrError
,SymbolReferencedOrError
,ThisOrSuperCallOrError
,ThisOrSuperOrError
,ThrowStatementOrError
,TryStatementExpressionOrError
,TypeConstraintOrError
,TypeCovarianceOrError
,TypesCompatibleOrError
,ValidFunctionAbstractnessOrError
,VariableAssignmentOrError
,VariableOnlyOrError
,VariableOnlyOrError
,WhileStatementExpressionOrError
Designed to be used in phase3 only on or after - FULL_RESOLUTION.
Because at this stage whenever a symbol is accessed via 'getRecordedSymbol'
in @link org.ek9lang.compiler.common.SymbolsAndScopes' it must be typed
or an error issued. Clearly the symbol could still be null at this stage (if there were
errors in expressions).
But if the symbol provided is not null then it must by now have a type.
So if not typed, then we need to emit an error. This means other code can just focus on
symbol != null && symbol.getType.isPresent() then it can continue with its processing.
-
Field Summary
Fields inherited from class org.ek9lang.compiler.common.RuleSupport
errorListener, symbolsAndScopes
-
Constructor Summary
ModifierConstructorDescriptionprotected
TypedSymbolAccess
(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener) Constructor to provided typed access. -
Method Summary
Modifier and TypeMethodDescriptiongetRecordedAndTypedSymbol
(org.antlr.v4.runtime.tree.ParseTree node) Gets any symbol associated with this node.protected boolean
Uses the SymbolsAndScopes to get the main processing scope a method or a function.void
recordATypedSymbol
(ISymbol symbol, org.antlr.v4.runtime.tree.ParseTree node) Records a symbol against a node and also emits an error if its type has not been set.
-
Constructor Details
-
TypedSymbolAccess
Constructor to provided typed access.
-
-
Method Details
-
isProcessingScopePure
protected boolean isProcessingScopePure()Uses the SymbolsAndScopes to get the main processing scope a method or a function. Then checks it that is marked as pure or not.- Returns:
- true if pure, false if mutable.
-
recordATypedSymbol
Records a symbol against a node and also emits an error if its type has not been set. -
getRecordedAndTypedSymbol
Gets any symbol associated with this node. If the symbol is not null then its type is checked. If there is no type then an error is emitted.
-