public void generateProtectedDefaultConstructor(ClassNode classNode) { classNode.addConstructor( Modifier.PROTECTED , new Parameter[]{} , new ClassNode[]{} , new EmptyStatement() ); }
public static Statement ifs_no_return(Expression cond, Statement trueStmnt) { return new IfStatement( cond instanceof BooleanExpression ? (BooleanExpression) cond : new BooleanExpression(cond), trueStmnt, new EmptyStatement() ); }
private Statement returnFalseIfWrongType(ClassNode cNode, Expression other) { return new IfStatement( notEqualClasses(cNode, other), new ReturnStatement(ConstantExpression.FALSE), new EmptyStatement() ); }
private IfStatement returnFalseIfNull(Expression other) { return new IfStatement( equalsNullExpr(other), new ReturnStatement(ConstantExpression.FALSE), new EmptyStatement() ); }
private IfStatement returnFalseIfNull(Expression other) { return new IfStatement( equalsNullExpr(other), new ReturnStatement(ConstantExpression.FALSE), new EmptyStatement() ); }
public static Statement returnFalseIfNotInstanceof(ClassNode cNode, Expression other) { return new IfStatement( isInstanceof(cNode, other), new EmptyStatement(), new ReturnStatement(ConstantExpression.FALSE) ); }
public static Statement returnFalseIfPropertyNotEqual(PropertyNode pNode, Expression other) { return new IfStatement( notEqualsPropertyExpr(pNode, other), new ReturnStatement(ConstantExpression.FALSE), new EmptyStatement() ); }
private IfStatement returnTrueIfIdentical(Expression self, Expression other) { return new IfStatement( identicalExpr(self, other), new ReturnStatement(ConstantExpression.TRUE), new EmptyStatement() ); }
private Statement returnFalseIfPropertyNotEqual(PropertyNode pNode, Expression other) { return new IfStatement( notEqualsExpr(pNode, other), new ReturnStatement(ConstantExpression.FALSE), new EmptyStatement() ); }
private Statement returnFalseIfPropertyNotEqual(PropertyNode pNode, Expression other) { return new IfStatement( notEqualsExpr(pNode, other), new ReturnStatement(ConstantExpression.FALSE), new EmptyStatement() ); }
public static IfStatement returnFalseIfNull(Expression other) { return new IfStatement( equalsNullExpr(other), new ReturnStatement(ConstantExpression.FALSE), new EmptyStatement() ); }
public static Statement returnFalseIfFieldNotEqual(FieldNode fNode, Expression other) { return new IfStatement( notEqualsFieldExpr(fNode, other), new ReturnStatement(ConstantExpression.FALSE), new EmptyStatement() ); }
public static Statement returnFalseIfWrongType(ClassNode cNode, Expression other) { return new IfStatement( notEqualClasses(cNode, other), new ReturnStatement(ConstantExpression.FALSE), new EmptyStatement() ); }
public static IfStatement returnTrueIfIdentical(Expression self, Expression other) { return new IfStatement( identicalExpr(self, other), new ReturnStatement(ConstantExpression.TRUE), new EmptyStatement() ); }
private IfStatement returnTrueIfIdentical(Expression self, Expression other) { return new IfStatement( identicalExpr(self, other), new ReturnStatement(ConstantExpression.TRUE), new EmptyStatement() ); }
public static Statement ifs(Expression cond, Expression trueExpr) { return new IfStatement( cond instanceof BooleanExpression ? (BooleanExpression) cond : new BooleanExpression(cond), new ReturnStatement(trueExpr), new EmptyStatement() ); }
public static Statement ifs_no_return(Expression cond, Expression trueExpr) { return new IfStatement( cond instanceof BooleanExpression ? (BooleanExpression) cond : new BooleanExpression(cond), new ExpressionStatement(trueExpr), new EmptyStatement() ); }
public void generateGetProperty(ClassNode classNode) { classNode.addMethod( "getProperty" , Modifier.PUBLIC , ClassHelper.OBJECT_TYPE , new Parameter[] { new Parameter(ClassHelper.STRING_TYPE, "p") } , new ClassNode[] {} , new EmptyStatement() ); try { plugGetProperty(classNode); } catch (NoSuchMethodException ignore) { } }
public void visitMethodCallExpression(MethodCallExpression ex){ if(isTagCall(ex)){ //System.out.println("FOUND TAG CALL "+ex+" and rewriting "); List<Expression> args = ((TupleExpression)ex.getArguments()).getExpressions(); List<Expression> newArgs= new ArrayList<>(); newArgs.add(new ConstantExpression(ex.getMethodAsString())); newArgs.addAll(args); //Automatically add a closure so that scope is available to the tag if(newArgs.size()==0 || !(newArgs.get(newArgs.size()-1) instanceof ClosureExpression)){ newArgs.add(new ClosureExpression(new Parameter[0], new EmptyStatement())); } ex.setArguments(new TupleExpression(newArgs)); ex.setMethod(new ConstantExpression(TAG)); } super.visitMethodCallExpression(ex); } }
public void visitMethodCallExpression(MethodCallExpression ex){ if(isTagCall(ex)){ //System.out.println("FOUND TAG CALL "+ex+" and rewriting "); List<Expression> args = ((TupleExpression)ex.getArguments()).getExpressions(); List<Expression> newArgs= new ArrayList<>(); newArgs.add(new ConstantExpression(ex.getMethodAsString())); newArgs.addAll(args); //Automatically add a closure so that scope is available to the tag if(newArgs.size()==0 || !(newArgs.get(newArgs.size()-1) instanceof ClosureExpression)){ newArgs.add(new ClosureExpression(new Parameter[0], new EmptyStatement())); } ex.setArguments(new TupleExpression(newArgs)); ex.setMethod(new ConstantExpression(TAG)); } super.visitMethodCallExpression(ex); } }