Skip to content
Snippets Groups Projects
Select Git revision
  • e5533fce3774f5209b201cfa7a2464f7451e1135
  • master default
  • labcomm2006
  • typedefs
  • anders.blomdell
  • typeref
  • pragma
  • compiler-refactoring
  • labcomm2013
  • v2014.4
  • v2006.0
  • v2014.3
  • v2014.2
  • v2014.1
  • v2014.0
  • v2013.0
16 results

Signature.jrag

Blame
  • Forked from Anders Blomdell / LabComm
    Source project has a limited visibility.
    TypeCheck.jrag 953 B
    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");
        }
      }
    }