Rewritten Parser/Scanner to package net.sourceforge.phpdt.internal.compiler.parser
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / ThisReference.java
diff --git a/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ThisReference.java b/net.sourceforge.phpeclipse/src/net/sourceforge/phpdt/internal/compiler/ast/ThisReference.java
deleted file mode 100644 (file)
index caa4211..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.
- * All rights reserved. This program and the accompanying materials 
- * are made available under the terms of the Common Public License v0.5 
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/cpl-v05.html
- * 
- * Contributors:
- *     IBM Corporation - initial API and implementation
- ******************************************************************************/
-package net.sourceforge.phpdt.internal.compiler.ast;
-
-import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
-import net.sourceforge.phpdt.internal.compiler.codegen.CodeStream;
-import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.MethodScope;
-import net.sourceforge.phpdt.internal.compiler.lookup.TypeBinding;
-
-public class ThisReference extends Reference {
-       
-       public static final ThisReference ThisImplicit = new ThisReference();
-       
-/**
- * ThisReference constructor comment.
- */
-public ThisReference() {
-       super();
-}
-public ThisReference(int s, int sourceEnd) {
-       this();
-       this.sourceStart = s ;
-       this.sourceEnd = sourceEnd;
-}
-protected boolean checkAccess(MethodScope methodScope) {
-       // this/super cannot be used in constructor call
-       if (methodScope.isConstructorCall) {
-               methodScope.problemReporter().fieldsOrThisBeforeConstructorInvocation(this);
-               return false;
-       }
-
-       // static may not refer to this/super
-       if (methodScope.isStatic) {
-               methodScope.problemReporter().errorThisSuperInStatic(this);
-               return false;
-       }
-       return true;
-}
-public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {
-       int pc = codeStream.position;
-       if (valueRequired)
-               codeStream.aload_0();
-       codeStream.recordPositionsFrom(pc, this.sourceStart);
-}
-public boolean isThis() {
-       
-       return true ;
-}
-public TypeBinding resolveType(BlockScope scope) {
-       // implicit this
-       constant = NotAConstant;
-       if (this != ThisImplicit && !checkAccess(scope.methodScope()))
-               return null;
-       return scope.enclosingSourceType();
-}
-public String toStringExpression(){
-
-       if (this == ThisImplicit) return "" ; //$NON-NLS-1$
-       return "this"; //$NON-NLS-1$
-}
-public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope blockScope) {
-       visitor.visit(this, blockScope);
-       visitor.endVisit(this, blockScope);
-}
-}