Skip to content
Snippets Groups Projects
Select Git revision
  • 8912ea2a7c4ee7f12bf7741ece8b93ef5ede6f62
  • master default protected
  • julia1
  • v0.2.0
  • v0.1.0
5 results

ballandbeam.jl

Blame
  • Forked from processes / LabProcesses.jl
    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");
        }
      }
    }