Changes in src/SynTree/Type.h [5ccb10d:ea6332d]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Type.h
r5ccb10d rea6332d 16 16 #pragma once 17 17 18 #include "BaseSyntaxNode.h" 19 #include "Mutator.h" 20 #include "SynTree.h" 21 #include "Visitor.h" 22 #include <strings.h> // ffs 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 23 29 24 30 class Type : public BaseSyntaxNode { … … 162 168 163 169 /// return type without outer pointers and arrays 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; 170 Type *stripDeclarator(); 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 266 264 virtual PointerType *clone() const { return new PointerType( *this ); } 267 265 virtual void accept( Visitor & v ) { v.visit( this ); } … … 298 296 }; 299 297 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 increase315 // 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 324 298 class FunctionType : public Type { 325 299 public:
Note: See TracChangeset
for help on using the changeset viewer.