Skip to content

Commit

Permalink
Merge fix: Adapt to removed CommaExp::copy()
Browse files Browse the repository at this point in the history
  • Loading branch information
kinke committed Nov 6, 2023
1 parent d435c8a commit 2b3ffeb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
1 change: 1 addition & 0 deletions dmd/ldcbindings.d
Original file line number Diff line number Diff line change
Expand Up @@ -83,3 +83,4 @@ Expression createExpressionForIntOp(const ref Loc loc, TOK op, Expression e1, Ex
Expression createExpression(const ref Loc loc, EXP op) { return new Expression(loc, op); }
DsymbolExp createDsymbolExp(const ref Loc loc, Dsymbol s) { return new DsymbolExp(loc, s, /*hasOverloads=*/false); }
AddrExp createAddrExp(const ref Loc loc, Expression e) { return new AddrExp(loc, e); }
CommaExp createCommaExp(const ref Loc loc, Expression e1, Expression e2, bool generated = true) { return new CommaExp(loc, e1, e2, generated); }
4 changes: 4 additions & 0 deletions dmd/ldcbindings.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
#include "tokens.h"

class AddrExp;
class CommaExp;
class Dsymbol;
class DsymbolExp;
class Expression;
Expand All @@ -36,3 +37,6 @@ Expression *createExpressionForIntOp(const Loc &loc, TOK op, Expression *e1, Exp
Expression *createExpression(const Loc &loc, EXP op);
DsymbolExp *createDsymbolExp(const Loc &loc, Dsymbol *s);
AddrExp *createAddrExp(const Loc &loc, Expression *e);

// for gen/toir.cpp only:
CommaExp *createCommaExp(const Loc &loc, Expression *e1, Expression *e2, bool generated = true);
5 changes: 3 additions & 2 deletions gen/toir.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#include "dmd/id.h"
#include "dmd/identifier.h"
#include "dmd/init.h"
#include "dmd/ldcbindings.h"
#include "dmd/module.h"
#include "dmd/mtype.h"
#include "dmd/root/port.h"
Expand Down Expand Up @@ -638,8 +639,8 @@ class ToElemVisitor : public Visitor {
if (auto ce = e->isCommaExp()) {
Expression *newCommaRhs = getLValExp(ce->e2);
if (newCommaRhs != ce->e2) {
CommaExp *newComma = static_cast<CommaExp *>(ce->copy());
newComma->e2 = newCommaRhs;
CommaExp *newComma =
createCommaExp(ce->loc, ce->e1, newCommaRhs, ce->isGenerated);
newComma->type = newCommaRhs->type;
e = newComma;
}
Expand Down

0 comments on commit 2b3ffeb

Please sign in to comment.