Class StatementCounter
java.lang.Object
org.ek9lang.compiler.phase5.StatementCounter
Tracks statement counts within functions/methods/operators.
Increments on each executable statement encountered during AST traversal.
This is used to enforce NCSS (Non-Commenting Source Statement) limits,
preventing overly long functions that become hard to read and maintain.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) voidIncrement the statement count for the current scope.(package private) booleanCheck if there are any scopes on the stack.(package private) intpopScope()Pop scope and return statement count.(package private) voidPush new scope when entering function/method/operator.
-
Constructor Details
-
StatementCounter
StatementCounter()
-
-
Method Details
-
pushScope
void pushScope()Push new scope when entering function/method/operator. Initializes statement count to zero. -
popScope
int popScope()Pop scope and return statement count. Called when exiting function/method/operator.- Returns:
- the total statement count in this scope
-
incrementCount
void incrementCount()Increment the statement count for the current scope. Called when encountering an executable statement. -
isNotEmpty
boolean isNotEmpty()Check if there are any scopes on the stack.- Returns:
- true if stack has contents
-