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 PostfixExpression extends CompoundAssignment {
18 public PostfixExpression(Expression l, Expression e, int op, int pos) {
21 this.sourceStart = l.sourceStart;
26 * Code generation for PostfixExpression
29 * net.sourceforge.phpdt.internal.compiler.lookup.BlockScope
31 * net.sourceforge.phpdt.internal.compiler.codegen.CodeStream
32 * @param valueRequired
35 // public void generateCode(
36 // BlockScope currentScope,
37 // CodeStream codeStream,
38 // boolean valueRequired) {
40 // // various scenarii are possible, setting an array reference,
41 // // a field reference, a blank final field reference, a field of an
42 // enclosing instance or
43 // // just a local variable.
45 // int pc = codeStream.position;
46 // ((Reference) lhs).generatePostIncrement(currentScope, codeStream, this,
48 // if (valueRequired) {
49 // codeStream.generateImplicitConversion(implicitConversion);
51 // codeStream.recordPositionsFrom(pc, this.sourceStart);
53 public String operatorToString() {
56 return "++"; //$NON-NLS-1$
58 return "--"; //$NON-NLS-1$
60 return "unknown operator"; //$NON-NLS-1$
63 public boolean restrainUsageToNumericTypes() {
68 public String toStringExpressionNoParenthesis() {
70 return lhs.toStringExpression() + " " + operatorToString(); //$NON-NLS-1$
73 public void traverse(ASTVisitor visitor, BlockScope scope) {
75 if (visitor.visit(this, scope)) {
76 lhs.traverse(visitor, scope);
78 visitor.endVisit(this, scope);