Changeset be9036d for src/SynTree/Type.h


Ignore:
Timestamp:
Aug 31, 2017, 3:29:38 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
326338ae
Parents:
5b21138
git-author:
Rob Schluntz <rschlunt@…> (08/31/17 15:29:33)
git-committer:
Rob Schluntz <rschlunt@…> (08/31/17 15:29:38)
Message:

Reorganize TraitInstType? and TraitDecl?, add sized trait definition to prelude

Previously, TraitInstType? cloned all of the members of TraitDecl?. This commit changes
TraitInstType? to instead contain a pointer to the base TraitDecl?, analogous to StructInstType?
and StructDecl?, etc. In particular, this makes the code simpler and makes it easier to
fully expand the members of a trait declaration.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Type.h

    r5b21138 rbe9036d  
    471471        typedef ReferenceToType Parent;
    472472  public:
    473         // this member is filled in by the validate pass, which instantiates the members of the correponding
    474         // aggregate with the actual type parameters specified for this use of the context
    475         std::list< Declaration* > members;
    476 
    477         TraitInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >()  ) : Parent( tq, name, attributes ) {}
     473        // this decl is not "owned" by the trait inst; it is merely a pointer to elsewhere in the tree,
     474        // where the trait used in this type is actually defined
     475        TraitDecl * baseTrait = nullptr;
     476
     477        TraitInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >() ) : Parent( tq, name, attributes ) {}
     478        TraitInstType( const Type::Qualifiers & tq, TraitDecl * baseTrait, const std::list< Attribute * > & attributes = std::list< Attribute * >() );
    478479        TraitInstType( const TraitInstType & other );
    479480        ~TraitInstType();
    480 
    481         std::list< Declaration* >& get_members() { return members; }
    482481
    483482        virtual bool isComplete() const;
Note: See TracChangeset for help on using the changeset viewer.