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.compiler.ast;
13 import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
14 import net.sourceforge.phpdt.internal.compiler.lookup.*;
16 public class PrefixExpression extends CompoundAssignment {
19 * PrefixExpression constructor comment.
20 * @param l org.eclipse.jdt.internal.compiler.ast.Expression
21 * @param r org.eclipse.jdt.internal.compiler.ast.Expression
24 public PrefixExpression(Expression l, Expression e, int op, int pos) {
26 super(l, e, op, l.sourceEnd);
27 this.sourceStart = pos;
28 this.sourceEnd = l.sourceEnd;
31 public String operatorToString() {
35 return "++"; //$NON-NLS-1$
37 return "--"; //$NON-NLS-1$
39 return "unknown operator"; //$NON-NLS-1$
42 public boolean restrainUsageToNumericTypes() {
47 public String toStringExpressionNoParenthesis() {
49 return operatorToString() + " " + lhs.toStringExpression(); //$NON-NLS-1$
53 public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
55 if (visitor.visit(this, scope)) {
56 lhs.traverse(visitor, scope);
58 visitor.endVisit(this, scope);