Skip to content

Commit

Permalink
TernaryOpertaor
Browse files Browse the repository at this point in the history
- Added new `Expression`-based type
  • Loading branch information
deavmi committed May 5, 2024
1 parent 8561cdb commit 2a7b686
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions source/tlang/compiler/symbols/expressions.d
Expand Up @@ -380,4 +380,37 @@ public final class ArrayIndex : Expression
{
return "ArrayIndex [to: "~indexInto.toString()~", idx: "~index.toString()~"]";
}
}

public final class TernaryOperator : Expression
{
private Expression condition;
private Expression whenTrue, whenFalse;

this
(
Expression condition,
Expression whenTrue,
Expression whenFalse
)
{
this.condition = condition;
this.whenTrue = whenTrue;
this.whenFalse = whenFalse;
}

public Expression getCondition()
{
return this.condition;
}

public Expression getTrueExpression()
{
return this.whenTrue;
}

public Expression getFalseExpression()
{
return this.whenFalse;
}
}

0 comments on commit 2a7b686

Please sign in to comment.