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.ExplicitConstructorCall;
36 import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
37 import net.sourceforge.phpdt.internal.compiler.lookup.ReferenceBinding;
39 public class CompletionOnExplicitConstructorCall extends ExplicitConstructorCall {
40 public CompletionOnExplicitConstructorCall(int accessMode) {
43 public void resolve(BlockScope scope) {
44 ReferenceBinding receiverType = scope.enclosingSourceType();
46 if (accessMode != This && receiverType != null) {
47 if (receiverType.isHierarchyInconsistent())
48 throw new CompletionNodeFound();
49 receiverType = receiverType.superclass();
51 if (receiverType == null)
52 throw new CompletionNodeFound();
54 throw new CompletionNodeFound(this, receiverType, scope);
56 public String toString(int tab) {
57 String s = tabString(tab);
58 s += "<CompleteOnExplicitConstructorCall:"; //$NON-NLS-1$
59 if (qualification != null)
60 s = s + qualification.toStringExpression() + "."; //$NON-NLS-1$
61 if (accessMode == This) {
62 s = s + "this("; //$NON-NLS-1$
64 s = s + "super("; //$NON-NLS-1$
66 if (arguments != null) {
67 for (int i = 0; i < arguments.length; i++) {
68 s += arguments[i].toStringExpression();
69 if (i != arguments.length - 1) {
70 s += ", "; //$NON-NLS-1$
74 s += ")>"; //$NON-NLS-1$