Changeset 264e691


Ignore:
Timestamp:
May 15, 2019, 2:59:30 PM (2 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
arm-eh, cleanup-dtors, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr
Children:
9e1d485
Parents:
9b81fed
Message:

Added TypeExpr?

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Expr.hpp

    r9b81fed 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.