- All Known Implementing Classes:
Stmt.Block,Stmt.Expression,Stmt.Function,Stmt.If,Stmt.Return,Stmt.Val,Stmt.Var,Stmt.While
@NullMarked
public interface Stmt
Stmt represents a piece of code that performs an action or controls the flow of the program.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordBlock contains a list ofStmts that are executed in their own scope.static final recordExpression statement evaluates an expression.static final recordFunction statement declares a function in the current scope with desired parameters and body.static final recordIf statement is a conditional branching statement.static final recordReturn statement exits a function while optionally returning a value for the caller to use.static final recordVal statement declares a constant in the current scope with an initializer.static final recordVar statement declares a variable in the current scope with an optional initializer.static interfaceDefines operations for the variousStmtimplementations.static final recordWhile statement is a conditional looping statement. -
Method Summary
Modifier and TypeMethodDescription<R> Raccept(Stmt.Visitor<R> visitor) Executes this statement via the desiredStmt.Visitor
-
Method Details
-
accept
Executes this statement via the desiredStmt.Visitor- Type Parameters:
R- the return type- Parameters:
visitor- theStmt.Visitorto execute this statement- Returns:
- the return value from the executed statement
-