mirror of
https://github.com/JonathanFleischmann/CompilerULTIMATE.git
synced 2024-12-27 10:18:04 +00:00
throw exception when exception map is not empty
This commit is contained in:
parent
a259aa3a51
commit
af757561bb
@ -70,7 +70,7 @@ public class Compiler {
|
||||
return generateAST(sources);
|
||||
}
|
||||
|
||||
public static TypedProgram generateTypedASTFromAst(Program ast) {
|
||||
public static TypedProgram generateTypedASTFromAst(Program ast) throws IllegalArgumentException {
|
||||
return new TypedProgram(ast);
|
||||
}
|
||||
|
||||
@ -80,7 +80,8 @@ public class Compiler {
|
||||
|
||||
public static List<byte[]> generateByteCodeArrayFromFiles(List<String> sourcePaths) {
|
||||
Program program = generateASTFromFiles(sourcePaths);
|
||||
TypedProgram typedAST = generateTypedASTFromAst(program);
|
||||
TypedProgram typedAST;
|
||||
typedAST = generateTypedASTFromAst(program);
|
||||
List<byte[]> byteCode = new ArrayList<>();
|
||||
if (TypedProgram.EXCEPTIONS.isEmpty()) {
|
||||
for (TypedClass c : typedAST.getTypedClasses()) {
|
||||
|
@ -17,11 +17,11 @@ public class TypedProgram {
|
||||
public static Map<String, Exception> EXCEPTIONS = new HashMap<>();
|
||||
private TypedClass currentClass;
|
||||
|
||||
public TypedProgram(Program program) {
|
||||
public TypedProgram(Program program) throws IllegalArgumentException {
|
||||
startConversion(program);
|
||||
}
|
||||
|
||||
public void startConversion(Program program) {
|
||||
public void startConversion(Program program) throws IllegalArgumentException {
|
||||
|
||||
// Initialisiere die Klassen nur mit den Klassennamen und deren Typ
|
||||
for (var clas : program.classes()) {
|
||||
@ -61,7 +61,7 @@ public class TypedProgram {
|
||||
);
|
||||
counter++;
|
||||
}
|
||||
throw new RuntimeException(stringBuilder.toString());
|
||||
throw new IllegalArgumentException(stringBuilder.toString());
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user