Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Lvalue.cc

    r0d70e0d r0b73f0c  
    2121#include "Lvalue.h"
    2222
     23#include "InitTweak/InitTweak.h"
    2324#include "Parser/LinkageSpec.h"          // for Spec, isBuiltin, Intrinsic
    2425#include "ResolvExpr/TypeEnvironment.h"  // for AssertionSet, OpenVarSet
    2526#include "ResolvExpr/Unify.h"            // for unify
    2627#include "ResolvExpr/typeops.h"
    27 #include "SymTab/Autogen.h"
    2828#include "SymTab/Indexer.h"              // for Indexer
    2929#include "SynTree/Declaration.h"         // for Declaration, FunctionDecl
     
    3333#include "SynTree/Type.h"                // for PointerType, Type, FunctionType
    3434#include "SynTree/Visitor.h"             // for Visitor, acceptAll
     35#include "Validate/FindSpecialDecls.h"   // for dereferenceOperator
    3536
    3637#if 0
     
    4445                // TODO: fold this into the general createDeref function??
    4546                Expression * mkDeref( Expression * arg ) {
    46                         if ( SymTab::dereferenceOperator ) {
     47                        if ( Validate::dereferenceOperator ) {
    4748                                // note: reference depth can be arbitrarily deep here, so peel off the outermost pointer/reference, not just pointer because they are effecitvely equivalent in this pass
    48                                 VariableExpr * deref = new VariableExpr( SymTab::dereferenceOperator );
     49                                VariableExpr * deref = new VariableExpr( Validate::dereferenceOperator );
    4950                                deref->result = new PointerType( Type::Qualifiers(), deref->result );
    5051                                Type * base = InitTweak::getPointerBase( arg->result );
     
    195196                                unsigned int i = 0;
    196197                                const unsigned int end = ftype->parameters.size();
     198
     199                                /// The for loop may eagerly dereference the iterators and fail on empty lists
     200                                if(i == end) { return appExpr; }
    197201                                for ( auto p : unsafe_group_iterate( appExpr->args, ftype->parameters ) ) {
    198202                                        if (i == end) break;
     
    353357                        Type * destType = castExpr->result;
    354358                        Type * srcType = castExpr->arg->result;
     359                        assertf( destType, "Cast to no type in: %s", toCString( castExpr ) );
     360                        assertf( srcType, "Cast from no type in: %s", toCString( castExpr ) );
    355361                        int depth1 = destType->referenceDepth();
    356362                        int depth2 = srcType->referenceDepth();
Note: See TracChangeset for help on using the changeset viewer.