Changes in src/SynTree/Type.h [ea6332d:5ccb10d]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Type.h
rea6332d r5ccb10d 16 16 #pragma once 17 17 18 #include <strings.h> // for ffs 19 #include <cassert> // for assert, assertf 20 #include <list> // for list, _List_iterator 21 #include <ostream> // for ostream, operator<<, basic_ostream 22 #include <string> // for string 23 24 #include "BaseSyntaxNode.h" // for BaseSyntaxNode 25 #include "Common/utility.h" // for operator+ 26 #include "Mutator.h" // for Mutator 27 #include "SynTree.h" // for AST nodes 28 #include "Visitor.h" // for Visitor 18 #include "BaseSyntaxNode.h" 19 #include "Mutator.h" 20 #include "SynTree.h" 21 #include "Visitor.h" 22 #include <strings.h> // ffs 29 23 30 24 class Type : public BaseSyntaxNode { … … 168 162 169 163 /// return type without outer pointers and arrays 170 Type *stripDeclarator(); 164 Type * stripDeclarator(); 165 166 /// return type without outer references 167 Type * stripReferences(); 168 169 /// return the number of references occuring consecutively on the outermost layer of this type (i.e. do not count references nested within other types) 170 virtual int referenceDepth() const; 171 171 172 172 virtual bool isComplete() const { return true; } … … 262 262 bool is_array() const { return isStatic || isVarLen || dimension; } 263 263 264 virtual bool isComplete() const { return ! isVarLen; } 265 264 266 virtual PointerType *clone() const { return new PointerType( *this ); } 265 267 virtual void accept( Visitor & v ) { v.visit( this ); } … … 296 298 }; 297 299 300 class ReferenceType : public Type { 301 public: 302 Type *base; 303 304 ReferenceType( const Type::Qualifiers & tq, Type *base, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); 305 ReferenceType( const ReferenceType & ); 306 virtual ~ReferenceType(); 307 308 Type *get_base() { return base; } 309 void set_base( Type *newValue ) { base = newValue; } 310 311 virtual int referenceDepth() const; 312 313 // Since reference types act like value types, their size is the size of the base. 314 // This makes it simple to cast the empty tuple to a reference type, since casts that increase 315 // the number of values are disallowed. 316 virtual unsigned size() const { return base->size(); } 317 318 virtual ReferenceType *clone() const { return new ReferenceType( *this ); } 319 virtual void accept( Visitor & v ) { v.visit( this ); } 320 virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); } 321 virtual void print( std::ostream & os, int indent = 0 ) const; 322 }; 323 298 324 class FunctionType : public Type { 299 325 public:
Note: See TracChangeset
for help on using the changeset viewer.