Changeset 6e50a6b for src/SynTree
- Timestamp:
- Jun 18, 2021, 12:20:59 PM (4 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- c7d8696a
- Parents:
- dcbfcbc
- Location:
- src/SynTree
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Declaration.h
rdcbfcbc r6e50a6b 201 201 typedef NamedTypeDecl Parent; 202 202 public: 203 enum Kind { Dtype, DStype, Otype, Ftype, Ttype, ALtype, NUMBER_OF_KINDS };203 enum Kind { Dtype, DStype, Otype, Ftype, Ttype, Dimension, NUMBER_OF_KINDS }; 204 204 205 205 Kind kind; -
src/SynTree/Expression.h
rdcbfcbc r6e50a6b 587 587 }; 588 588 589 /// DimensionExpr represents a type-system provided value used in an expression ( forrall([N]) ... N + 1 ) 590 class DimensionExpr : public Expression { 591 public: 592 std::string name; 593 594 DimensionExpr( std::string name ); 595 DimensionExpr( const DimensionExpr & other ); 596 virtual ~DimensionExpr(); 597 598 const std::string & get_name() const { return name; } 599 void set_name( std::string newValue ) { name = newValue; } 600 601 virtual DimensionExpr * clone() const override { return new DimensionExpr( * this ); } 602 virtual void accept( Visitor & v ) override { v.visit( this ); } 603 virtual void accept( Visitor & v ) const override { v.visit( this ); } 604 virtual Expression * acceptMutator( Mutator & m ) override { return m.mutate( this ); } 605 virtual void print( std::ostream & os, Indenter indent = {} ) const override; 606 }; 607 589 608 /// AsmExpr represents a GCC 'asm constraint operand' used in an asm statement: [output] "=f" (result) 590 609 class AsmExpr : public Expression { -
src/SynTree/Mutator.h
rdcbfcbc r6e50a6b 80 80 virtual Expression * mutate( CommaExpr * commaExpr ) = 0; 81 81 virtual Expression * mutate( TypeExpr * typeExpr ) = 0; 82 virtual Expression * mutate( DimensionExpr * dimensionExpr ) = 0; 82 83 virtual Expression * mutate( AsmExpr * asmExpr ) = 0; 83 84 virtual Expression * mutate( ImplicitCopyCtorExpr * impCpCtorExpr ) = 0; -
src/SynTree/SynTree.h
rdcbfcbc r6e50a6b 85 85 class CommaExpr; 86 86 class TypeExpr; 87 class DimensionExpr; 87 88 class AsmExpr; 88 89 class ImplicitCopyCtorExpr; -
src/SynTree/TypeDecl.cc
rdcbfcbc r6e50a6b 33 33 34 34 const char * TypeDecl::typeString() const { 35 static const char * kindNames[] = { "sized data type", "sized data type", "sized object type", "sized function type", "sized tuple type", "sized array length type" };35 static const char * kindNames[] = { "sized data type", "sized data type", "sized object type", "sized function type", "sized tuple type", "sized length value" }; 36 36 static_assert( sizeof(kindNames) / sizeof(kindNames[0]) == TypeDecl::NUMBER_OF_KINDS, "typeString: kindNames is out of sync." ); 37 37 assertf( kind < TypeDecl::NUMBER_OF_KINDS, "TypeDecl kind is out of bounds." ); -
src/SynTree/TypeExpr.cc
rdcbfcbc r6e50a6b 35 35 } 36 36 37 DimensionExpr::DimensionExpr( std::string name ) : Expression(), name(name) { 38 assertf(name != "0", "Zero is not a valid name"); 39 assertf(name != "1", "One is not a valid name"); 40 } 41 42 DimensionExpr::DimensionExpr( const DimensionExpr & other ) : Expression( other ), name( other.name ) { 43 } 44 45 DimensionExpr::~DimensionExpr() {} 46 47 void DimensionExpr::print( std::ostream & os, Indenter indent ) const { 48 os << "Type-Sys Value: " << get_name(); 49 Expression::print( os, indent ); 50 } 37 51 // Local Variables: // 38 52 // tab-width: 4 // -
src/SynTree/Visitor.h
rdcbfcbc r6e50a6b 135 135 virtual void visit( TypeExpr * node ) { visit( const_cast<const TypeExpr *>(node) ); } 136 136 virtual void visit( const TypeExpr * typeExpr ) = 0; 137 virtual void visit( DimensionExpr * node ) { visit( const_cast<const DimensionExpr *>(node) ); } 138 virtual void visit( const DimensionExpr * typeExpr ) = 0; 137 139 virtual void visit( AsmExpr * node ) { visit( const_cast<const AsmExpr *>(node) ); } 138 140 virtual void visit( const AsmExpr * asmExpr ) = 0;
Note:
See TracChangeset
for help on using the changeset viewer.