made interfaces sealed

This commit is contained in:
laurenz 2024-05-02 13:37:18 +02:00
parent 9738fee630
commit e14af08678
3 changed files with 31 additions and 3 deletions

View File

@ -1,6 +1,14 @@
package de.maishai.ast;
import de.maishai.ast.records.Assignment;
import de.maishai.ast.records.Binary;
import de.maishai.ast.records.BoolConstant;
import de.maishai.ast.records.CharConstant;
import de.maishai.ast.records.Id;
import de.maishai.ast.records.IntConstant;
import de.maishai.ast.records.MethodCall;
import de.maishai.ast.records.New;
public interface Expression extends Node {
public sealed interface Expression extends Node permits Assignment, Binary, BoolConstant, CharConstant, Id, IntConstant, MethodCall, New {
}

View File

@ -1,4 +1,12 @@
package de.maishai.ast;
public interface Node {
import de.maishai.ast.records.Block;
import de.maishai.ast.records.Class;
import de.maishai.ast.records.MainMethod;
import de.maishai.ast.records.Method;
import de.maishai.ast.records.Parameter;
import de.maishai.ast.records.Program;
import de.maishai.ast.records.Variable;
public sealed interface Node permits Expression, Statement, Block, Class, MainMethod, Method, Parameter, Program, Variable {
}

View File

@ -1,3 +1,15 @@
package de.maishai.ast;
public interface Statement extends Node {
import de.maishai.ast.records.Break;
import de.maishai.ast.records.Continue;
import de.maishai.ast.records.DoWhile;
import de.maishai.ast.records.For;
import de.maishai.ast.records.IfElse;
import de.maishai.ast.records.MethodCall;
import de.maishai.ast.records.New;
import de.maishai.ast.records.Return;
import de.maishai.ast.records.ReturnVoid;
import de.maishai.ast.records.While;
public sealed interface Statement extends Node permits Break, Continue, DoWhile, For, IfElse, MethodCall, New, Return, ReturnVoid, While {
}