Changeset 264e691


Ignore:
Timestamp:
May 15, 2019, 2:59:30 PM (6 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
9e1d485
Parents:
9b81fed3
Message:

Added TypeExpr?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Expr.hpp

    r9b81fed3 r264e691  
    2323#include "Fwd.hpp"        // for UniqueId
    2424#include "ParseNode.hpp"
    25 #include "Type.hpp"       // for ptr<Type>
     25#include "Visitor.hpp"
    2626
    2727namespace ast {
     
    117117        bool extension = false;
    118118
    119         Expr(const CodeLocation& loc ) : ParseNode( loc ), result(), env(), inferred() {}
     119        Expr(const CodeLocation & loc ) : ParseNode( loc ), result(), env(), inferred() {}
    120120
    121121        Expr* set_extension( bool ex ) { extension = ex; return this; }
    122122
    123         virtual Expr* accept( Visitor& v ) override = 0;
     123        virtual Expr * accept( Visitor & v ) override = 0;
    124124private:
    125         virtual Expr* clone() const override = 0;
     125        virtual Expr * clone() const override = 0;
     126};
     127
     128/// A type used as an expression (e.g. a type generator parameter)
     129class TypeExpr final : public Expr {
     130public:
     131        ptr<Type> type;
     132
     133        TypeExpr( const CodeLocation & loc, const Type * t ) : Expr(loc), type(t) {}
     134
     135        Expr* accept( Visitor & v ) override { return v.visit( this ); }
     136private:
     137        TypeExpr * clone() const override { return new TypeExpr{ *this }; }
    126138};
    127139
Note: See TracChangeset for help on using the changeset viewer.