use of lucee.transformer.bytecode.expression.var.DynAssign in project Lucee by lucee.
the class AbstrCFMLExprTransformer method assignOp.
/**
* Transfomiert Zuweisungs Operation.
* <br />
* EBNF:<br />
* <code>eqvOp ["=" spaces assignOp];</code>
* @return CFXD Element
* @throws TemplateException
*/
protected Expression assignOp(ExprData data) throws TemplateException {
Expression expr = conditionalOp(data);
if (data.srcCode.forwardIfCurrent('=')) {
comments(data);
if (data.mode == STATIC)
expr = new DynAssign(expr, assignOp(data));
else {
if (expr instanceof Variable) {
Expression value = assignOp(data);
expr = new Assign((Variable) expr, value, data.srcCode.getPosition());
} else if (expr instanceof Null) {
Variable var = ((Null) expr).toVariable();
Expression value = assignOp(data);
expr = new Assign(var, value, data.srcCode.getPosition());
} else
throw new TemplateException(data.srcCode, "invalid assignment left-hand side (" + expr.getClass().getName() + ")");
}
}
// patch for test()(); only works at the end of an expression!
comments(data);
while (data.srcCode.isCurrent('(')) {
comments(data);
Call call = new Call(expr);
getFunctionMemberAttrs(data, null, false, call, null);
call.setEnd(data.srcCode.getPosition());
comments(data);
expr = call;
}
return expr;
}
Aggregations