|
|
|
@ -2483,6 +2483,48 @@ public final class Parser
|
|
|
|
|
|
|
|
|
|
parentToContainer(container, [binOpExp.getLeftExpression(), binOpExp.getRightExpression()]);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* If we have an `UnaryOperatorExpression`
|
|
|
|
|
* then we want to parent its inner
|
|
|
|
|
* expression
|
|
|
|
|
*/
|
|
|
|
|
else if(cast(UnaryOperatorExpression)statement)
|
|
|
|
|
{
|
|
|
|
|
UnaryOperatorExpression unaryOp = cast(UnaryOperatorExpression)statement;
|
|
|
|
|
Expression opExpr = unaryOp.getExpression();
|
|
|
|
|
|
|
|
|
|
parentToContainer(container, [opExpr]);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* If we have an `ArrayIndex` then
|
|
|
|
|
* we will want to parent its inner
|
|
|
|
|
* expression which is what the
|
|
|
|
|
* index itself is formed out of.
|
|
|
|
|
*
|
|
|
|
|
* We will also want to parent the
|
|
|
|
|
* expression being indexed itself.
|
|
|
|
|
*/
|
|
|
|
|
else if(cast(ArrayIndex)statement)
|
|
|
|
|
{
|
|
|
|
|
ArrayIndex indexOp = cast(ArrayIndex)statement;
|
|
|
|
|
Expression indexedExpr = indexOp.getIndexed();
|
|
|
|
|
Expression indexExpr = indexOp.getIndex();
|
|
|
|
|
|
|
|
|
|
parentToContainer(container, [indexedExpr, indexExpr]);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* If we have an `ArrayAssignment` then
|
|
|
|
|
* we will want to parent its inner
|
|
|
|
|
* index-expression
|
|
|
|
|
*/
|
|
|
|
|
else if(cast(ArrayAssignment)statement)
|
|
|
|
|
{
|
|
|
|
|
ArrayAssignment arrAss = cast(ArrayAssignment)statement;
|
|
|
|
|
Expression indexExpr = arrAss.getArrayLeft();
|
|
|
|
|
Expression assExpr = arrAss.getAssignmentExpression();
|
|
|
|
|
|
|
|
|
|
parentToContainer(container, [indexExpr, assExpr]);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* If we have a `VariableAssignmentStdAlone`
|
|
|
|
|
* then we must parent its expression
|
|
|
|
@ -2521,6 +2563,16 @@ public final class Parser
|
|
|
|
|
Expression[] actualArguments = funcCall.getCallArguments();
|
|
|
|
|
parentToContainer(container, cast(Statement[])actualArguments);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* If we have a `CastedExpression`
|
|
|
|
|
*/
|
|
|
|
|
else if(cast(CastedExpression)statement)
|
|
|
|
|
{
|
|
|
|
|
CastedExpression castExpr = cast(CastedExpression)statement;
|
|
|
|
|
|
|
|
|
|
Expression toCast = castExpr.getEmbeddedExpression();
|
|
|
|
|
parentToContainer(container, [toCast]);
|
|
|
|
|
}
|
|
|
|
|
/**
|
|
|
|
|
* If we have a `ReturnStmt`
|
|
|
|
|
* then we must process its
|
|
|
|
@ -4176,7 +4228,6 @@ unittest
|
|
|
|
|
}
|
|
|
|
|
catch(TError e)
|
|
|
|
|
{
|
|
|
|
|
ERROR(e);
|
|
|
|
|
assert(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -4272,7 +4323,6 @@ public int i = 2;
|
|
|
|
|
}
|
|
|
|
|
catch(TError e)
|
|
|
|
|
{
|
|
|
|
|
stderr.writeln(e);
|
|
|
|
|
assert(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|