1 /*******************************************************************************
2 * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v0.5
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v05.html
9 * IBM Corporation - initial API and implementation
10 ******************************************************************************/
11 package net.sourceforge.phpdt.internal.codeassist.complete;
14 * Completion node build by the parser in any case it was intending to
15 * reduce a explicit constructor call containing the cursor.
26 * <CompleteOnExplicitConstructorCall:this(1, 2)>
30 * The source range is always of length 0.
31 * The arguments of the constructor call are all the arguments defined
35 import net.sourceforge.phpdt.internal.compiler.ast.*;
36 import net.sourceforge.phpdt.internal.compiler.lookup.*;
38 public class CompletionOnExplicitConstructorCall extends ExplicitConstructorCall {
39 public CompletionOnExplicitConstructorCall(int accessMode) {
42 public void resolve(BlockScope scope) {
43 ReferenceBinding receiverType = scope.enclosingSourceType();
45 if (accessMode != This && receiverType != null) {
46 if (receiverType.isHierarchyInconsistent())
47 throw new CompletionNodeFound();
48 receiverType = receiverType.superclass();
50 if (receiverType == null)
51 throw new CompletionNodeFound();
53 throw new CompletionNodeFound(this, receiverType, scope);
55 public String toString(int tab) {
56 String s = tabString(tab);
57 s += "<CompleteOnExplicitConstructorCall:"; //$NON-NLS-1$
58 if (qualification != null)
59 s = s + qualification.toStringExpression() + "."; //$NON-NLS-1$
60 if (accessMode == This) {
61 s = s + "this("; //$NON-NLS-1$
63 s = s + "super("; //$NON-NLS-1$
65 if (arguments != null) {
66 for (int i = 0; i < arguments.length; i++) {
67 s += arguments[i].toStringExpression();
68 if (i != arguments.length - 1) {
69 s += ", "; //$NON-NLS-1$
73 s += ")>"; //$NON-NLS-1$