Changeset 14388c1


Ignore:
Timestamp:
Aug 13, 2019, 2:03:37 PM (2 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
arm-eh, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr
Children:
1118b8b
Parents:
7d01cf44
Message:

Most expressions now return a hard-coded lvalue flag.

Location:
src/SynTree
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/ApplicationExpr.cc

    r7d01cf44 r14388c1  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Tue Apr 26 12:41:06 2016
    13 // Update Count     : 4
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Mon Aug 12 14:28:00 2019
     13// Update Count     : 5
    1414//
    1515
     
    7676}
    7777
     78bool ApplicationExpr::get_lvalue() const {
     79        return result->get_lvalue();
     80}
     81
    7882void ApplicationExpr::print( std::ostream &os, Indenter indent ) const {
    7983        os << "Application of" << std::endl << indent+1;
  • src/SynTree/CommaExpr.cc

    r7d01cf44 r14388c1  
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Mon May 02 15:19:44 2016
    13 // Update Count     : 1
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Mon Arg 12 16:11:00 2016
     13// Update Count     : 2
    1414//
    1515
     
    3939}
    4040
     41bool CommaExpr::get_lvalue() const {
     42        // xxx - as above, shouldn't be an lvalue but that information is used anyways.
     43        return result->get_lvalue();
     44}
     45
    4146void CommaExpr::print( std::ostream &os, Indenter indent ) const {
    4247        os << "Comma Expression:" << std::endl;
  • src/SynTree/Expression.cc

    r7d01cf44 r14388c1  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Aug  7 17:03:00 2019
    13 // Update Count     : 62
     12// Last Modified On : Tue Aug 13 11:31:00 2019
     13// Update Count     : 63
    1414//
    1515
     
    6464
    6565bool Expression::get_lvalue() const {
    66         return result->get_lvalue();
     66        assert( !result->get_lvalue() );
     67        return false;
    6768}
    6869
     
    138139}
    139140
     141bool VariableExpr::get_lvalue() const {
     142        return result->get_lvalue();
     143}
     144
    140145VariableExpr * VariableExpr::functionPointer( FunctionDecl * func ) {
    141146        VariableExpr * funcExpr = new VariableExpr( func );
     
    269274CastExpr::~CastExpr() {
    270275        delete arg;
     276}
     277
     278bool CastExpr::get_lvalue() const {
     279        return result->get_lvalue();
    271280}
    272281
     
    380389        // don't delete the member declaration, since it points somewhere else in the tree
    381390        delete aggregate;
     391}
     392
     393bool MemberExpr::get_lvalue() const {
     394        assert( result->get_lvalue() );
     395        return true;
    382396}
    383397
     
    432446}
    433447
     448bool UntypedExpr::get_lvalue() const {
     449        return result->get_lvalue();
     450}
    434451
    435452void UntypedExpr::print( std::ostream & os, Indenter indent ) const {
     
    490507        delete arg2;
    491508        delete arg3;
     509}
     510
     511bool ConditionalExpr::get_lvalue() const {
     512        return result->get_lvalue();
    492513}
    493514
     
    548569}
    549570
     571bool ConstructorExpr::get_lvalue() const {
     572        return result->get_lvalue();
     573}
     574
    550575void ConstructorExpr::print( std::ostream & os, Indenter indent ) const {
    551576        os <<  "Constructor Expression: " << std::endl << indent+1;
     
    565590CompoundLiteralExpr::~CompoundLiteralExpr() {
    566591        delete initializer;
     592}
     593
     594bool CompoundLiteralExpr::get_lvalue() const {
     595        assert( result->get_lvalue() );
     596        return true;
    567597}
    568598
  • src/SynTree/Expression.h

    r7d01cf44 r14388c1  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Aug  7 16:56:00 2019
    13 // Update Count     : 51
     12// Last Modified On : Tue Aug 13 11:30:00 2019
     13// Update Count     : 52
    1414//
    1515
     
    7171        const Type * get_result() const { return result; }
    7272        void set_result( Type * newValue ) { result = newValue; }
    73         bool get_lvalue() const;
     73        virtual bool get_lvalue() const;
    7474
    7575        TypeSubstitution * get_env() const { return env; }
     
    9999        virtual ~ApplicationExpr();
    100100
     101        bool get_lvalue() const final;
     102
    101103        Expression * get_function() const { return function; }
    102104        void set_function( Expression * newValue ) { function = newValue; }
     
    121123        UntypedExpr( const UntypedExpr & other );
    122124        virtual ~UntypedExpr();
     125
     126        bool get_lvalue() const final;
    123127
    124128        Expression * get_function() const { return function; }
     
    209213        virtual ~CastExpr();
    210214
     215        bool get_lvalue() const final;
     216
    211217        Expression * get_arg() const { return arg; }
    212218        void set_arg( Expression * newValue ) { arg = newValue; }
     
    292298        virtual ~MemberExpr();
    293299
     300        bool get_lvalue() const final;
     301
    294302        DeclarationWithType * get_member() const { return member; }
    295303        void set_member( DeclarationWithType * newValue ) { member = newValue; }
     
    314322        VariableExpr( const VariableExpr & other );
    315323        virtual ~VariableExpr();
     324
     325        bool get_lvalue() const final;
    316326
    317327        DeclarationWithType * get_var() const { return var; }
     
    501511        virtual ~ConditionalExpr();
    502512
     513        bool get_lvalue() const final;
     514
    503515        Expression * get_arg1() const { return arg1; }
    504516        void set_arg1( Expression * newValue ) { arg1 = newValue; }
     
    525537        virtual ~CommaExpr();
    526538
     539        bool get_lvalue() const final;
     540
    527541        Expression * get_arg1() const { return arg1; }
    528542        void set_arg1( Expression * newValue ) { arg1 = newValue; }
     
    611625        ~ConstructorExpr();
    612626
     627        bool get_lvalue() const final;
     628
    613629        Expression * get_callExpr() const { return callExpr; }
    614630        void set_callExpr( Expression * newValue ) { callExpr = newValue; }
     
    629645        CompoundLiteralExpr( const CompoundLiteralExpr & other );
    630646        virtual ~CompoundLiteralExpr();
     647
     648        bool get_lvalue() const final;
    631649
    632650        Initializer * get_initializer() const { return initializer; }
     
    705723        TupleIndexExpr( const TupleIndexExpr & other );
    706724        virtual ~TupleIndexExpr();
     725
     726        bool get_lvalue() const final;
    707727
    708728        Expression * get_tuple() const { return tuple; }
  • src/SynTree/TupleExpr.cc

    r7d01cf44 r14388c1  
    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 : Fri Mar 17 09:42:29 2017
    13 // Update Count     : 3
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Mon Aug 12 14:22:00 2019
     13// Update Count     : 4
    1414//
    1515
     
    7878}
    7979
     80bool TupleIndexExpr::get_lvalue() const {
     81        assert( result->get_lvalue() );
     82        return true;
     83}
     84
    8085void TupleIndexExpr::print( std::ostream &os, Indenter indent ) const {
    8186        os << "Tuple Index Expression, with tuple:" << std::endl;
Note: See TracChangeset for help on using the changeset viewer.