Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
Loading items

Target

Select target project
  • anders_blomdell/labcomm
  • klaren/labcomm
  • tommyo/labcomm
  • erikj/labcomm
  • sven/labcomm
5 results
Select Git revision
Loading items
Show changes
Showing
with 1158 additions and 1284 deletions
This diff is collapsed.
aspect TypeCheck {
public void ASTNode.typeCheck() {
// calls to the different type checks to be performed
nullTypeCheck();
}
// void is not allowed as a field in a struct or an array element
syn boolean Type.isNull();
eq Type.isNull() = false;
eq VoidType.isNull() = true;
eq UserType.isNull() = decl().isNull();
syn boolean TypeDecl.isNull();
eq TypeDecl.isNull() = getType().isNull();
public void ASTNode.nullTypeCheck() {}
public void Field.nullTypeCheck() {
if(getType().isNull()) {
error("field " + getName() + " of struct "+ declName()+ " may not be of type void");
}
}
public void ParseArrayType.nullTypeCheck() {
if(getType().isNull()) {
error("elements of array "+declName()+" may not be of type void");
}
}
public void ArrayType.nullTypeCheck() {
if(getType().isNull()) {
error("elements of array "+declName()+" may not be of type void");
}
}
}
aspect User_Types {
syn String Type.getTypeName();
eq Type.getTypeName() = getClass().getName();
eq PrimType.getTypeName() = getName();
eq UserType.getTypeName() = getName();
syn boolean Type.isUserType();
eq Type.isUserType() = false;
eq UserType.isUserType() = true;
}
aspect Type_References {
// The dependencies on other type declarations for a Decl.
coll Set<Decl> Decl.type_dependencies() [new HashSet<Decl>()] with add;
Field contributes ((UserType)getType()).decl()
when parentDecl() != null && getType().isUserType()
to Decl.type_dependencies()
for parentDecl();
UserType contributes decl()
when parentDecl() != null
to Decl.type_dependencies()
for parentDecl();
/*
Field contributes getType().decl()
when parentDecl() != null && getType().isLeafType()
to Decl.type_dependencies()
for parentDecl();
*/
// The references from other type declarations to a Decl.
coll Set<Decl> Decl.type_references() [new HashSet<Decl>()] with add;
Decl contributes this
to Decl.type_references()
for each type_dependencies();
syn boolean Decl.hasDependencies();
eq Decl.hasDependencies() = !type_dependencies().isEmpty();
syn boolean Decl.isReferenced();
eq Decl.isReferenced() = !type_references().isEmpty();
}
aspect Version {
/* An auxilliary class for handling naming and prefixes connected
* to the LabComm version
*/
class LabCommVersion {
public static String versionString(int version) {
return (version == 2006) ? "2006" : "";
}
public static boolean versionHasPragma(int version) {
return version != 2006;
}
}
}
This diff is collapsed.
......@@ -13,29 +13,29 @@ aspect ArrayRewrite {
when (! getDim(0).isVariable())
to FixedArrayType {
if (getNumDim() == 1) {
return new FixedArrayType(getType(),
getDim(0).getExpList());
return new FixedArrayType(getDataType(),
getDim(0));
} else {
List l = new List();
for (int i = 1 ; i < getNumDim() ; i++) {
l.add(getDim(i));
}
return new FixedArrayType(new ParseArrayType(getType(), l),
getDim(0).getExpList());
return new FixedArrayType(new ParseArrayType(getDataType(), l),
getDim(0));
}
}
when (getDim(0).isVariable())
to VariableArrayType {
if (getNumDim() == 1) {
return new VariableArrayType(getType(),
getDim(0).getExpList());
return new VariableArrayType(getDataType(),
getDim(0));
} else {
List l = new List();
for (int i = 1 ; i < getNumDim() ; i++) {
l.add(getDim(i));
}
return new VariableArrayType(new ParseArrayType(getType(), l),
getDim(0).getExpList());
return new VariableArrayType(new ParseArrayType(getDataType(), l),
getDim(0));
}
}
}
......
This diff is collapsed.
This diff is collapsed.
aspect DeclNames {
inh String Type.declName();
eq Decl.getType().declName() = getName();
inh String DataType.declName();
eq Decl.getTypeInstance().declName() = getName();
inh String Field.declName();
eq StructType.getField(int i).declName() = declName();
//TODO: aspect should be renamed to parent-something
inh Decl Type.parentDecl();
inh Decl DataType.parentDecl();
inh Decl Field.parentDecl();
eq Decl.getType().parentDecl() = this;
eq Decl.getTypeInstance().parentDecl() = this;
eq StructType.getField(int i).parentDecl() = parentDecl();
}
......@@ -27,5 +27,4 @@ aspect ErrorCheck {
getChild(i).errorCheck(collection);
}
}
}
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.