Skip to content
Snippets Groups Projects
Select Git revision
  • 1f17be8ad62dddb1938aa2510c25cdd1a0be00b6
  • 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

TypeReferences.jrag

Blame
  • Forked from Anders Blomdell / LabComm
    113 commits behind the upstream repository.
    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();
    }