Changeset 5ccb10d for src/SynTree


Ignore:
Timestamp:
Aug 22, 2017, 6:41:28 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
0b5d871
Parents:
d104b02
Message:

Set reference size to base size, clean up debug code, remove more old-style NULLs from prelude

Location:
src/SynTree
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Expression.cc

    rd104b02 r5ccb10d  
    611611CompoundLiteralExpr::CompoundLiteralExpr( Type * type, Initializer * initializer ) : initializer( initializer ) {
    612612        assert( type && initializer );
     613        type->set_lvalue( true );
    613614        set_result( type );
    614615}
  • src/SynTree/TupleExpr.cc

    rd104b02 r5ccb10d  
    6060        assertf( type->size() > index, "TupleIndexExpr index out of bounds: tuple size %d, requested index %d in expr %s", type->size(), index, toString( tuple ).c_str() );
    6161        set_result( (*std::next( type->get_types().begin(), index ))->clone() );
    62         get_result()->set_lvalue( type->get_lvalue() );
     62        // like MemberExpr, TupleIndexExpr is always an lvalue
     63        get_result()->set_lvalue( true );
    6364}
    6465
  • src/SynTree/Type.h

    rd104b02 r5ccb10d  
    311311        virtual int referenceDepth() const;
    312312
     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
    313318        virtual ReferenceType *clone() const { return new ReferenceType( *this ); }
    314319        virtual void accept( Visitor & v ) { v.visit( this ); }
Note: See TracChangeset for help on using the changeset viewer.