Skip to content
Snippets Groups Projects
Select Git revision
  • 3ca451b198e9651ec00dc12fad8435fa127dfd72
  • master default
  • anders.blomdell
  • typeref
  • pragma
  • compiler-refactoring
  • labcomm2013
  • v2014.1
  • v2014.0
  • v2013.0
10 results

TypeReferences.jrag

Blame
  • Forked from Anders Blomdell / LabComm
    277 commits behind the upstream repository.
    Sven Gestegard Robertz's avatar
    Sven Gestegård Robertz authored
    pruned and grafted the refactored compiler from the metadata branch. Tests run, but code needs cleanup
    59a49855
    History
    TypeReferences.jrag 1.26 KiB
    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();
    }