Skip to content
Snippets Groups Projects
Commit a0dfc2fa authored by Sven Gestegård Robertz's avatar Sven Gestegård Robertz
Browse files

added names to error messages

parent 121b7a79
No related branches found
No related tags found
No related merge requests found
aspect DeclNames {
inh String Type.declName();
eq Decl.getType().declName() = getName();
inh String Field.declName();
eq StructType.getField(int i).declName() = declName();
}
...@@ -249,6 +249,10 @@ public class LabComm { ...@@ -249,6 +249,10 @@ public class LabComm {
if (prettyOnStdout) { if (prettyOnStdout) {
ast.pp(System.out); ast.pp(System.out);
} }
} else {
// Catch-all for compilation errors
System.err.println("Error in specification");
System.exit(3);
} }
} }
} }
......
...@@ -18,19 +18,19 @@ aspect TypeCheck { ...@@ -18,19 +18,19 @@ aspect TypeCheck {
public void Field.nullTypeCheck() { public void Field.nullTypeCheck() {
if(getType().isNull()) { if(getType().isNull()) {
error("field " + getName() + " may not be of type void"); error("field " + getName() + " of struct "+ declName()+ " may not be of type void");
} }
} }
public void ParseArrayType.nullTypeCheck() { public void ParseArrayType.nullTypeCheck() {
if(getType().isNull()) { if(getType().isNull()) {
error("array elements may not be of type void"); error("elements of array "+declName()+" may not be of type void");
} }
} }
public void ArrayType.nullTypeCheck() { public void ArrayType.nullTypeCheck() {
if(getType().isNull()) { if(getType().isNull()) {
error("array elements may not be of type void"); error("elements of array "+declName()+" may not be of type void");
} }
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment