Changeset 2d80111


Ignore:
Timestamp:
Aug 8, 2019, 11:29:53 AM (5 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
0f19f5e5
Parents:
4615ac8
Message:

Lvalue is checked through Expression::get_lvalue. Only three other places use Type::get_lvalue directly now: CodeGen/GenType?, ResolvExpr/ConversionCost? & SynTree/TopLvalue?.

Location:
src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Box.cc

    r4615ac8 r2d80111  
    725725                        if ( ! needsBoxing( param, arg->result, exprTyVars, env ) ) return;
    726726
    727                         if ( arg->result->get_lvalue() ) {
     727                        if ( arg->get_lvalue() ) {
    728728                                // argument expression may be CFA lvalue, but not C lvalue -- apply generalizedLvalue transformations.
    729729                                // if ( VariableExpr * varExpr = dynamic_cast< VariableExpr * >( arg ) ) {
  • src/GenPoly/Lvalue.cc

    r4615ac8 r2d80111  
    363363                        int diff = depth1 - depth2;
    364364
    365                         if ( diff > 0 && ! srcType->get_lvalue() ) {
     365                        if ( diff > 0 && ! castExpr->arg->get_lvalue() ) {
    366366                                // rvalue to reference conversion -- introduce temporary
    367367                                // know that reference depth of cast argument is 0, need to introduce n temporaries for reference depth of n, e.g.
     
    407407                                        ret = new AddressExpr( ret );
    408408                                }
    409                                 if ( srcType->get_lvalue() && ! ResolvExpr::typesCompatible( srcType, strict_dynamic_cast<ReferenceType *>( destType )->base, SymTab::Indexer() ) ) {
     409                                if ( castExpr->arg->get_lvalue() && ! ResolvExpr::typesCompatible( srcType, strict_dynamic_cast<ReferenceType *>( destType )->base, SymTab::Indexer() ) ) {
    410410                                        // must keep cast if cast-to type is different from the actual type
    411411                                        castExpr->arg = ret;
  • src/ResolvExpr/AlternativeFinder.cc

    r4615ac8 r2d80111  
    11351135        bool isLvalue( Expression *expr ) {
    11361136                // xxx - recurse into tuples?
    1137                 return expr->result && ( expr->result->get_lvalue() || dynamic_cast< ReferenceType * >( expr->result ) );
     1137                return expr->result && ( expr->get_lvalue() || dynamic_cast< ReferenceType * >( expr->result ) );
    11381138        }
    11391139
  • src/SynTree/AddressExpr.cc

    r4615ac8 r2d80111  
    4242AddressExpr::AddressExpr( Expression *arg ) : Expression(), arg( arg ) {
    4343        if ( arg->result ) {
    44                 if ( arg->result->get_lvalue() ) {
     44                if ( arg->get_lvalue() ) {
    4545                        // lvalue, retains all layers of reference and gains a pointer inside the references
    4646                        set_result( addrType( arg->result ) );
  • src/SynTree/Expression.cc

    r4615ac8 r2d80111  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jul 25 22:21:48 2019
    13 // Update Count     : 61
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Aug  7 17:03:00 2019
     13// Update Count     : 62
    1414//
    1515
     
    6161        delete env;
    6262        delete result;
     63}
     64
     65bool Expression::get_lvalue() const {
     66        return result->get_lvalue();
    6367}
    6468
  • src/SynTree/Expression.h

    r4615ac8 r2d80111  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jul 25 22:21:44 2019
    13 // Update Count     : 50
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Aug  7 16:56:00 2019
     13// Update Count     : 51
    1414//
    1515
     
    7171        const Type * get_result() const { return result; }
    7272        void set_result( Type * newValue ) { result = newValue; }
     73        bool get_lvalue() const;
    7374
    7475        TypeSubstitution * get_env() const { return env; }
Note: See TracChangeset for help on using the changeset viewer.