Skip to main content
summaryrefslogtreecommitdiffstats
blob: 5d934160163892515f1ab7081ba77ab4a8bd7305 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package org.eclipse.jdt.internal.compiler.ast;

/*
 * (c) Copyright IBM Corp. 2000, 2001.
 * All Rights Reserved.
 */
import org.eclipse.jdt.internal.compiler.IAbstractSyntaxTreeVisitor;
import org.eclipse.jdt.internal.compiler.impl.*;
import org.eclipse.jdt.internal.compiler.codegen.*;
import org.eclipse.jdt.internal.compiler.lookup.*;

public class PostfixExpression extends CompoundAssignment {

public PostfixExpression(Expression l, Expression e, int op, int pos) {
	super(l, e, op);
	sourceStart = l.sourceStart;
	sourceEnd = pos ;
}
/**
 * Code generation for PostfixExpression
 *
 * @param currentScope org.eclipse.jdt.internal.compiler.lookup.BlockScope
 * @param codeStream org.eclipse.jdt.internal.compiler.codegen.CodeStream
 * @param valueRequired boolean
 */ 
public void generateCode(BlockScope currentScope, CodeStream codeStream, boolean valueRequired) {

	// various scenarii are possible, setting an array reference, 
	// a field reference, a blank final field reference, a field of an enclosing instance or 
	// just a local variable.

	int pc = codeStream.position;
	lhs.generatePostIncrement(currentScope, codeStream, this, valueRequired);
	if (valueRequired) {
		codeStream.generateImplicitConversion(implicitConversion);
	}
	codeStream.recordPositionsFrom(pc, this);
}
public String operatorToString() {
	switch (operator) {
		case PLUS :
			return "++";
		case MINUS :
			return "--";}
	return "unknown operator";
}
public boolean restrainUsageToNumericTypes(){
	return true ;}
public String toStringExpressionNoParenthesis(){
	/* slow code*/

	return	lhs.toStringExpression() + " " + operatorToString(); }
public void traverse(IAbstractSyntaxTreeVisitor visitor, BlockScope scope) {
	if (visitor.visit(this, scope)) {
		lhs.traverse(visitor, scope);
	}
	visitor.endVisit(this, scope);
}
}

Back to the top