use of lucee.transformer.bytecode.statement.Return in project Lucee by lucee.
the class TagReturn method _writeOut.
/**
* @see lucee.transformer.bytecode.statement.tag.TagBase#_writeOut(org.objectweb.asm.commons.GeneratorAdapter)
*/
@Override
public void _writeOut(BytecodeContext bc) throws TransformerException {
Attribute attr = getAttribute("expr");
Expression expr = null;
if (attr != null)
expr = attr.getValue();
new Return(expr, expr.getStart(), expr.getEnd()).writeOut(bc);
}
use of lucee.transformer.bytecode.statement.Return in project Lucee by lucee.
the class AbstrCFMLScriptTransformer method lambdaPart.
@Override
protected final Function lambdaPart(ExprData data, String id, int access, int modifier, String rtnType, Position line, ArrayList<Argument> args) throws TemplateException {
Body body = new FunctionBody(data.factory);
Function func = new Lambda(data.root, id, access, modifier, rtnType, body, line, null);
// new FunctionImpl(data.page,id,access,rtnType,body,line,null);
comments(data);
// add arguments
for (Argument arg : args) {
func.addArgument(arg.getName(), arg.getType(), arg.getRequired(), arg.getDefaultValue(), arg.isPassByReference(), arg.getDisplayName(), arg.getHint(), arg.getMetaData());
}
comments(data);
// body
boolean oldInsideFunction = data.insideFunction;
data.insideFunction = true;
try {
if (data.srcCode.isCurrent('{')) {
statement(data, body, CTX_FUNCTION);
} else {
if (data.srcCode.forwardIfCurrent("return ")) {
comments(data);
}
// ex block
short prior = data.context;
data.context = CTX_FUNCTION;
comments(data);
Expression expr = expression(data);
// checkSemiColonLineFeed( data, true ,true );
Return rtn = new Return(expr, line, data.srcCode.getPosition());
body.addStatement(rtn);
data.docComment = null;
data.context = prior;
}
} finally {
data.insideFunction = oldInsideFunction;
}
/*try {
// ex block
statement(data,body,CTX_FUNCTION);
}
finally{
data.insideFunction=oldInsideFunction;
}*/
func.setEnd(data.srcCode.getPosition());
comments(data);
return func;
}
use of lucee.transformer.bytecode.statement.Return in project Lucee by lucee.
the class AbstrCFMLScriptTransformer method returnStatement.
/**
* Liest ein return Statement ein.
* <br />
* EBNF:<br />
* <code>spaces expressionStatement spaces;</code>
* @return return Statement
* @throws TemplateException
*/
private final Return returnStatement(ExprData data) throws TemplateException {
if (!data.srcCode.forwardIfCurrentAndNoVarExt("return"))
return null;
Position line = data.srcCode.getPosition();
Return rtn;
comments(data);
if (checkSemiColonLineFeed(data, false, false, false))
rtn = new Return(data.factory, line, data.srcCode.getPosition());
else {
Expression expr = expression(data);
checkSemiColonLineFeed(data, true, true, false);
rtn = new Return(expr, line, data.srcCode.getPosition());
}
comments(data);
return rtn;
}
Aggregations