Commit 0ebaa10d authored by Sven Gestegård Robertz's avatar Sven Gestegård Robertz
Browse files

cherry-pick e9544f311 + 13a015906

parent aacd6318
......@@ -393,10 +393,7 @@ aspect Java_Class {
}
env.println("import se.lth.control.labcomm"+env.verStr+".SampleType;");
if (getType().Java_needInstance()) {
env.println("import java.io.IOException;");
env.println("import se.lth.control.labcomm"+env.verStr+".Decoder;");
}
if (getType().Java_needInstance() || hasDependencies()) {
env.println("import se.lth.control.labcomm"+env.verStr+".Encoder;");
env.println("import se.lth.control.labcomm"+env.verStr+".SampleDispatcher;");
......
......@@ -114,110 +114,4 @@ aspect Signature {
flatSignature(result);
return result;
}
public void ASTNode.flatSignature(SignatureList list) {
throw new Error(this.getClass().getName() +
".flatSignature(SignatureList list)" +
" not declared");
}
public void TypeDecl.flatSignature(SignatureList list) {
getType().flatSignature(list);
}
public void SampleDecl.flatSignature(SignatureList list) {
getType().flatSignature(list);
}
public void VoidType.flatSignature(SignatureList list) {
list.addInt(LABCOMM_STRUCT, "void");
list.addInt(0, null);
}
public void PrimType.flatSignature(SignatureList list) {
list.addInt(getToken(), null);
}
public void UserType.flatSignature(SignatureList list) {
lookupType(getName()).flatSignature(list);
}
public void ArrayType.flatSignature(SignatureList list) {
list.addInt(LABCOMM_ARRAY, signatureComment());
list.indent();
list.addInt(getNumExp(), null);
for (int i = 0 ; i < getNumExp() ; i++) {
getExp(i).flatSignature(list);
}
getType().flatSignature(list);
list.unindent();
list.add(null, "}");
}
public void StructType.flatSignature(SignatureList list) {
list.addInt(LABCOMM_STRUCT, "struct { " + getNumField() + " fields");
list.indent();
list.addInt(getNumField(), null);
for (int i = 0 ; i < getNumField() ; i++) {
getField(i).flatSignature(list);
}
list.unindent();
list.add(null, "}");
}
public void Field.flatSignature(SignatureList list) {
list.addString(getName(), signatureComment());
getType().flatSignature(list);
}
public void IntegerLiteral.flatSignature(SignatureList list) {
list.addInt(Integer.parseInt(getValue()), null);
}
public void VariableSize.flatSignature(SignatureList list) {
list.addInt(0, null);
}
public String ArrayType.signatureComment() {
StringBuffer result = new StringBuffer("array [");
for (int i = 0 ; i < getNumExp() ; i++) {
if (i > 0) {
result.append(", ");
}
result.append(getExp(i).signatureComment());
}
result.append("]");
return result.toString();
}
public String ASTNode.signatureComment() {
throw new Error(this.getClass().getName() +
".signatureComment()" +
" not declared");
}
public String Field.signatureComment() {
return getType().signatureComment() + " '" + getName() +"'";
}
public String PrimType.signatureComment() {
return getName();
}
public String UserType.signatureComment() {
return getName();
}
public String StructType.signatureComment() {
return "struct";
}
public String IntegerLiteral.signatureComment() {
return getValue();
}
public String VariableSize.signatureComment() {
return "_";
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment