mirror of
https://github.com/GTNewHorizons/CraftTweaker.git
synced 2026-11-19 11:49:05 +00:00
Add support to return void in a function
* statement `return;` is valid now. * functions return void by default, an explicit return is not necessary now
This commit is contained in:
1 parent
33c2bd0c94
commit
2924666ad4
2 files changed
+5
-1
No files matched your search
@@ -90,6 +90,7 @@ public class ExpressionJavaLambda extends Expression {
|
||||
for (Statement statement : statements) {
|
||||
statement.compile(environmentMethod);
|
||||
}
|
||||
output.ret();
|
||||
output.end();
|
||||
|
||||
environment.putClass(clsName, cw.toByteArray());
|
||||
|
||||
@@ -26,7 +26,10 @@ public abstract class Statement {
|
||||
}
|
||||
case T_RETURN: {
|
||||
parser.next();
|
||||
ParsedExpression expression = ParsedExpression.read(parser, environment);
|
||||
ParsedExpression expression = null;
|
||||
if (parser.peek() != null && !parser.isNext(T_SEMICOLON)) {
|
||||
expression = ParsedExpression.read(parser, environment);
|
||||
}
|
||||
parser.required(T_SEMICOLON, "; expected");
|
||||
return new StatementReturn(next.getPosition(), returnType, expression);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user