Class ParameterizedOperationDetailContextOrError
java.lang.Object
org.ek9lang.compiler.phase7.support.ParameterizedOperationDetailContextOrError
- All Implemented Interfaces:
BiFunction<MethodSymbol, EK9Parser.AggregatePartsContext, EK9Parser.OperationDetailsContext>
public class ParameterizedOperationDetailContextOrError
extends Object
implements BiFunction<MethodSymbol, EK9Parser.AggregatePartsContext, EK9Parser.OperationDetailsContext>
Locates the Operation details context for a parameterized method by matching sourceToken identity.
Unlike OperationDetailContextOrError which matches by symbol identity,
this class matches by sourceToken identity. This is necessary because when TypeSubstitution
clones methods from the generic type to the parameterized type, the sourceToken is preserved
(same object reference). See Symbol.java:157 - setSourceToken(this.getSourceToken()).
This enables matching parameterized methods (which are clones with substituted types) back to their original AST context in the generic type's ParsedModule.
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionParameterizedOperationDetailContextOrError(ParsedModule genericParsedModule) Create a matcher that uses the generic type's ParsedModule for AST context lookups. -
Method Summary
Modifier and TypeMethodDescriptionapply(MethodSymbol parameterizedMethod, EK9Parser.AggregatePartsContext ctx) booleanhasOperationDetails(MethodSymbol parameterizedMethod, EK9Parser.AggregatePartsContext ctx) Check if a method has operation details (a body) in the parse context.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BiFunction
andThen
-
Constructor Details
-
ParameterizedOperationDetailContextOrError
Create a matcher that uses the generic type's ParsedModule for AST context lookups.- Parameters:
genericParsedModule- The ParsedModule of the generic type (has the ANTLR AST)
-
-
Method Details
-
apply
public EK9Parser.OperationDetailsContext apply(MethodSymbol parameterizedMethod, EK9Parser.AggregatePartsContext ctx) - Specified by:
applyin interfaceBiFunction<MethodSymbol, EK9Parser.AggregatePartsContext, EK9Parser.OperationDetailsContext>
-
hasOperationDetails
public boolean hasOperationDetails(MethodSymbol parameterizedMethod, EK9Parser.AggregatePartsContext ctx) Check if a method has operation details (a body) in the parse context. Methods declared with 'default' keyword or synthetic methods have no body.- Parameters:
parameterizedMethod- The parameterized method to checkctx- The aggregate parts context from the generic type- Returns:
- true if the method has a body (operationDetails), false otherwise
-