mirror of https://github.com/tbklang/tlang.git
Expressions
- `BinaryOperatorExpression`, `CastedExpression` and `IntegerLiteral` now implements the new `MCloneable` API
This commit is contained in:
parent
254c5ee6b9
commit
7acb8e6308
|
@ -158,9 +158,13 @@ public class BinaryOperatorExpression : OperatorExpression, MStatementSearchable
|
||||||
* returning a fresh new copy of itself and its
|
* returning a fresh new copy of itself and its
|
||||||
* left and right operands
|
* left and right operands
|
||||||
*
|
*
|
||||||
|
* Param:
|
||||||
|
* newParent = the `Container` to re-parent the
|
||||||
|
* cloned `Statement`'s self to
|
||||||
|
*
|
||||||
* Returns: the cloned `Statement`
|
* Returns: the cloned `Statement`
|
||||||
*/
|
*/
|
||||||
public override Statement clone()
|
public override Statement clone(Container newParent = null)
|
||||||
{
|
{
|
||||||
BinaryOperatorExpression clonedBinaryOp;
|
BinaryOperatorExpression clonedBinaryOp;
|
||||||
|
|
||||||
|
@ -183,6 +187,9 @@ public class BinaryOperatorExpression : OperatorExpression, MStatementSearchable
|
||||||
// Clone ourselves
|
// Clone ourselves
|
||||||
clonedBinaryOp = new BinaryOperatorExpression(this.operator, clonedLeftOperandExpression, clonedRightOperandExpression);
|
clonedBinaryOp = new BinaryOperatorExpression(this.operator, clonedLeftOperandExpression, clonedRightOperandExpression);
|
||||||
|
|
||||||
|
// Parent outselves to the given parent
|
||||||
|
clonedBinaryOp.parentTo(newParent);
|
||||||
|
|
||||||
return clonedBinaryOp;
|
return clonedBinaryOp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -218,14 +225,21 @@ public class IntegerLiteral : NumberLiteral, MCloneable
|
||||||
/**
|
/**
|
||||||
* Clones this integer literal
|
* Clones this integer literal
|
||||||
*
|
*
|
||||||
|
* Param:
|
||||||
|
* newParent = the `Container` to re-parent the
|
||||||
|
* cloned `Statement`'s self to
|
||||||
|
*
|
||||||
* Returns: the cloned `Statement`
|
* Returns: the cloned `Statement`
|
||||||
*/
|
*/
|
||||||
public override Statement clone()
|
public override Statement clone(Container newParent = null)
|
||||||
{
|
{
|
||||||
IntegerLiteral clonedIntegerLiteral;
|
IntegerLiteral clonedIntegerLiteral;
|
||||||
|
|
||||||
clonedIntegerLiteral = new IntegerLiteral(this.numberLiteral, this.encoding);
|
clonedIntegerLiteral = new IntegerLiteral(this.numberLiteral, this.encoding);
|
||||||
|
|
||||||
|
// Parent outselves to the given parent
|
||||||
|
clonedIntegerLiteral.parentTo(newParent);
|
||||||
|
|
||||||
return clonedIntegerLiteral;
|
return clonedIntegerLiteral;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -311,9 +325,13 @@ public final class CastedExpression : Expression, MCloneable
|
||||||
* Clones this casted expression recursively
|
* Clones this casted expression recursively
|
||||||
* and returns a fresh copy of it
|
* and returns a fresh copy of it
|
||||||
*
|
*
|
||||||
|
* Param:
|
||||||
|
* newParent = the `Container` to re-parent the
|
||||||
|
* cloned `Statement`'s self to
|
||||||
|
*
|
||||||
* Returns: the cloned `Statement`
|
* Returns: the cloned `Statement`
|
||||||
*/
|
*/
|
||||||
public override Statement clone()
|
public override Statement clone(Container newParent = null)
|
||||||
{
|
{
|
||||||
CastedExpression clonedCastedExpression;
|
CastedExpression clonedCastedExpression;
|
||||||
|
|
||||||
|
@ -327,6 +345,9 @@ public final class CastedExpression : Expression, MCloneable
|
||||||
|
|
||||||
clonedCastedExpression = new CastedExpression(this.toType, clonedUncastedExpression);
|
clonedCastedExpression = new CastedExpression(this.toType, clonedUncastedExpression);
|
||||||
|
|
||||||
|
// Parent outselves to the given parent
|
||||||
|
clonedCastedExpression.parentTo(newParent);
|
||||||
|
|
||||||
return clonedCastedExpression;
|
return clonedCastedExpression;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue