public boolean isSpecialCall() { return isThisCall() || isSuperCall(); }
public String getText() { String text = null; if (isSuperCall()) { text = "super "; } else if (isThisCall()) { text = "this "; } else { text = "new " + getType().getName(); } return text + arguments.getText(); }
if (constrCall.isSuperCall()) { out.print("super("); } else {
private void visitSpecialConstructorCall(ConstructorCallExpression call) { if (controller.getClosureWriter().addGeneratedClosureConstructorCall(call)) return; ClassNode callNode = controller.getClassNode(); if (call.isSuperCall()) callNode = callNode.getSuperClass(); List<ConstructorNode> constructors = sortConstructors(call, callNode); if (!makeDirectConstructorCall(constructors, call, callNode)) { makeMOPBasedConstructorCall(constructors, call, callNode); } }
@Override public void visitConstructorCallExpression(final ConstructorCallExpression call) { super.visitConstructorCallExpression(call); MethodNode target = (MethodNode) call.getNodeMetaData(DIRECT_METHOD_CALL_TARGET); if (target==null && call.getLineNumber()>0) { addError("Target constructor for constructor call expression hasn't been set", call); } else { if (target==null) { // try to find a target ArgumentListExpression argumentListExpression = InvocationWriter.makeArgumentList(call.getArguments()); List<Expression> expressions = argumentListExpression.getExpressions(); ClassNode[] args = new ClassNode[expressions.size()]; for (int i = 0; i < args.length; i++) { args[i] = typeChooser.resolveType(expressions.get(i), classNode); } MethodNode constructor = findMethodOrFail(call, call.isSuperCall() ? classNode.getSuperClass() : classNode, "<init>", args); call.putNodeMetaData(DIRECT_METHOD_CALL_TARGET, constructor); target = constructor; } } if (target!=null) { memorizeInitialExpressions(target); } }
private boolean shouldImplicitlyPassThisPara(ConstructorCallExpression cce) { boolean pass = false; ClassNode superCN = classNode.getSuperClass(); if (cce.isThisCall()) { pass = true; } else if (cce.isSuperCall()) { // if the super class is another non-static inner class in the same outer class hierarchy, implicit this // needs to be passed if (!superCN.isEnum() && !superCN.isInterface() && superCN instanceof InnerClassNode) { InnerClassNode superInnerCN = (InnerClassNode) superCN; if (!isStatic(superInnerCN) && classNode.getOuterClass().isDerivedFrom(superCN.getOuterClass())) { pass = true; } } } return pass; }
Statement code = ctor.getFirstStatement(); cce = (ConstructorCallExpression) ((ExpressionStatement) code).getExpression(); if (cce.isSuperCall()) return;
expressions.add(0, ve); if (cce.isSuperCall()) {
call.isSuperCall() ? typeCheckingContext.getEnclosingClassNode().getSuperClass() : call.getType(); Expression arguments = call.getArguments();
if (expression instanceof ConstructorCallExpression) { ConstructorCallExpression call = (ConstructorCallExpression) expression; if (call.isSuperCall()) { hasCallToSuper = true; break;
public boolean isSpecialCall(){ return isThisCall() || isSuperCall(); }
public boolean isSpecialCall(){ return isThisCall() || isSuperCall(); }
public boolean isSpecialCall() { return isThisCall() || isSuperCall(); }
public boolean isSpecialCall(){ return isThisCall() || isSuperCall(); }
public String getText() { String text = null; if (isSuperCall()) { text = "super "; } else if (isThisCall()) { text = "this "; } else { text = "new " + getType().getName(); } return text + arguments.getText(); }
public String getText() { String text = null; if (isSuperCall()) { text = "super "; } else if (isThisCall()) { text = "this "; } else { text = "new "+ getType().getName(); } return text + arguments.getText(); }
public String getText() { String text = null; if (isSuperCall()) { text = "super "; } else if (isThisCall()) { text = "this "; } else { text = "new "+ getType().getName(); } return text + arguments.getText(); }
public String getText() { String text = null; if (isSuperCall()) { text = "super "; } else if (isThisCall()) { text = "this "; } else { text = "new "+ getType().getName(); } return text + arguments.getText(); }
private void visitSpecialConstructorCall(ConstructorCallExpression call) { if (controller.getClosureWriter().addGeneratedClosureConstructorCall(call)) return; ClassNode callNode = controller.getClassNode(); if (call.isSuperCall()) callNode = callNode.getSuperClass(); List<ConstructorNode> constructors = sortConstructors(call, callNode); if (!makeDirectConstructorCall(constructors, call, callNode)) { makeMOPBasedConstructorCall(constructors, call, callNode); } }
private boolean shouldImplicitlyPassThisPara(ConstructorCallExpression cce) { boolean pass = false; ClassNode superCN = classNode.getSuperClass(); if (cce.isThisCall()) { pass = true; } else if (cce.isSuperCall()) { // if the super class is another non-static inner class in the same outer class hierarchy, implicit this // needs to be passed if (!superCN.isEnum() && !superCN.isInterface() && superCN instanceof InnerClassNode) { InnerClassNode superInnerCN = (InnerClassNode) superCN; if (!isStatic(superInnerCN) && classNode.getOuterClass().isDerivedFrom(superCN.getOuterClass())) { pass = true; } } } return pass; }