Class OperationDeclarationChecks
java.lang.Object
org.ek9lang.compiler.common.OperationDeclarationChecks
- All Implemented Interfaces:
BiConsumer<MethodSymbol, org.antlr.v4.runtime.ParserRuleContext>
public final class OperationDeclarationChecks
extends Object
implements BiConsumer<MethodSymbol, org.antlr.v4.runtime.ParserRuleContext>
THE checks every method and operator declaration gets - call this, never the rules one by one
(front-end rationalisation F12/D5, Steve 2026-10-03). Methods and operators once ran the same rules through two
copies in two orders; both now run them here, in this order - a method in phase 1 (
ValidMethodOrError), an
operator in phase 2 straight after its semantic checks (ValidOperatorOrError, which says why):
- in a trait, a constructor is an error and a member without a body is marked abstract
(
ProcessTraitMethodOrError); anywhere else, a member without a body must be abstract (TraitMethodAcceptableOrError); - an abstract member has no body (
AppropriateBodyOrError); - a member is not both 'override' and 'abstract' (
OverrideOrAbstractOrError); - only a construct that can be extended declares an abstract member
(
ContextSupportsAbstractMethodOrError).
The order is observable: only the first error on a token is kept, the first three report on the member's own token and the last on the declaration's first token, which is the same token for a method with no modifier.
-
Constructor Summary
ConstructorsConstructorDescriptionOperationDeclarationChecks(SymbolsAndScopes symbolsAndScopes, ErrorListener errorListener) Create the checks for one listener's symbols and error listener. -
Method Summary
Modifier and TypeMethodDescriptionvoidaccept(MethodSymbol operation, org.antlr.v4.runtime.ParserRuleContext declaration) Check a method or operator declaration.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface BiConsumer
andThen
-
Constructor Details
-
OperationDeclarationChecks
Create the checks for one listener's symbols and error listener.
-
-
Method Details
-
accept
Check a method or operator declaration.- Specified by:
acceptin interfaceBiConsumer<MethodSymbol, org.antlr.v4.runtime.ParserRuleContext>- Parameters:
operation- the method or operator symboldeclaration- its methodDeclaration or operatorDeclaration
-