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.select;
14 * Selection node build by the parser in any case it was intending to
15 * reduce a field reference containing the cursor.
20 * bar().[start]fred[end]
26 * <SelectOnFieldReference:bar().fred>
32 import net.sourceforge.phpdt.internal.compiler.ast.FieldReference;
33 import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
34 import net.sourceforge.phpdt.internal.compiler.lookup.ProblemReasons;
35 import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
37 public class SelectionOnFieldReference extends FieldReference {
38 public SelectionOnFieldReference(char[] source , long pos) {
41 public TypeBinding resolveType(BlockScope scope) {
42 super.resolveType(scope);
44 // tolerate some error cases
45 if (binding == null ||
46 !(binding.isValidBinding() ||
47 binding.problemId() == ProblemReasons.NotVisible
48 || binding.problemId() == ProblemReasons.InheritedNameHidesEnclosingName
49 || binding.problemId() == ProblemReasons.NonStaticReferenceInConstructorInvocation
50 || binding.problemId() == ProblemReasons.NonStaticReferenceInStaticContext))
51 throw new SelectionNodeFound();
53 throw new SelectionNodeFound(binding);
55 public String toStringExpression(){
56 return "<SelectionOnFieldReference:" //$NON-NLS-1$
57 + super.toStringExpression()