1 /*******************************************************************************
2 * Copyright (c) 2000, 2003 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Common Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/cpl-v10.html
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler.ast;
13 import net.sourceforge.phpdt.internal.compiler.ASTVisitor;
14 import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
16 public class PrefixExpression extends CompoundAssignment {
19 * PrefixExpression constructor comment.
22 * net.sourceforge.phpdt.internal.compiler.ast.Expression
24 * net.sourceforge.phpdt.internal.compiler.ast.Expression
28 public PrefixExpression(Expression l, Expression e, int op, int pos) {
30 super(l, e, op, l.sourceEnd);
31 this.sourceStart = pos;
32 this.sourceEnd = l.sourceEnd;
35 public String operatorToString() {
39 return "++"; //$NON-NLS-1$
41 return "--"; //$NON-NLS-1$
43 return "unknown operator"; //$NON-NLS-1$
46 public boolean restrainUsageToNumericTypes() {
51 public String toStringExpressionNoParenthesis() {
53 return operatorToString() + " " + lhs.toStringExpression(); //$NON-NLS-1$
57 public void traverse(ASTVisitor visitor, BlockScope scope) {
59 if (visitor.visit(this, scope)) {
60 lhs.traverse(visitor, scope);
62 visitor.endVisit(this, scope);