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.phpeclipse.internal.compiler.ast;
13 import net.sourceforge.phpdt.internal.compiler.IAbstractSyntaxTreeVisitor;
14 import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
16 public class PostfixExpression extends CompoundAssignment {
18 public PostfixExpression(Expression l, Expression e, int op, int pos) {
21 this.sourceStart = l.sourceStart;
26 * Code generation for PostfixExpression
28 * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
29 * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
30 * @param valueRequired boolean
32 // public void generateCode(
33 // BlockScope currentScope,
34 // CodeStream codeStream,
35 // boolean valueRequired) {
37 // // various scenarii are possible, setting an array reference,
38 // // a field reference, a blank final field reference, a field of an enclosing instance or
39 // // just a local variable.
41 // int pc = codeStream.position;
42 // ((Reference) lhs).generatePostIncrement(currentScope, codeStream, this, valueRequired);
43 // if (valueRequired) {
44 // codeStream.generateImplicitConversion(implicitConversion);
46 // codeStream.recordPositionsFrom(pc, this.sourceStart);
49 public String operatorToString() {
52 return "++"; //$NON-NLS-1$
54 return "--"; //$NON-NLS-1$
56 return "unknown operator"; //$NON-NLS-1$
59 public boolean restrainUsageToNumericTypes() {
64 public String toStringExpressionNoParenthesis() {
66 return lhs.toStringExpression() + " " + operatorToString(); //$NON-NLS-1$
69 public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
71 if (visitor.visit(this, scope)) {
72 lhs.traverse(visitor, scope);
74 visitor.endVisit(this, scope);