Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ResolvExpr/CurrentObject.h

    r60aaa51d r2b59f55  
    1616#pragma once
    1717
    18 #include <deque>
    1918#include <list>   // for list
    2019#include <memory> // for unique_ptr
     
    2221#include <vector>
    2322
    24 #include "AST/Node.hpp"  // for ptr
    2523#include "Common/CodeLocation.h"
    2624
     
    6159        // AST class types
    6260        class Designation;
    63         struct InitAlternative;
     61        class InitAlternative;
    6462        class Type;
    6563
    66         /// Iterates members of a type by initializer
    67         class MemberIterator {
    68         public:
    69                 virtual ~MemberIterator() {}
    70 
    71                 /// Internal set position based on iterator ranges
    72                 virtual void setPosition(
    73                         std::deque< ptr< Expr > >::const_iterator it,
    74                         std::deque< ptr< Expr > >::const_iterator end ) = 0;
    75 
    76                 /// walks the current object using the given designators as a guide
    77                 void setPosition( const std::deque< ptr< Expr > > & designators ) {
    78                         setPosition( designators.begin(), designators.end() );
    79                 }
    80 
    81                 /// retrieve the list of possible (Type,Designation) pairs for the current position in the
    82                 /// current object
    83                 virtual std::deque< InitAlternative > operator* () const = 0;
    84 
    85                 /// true if the iterator is not currently at the end
    86                 virtual operator bool() const = 0;
    87 
    88                 /// moves the iterator by one member in the current object
    89                 virtual MemberIterator & bigStep() = 0;
    90 
    91                 /// moves the iterator by one member in the current subobject
    92                 virtual MemberIterator & smallStep() = 0;
    93 
    94                 /// the type of the current object
    95                 virtual const Type * getType() = 0;
    96 
    97                 /// the type of the current subobject
    98                 virtual const Type * getNext() = 0;
    99        
    100                 /// helper for operator*; aggregates must add designator to each init alternative, but
    101                 /// adding designators in operator* creates duplicates
    102                 virtual std::deque< InitAlternative > first() const = 0;
    103         };
     64        // forward declaration of internal detail
     65        class MemberIterator;
    10466
    10567        /// Builds initializer lists in resolution
     
    11173                CurrentObject( const CodeLocation & loc, const Type * type );
    11274
    113                 /// sets current position using the resolved designation
    114                 void setNext( const ast::Designation * designation );
    115                 /// steps to next sub-object of current object
    116                 void increment();
    117                 /// sets new current object for the duration of this brace-enclosed intializer-list
    118                 void enterListInit( const CodeLocation & loc );
    119                 /// restores previous current object
    120                 void exitListInit();
    12175                /// produces a list of alternatives (Type *, Designation *) for the current sub-object's
    12276                /// initializer.
    123                 std::deque< InitAlternative > getOptions();
    124                 /// produces the type of the current object but no subobjects
    125                 const Type * getCurrentType();
     77                std::vector< InitAlternative > getOptions();
    12678        };
    12779} // namespace ast
Note: See TracChangeset for help on using the changeset viewer.