Changeset e6cf857f for src/AST


Ignore:
Timestamp:
May 18, 2022, 2:24:48 PM (2 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
Children:
288927f
Parents:
767a8ef
Message:

call -> createCall: The template wrapper has been removed and now it is beside similar helper functions.

Location:
src/AST
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Expr.cpp

    r767a8ef re6cf857f  
    1010// Created On       : Wed May 15 17:00:00 2019
    1111// Last Modified By : Andrew Beach
    12 // Created On       : Tue Nov 30 14:23:00 2021
    13 // Update Count     : 7
     12// Created On       : Wed May 18 13:56:00 2022
     13// Update Count     : 8
    1414//
    1515
     
    2121
    2222#include "Copy.hpp"                // for shallowCopy
    23 #include "Eval.hpp"                // for call
    2423#include "GenericSubstitution.hpp"
    2524#include "LinkageSpec.hpp"
     
    6766// --- UntypedExpr
    6867
     68bool UntypedExpr::get_lvalue() const {
     69        std::string fname = InitTweak::getFunctionName( this );
     70        return lvalueFunctionNames.count( fname );
     71}
     72
    6973UntypedExpr * UntypedExpr::createDeref( const CodeLocation & loc, const Expr * arg ) {
    7074        assert( arg );
    7175
    72         UntypedExpr * ret = call( loc, "*?", arg );
     76        UntypedExpr * ret = createCall( loc, "*?", { arg } );
    7377        if ( const Type * ty = arg->result ) {
    7478                const Type * base = InitTweak::getPointerBase( ty );
     
    8791}
    8892
    89 bool UntypedExpr::get_lvalue() const {
    90         std::string fname = InitTweak::getFunctionName( this );
    91         return lvalueFunctionNames.count( fname );
    92 }
    93 
    9493UntypedExpr * UntypedExpr::createAssign( const CodeLocation & loc, const Expr * lhs, const Expr * rhs ) {
    9594        assert( lhs && rhs );
    9695
    97         UntypedExpr * ret = call( loc, "?=?", lhs, rhs );
     96        UntypedExpr * ret = createCall( loc, "?=?", { lhs, rhs } );
    9897        if ( lhs->result && rhs->result ) {
    9998                // if both expressions are typed, assumes that this assignment is a C bitwise assignment,
     
    102101        }
    103102        return ret;
     103}
     104
     105UntypedExpr * UntypedExpr::createCall( const CodeLocation & loc,
     106                const std::string & name, std::vector<ptr<Expr>> && args ) {
     107        return new UntypedExpr( loc,
     108                        new NameExpr( loc, name ), std::move( args ) );
    104109}
    105110
  • src/AST/Expr.hpp

    r767a8ef re6cf857f  
    230230        /// Creates a new assignment expression
    231231        static UntypedExpr * createAssign( const CodeLocation & loc, const Expr * lhs, const Expr * rhs );
     232        /// Creates a new call of a variable.
     233        static UntypedExpr * createCall( const CodeLocation & loc,
     234                const std::string & name, std::vector<ptr<Expr>> && args );
    232235
    233236        const Expr * accept( Visitor & v ) const override { return v.visit( this ); }
  • src/AST/module.mk

    r767a8ef re6cf857f  
    2929        AST/DeclReplacer.cpp \
    3030        AST/DeclReplacer.hpp \
    31         AST/Eval.hpp \
    3231        AST/Expr.cpp \
    3332        AST/Expr.hpp \
Note: See TracChangeset for help on using the changeset viewer.