Makefile fixup
[org.ibex.tool.git] / src / org / eclipse / jdt / internal / compiler / ast / Reference.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2004 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
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package org.eclipse.jdt.internal.compiler.ast;
12
13 import org.eclipse.jdt.internal.compiler.codegen.*;
14 import org.eclipse.jdt.internal.compiler.flow.*;
15 import org.eclipse.jdt.internal.compiler.lookup.*;
16
17 public abstract class Reference extends Expression  {
18 /**
19  * BaseLevelReference constructor comment.
20  */
21 public Reference() {
22         super();
23 }
24 public abstract FlowInfo analyseAssignment(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, Assignment assignment, boolean isCompound);
25
26 public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
27         return flowInfo;
28 }
29 public FieldBinding fieldBinding() {
30         //this method should be sent one FIELD-tagged references
31         //  (ref.bits & BindingIds.FIELD != 0)()
32         return null ;
33 }
34 public void fieldStore(CodeStream codeStream, FieldBinding fieldBinding, MethodBinding syntheticWriteAccessor, boolean valueRequired) {
35
36         if (fieldBinding.isStatic()) {
37                 if (valueRequired) {
38                         if ((fieldBinding.type == LongBinding) || (fieldBinding.type == DoubleBinding)) {
39                                 codeStream.dup2();
40                         } else {
41                                 codeStream.dup();
42                         }
43                 }
44                 if (syntheticWriteAccessor == null) {
45                         codeStream.putstatic(fieldBinding);
46                 } else {
47                         codeStream.invokestatic(syntheticWriteAccessor);
48                 }
49         } else { // Stack:  [owner][new field value]  ---> [new field value][owner][new field value]
50                 if (valueRequired) {
51                         if ((fieldBinding.type == LongBinding) || (fieldBinding.type == DoubleBinding)) {
52                                 codeStream.dup2_x1();
53                         } else {
54                                 codeStream.dup_x1();
55                         }
56                 }
57                 if (syntheticWriteAccessor == null) {
58                         codeStream.putfield(fieldBinding);
59                 } else {
60                         codeStream.invokestatic(syntheticWriteAccessor);
61                 }
62         }
63 }
64 public abstract void generateAssignment(BlockScope currentScope, CodeStream codeStream, Assignment assignment, boolean valueRequired);
65
66 public abstract void generateCompoundAssignment(BlockScope currentScope, CodeStream codeStream, Expression expression, int operator, int assignmentImplicitConversion, boolean valueRequired);
67
68 public abstract void generatePostIncrement(BlockScope currentScope, CodeStream codeStream, CompoundAssignment postIncrement, boolean valueRequired);
69
70 }