misc changes
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / ast / Reference.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2001, 2002 International Business Machines Corp. and others.
3  * All rights reserved. This program and the accompanying materials 
4  * are made available under the terms of the Common Public License v0.5 
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/cpl-v05.html
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  ******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler.ast;
12
13 import net.sourceforge.phpdt.internal.compiler.codegen.*;
14 import net.sourceforge.phpdt.internal.compiler.flow.*;
15 import net.sourceforge.phpdt.internal.compiler.lookup.*;
16 import net.sourceforge.phpdt.internal.compiler.problem.*;
17 import net.sourceforge.phpdt.internal.compiler.util.Util;
18
19 public abstract class Reference extends Expression  {
20 /**
21  * BaseLevelReference constructor comment.
22  */
23 public Reference() {
24         super();
25 }
26 public FlowInfo analyseAssignment(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, Assignment assignment, boolean isCompound) {
27         throw new ShouldNotImplement(Util.bind("ast.variableShouldProvide")); //$NON-NLS-1$
28 }
29 public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
30         return flowInfo;
31 }
32 public FieldBinding fieldBinding() {
33         //this method should be sent one FIELD-tagged references
34         //  (ref.bits & BindingIds.FIELD != 0)()
35         return null ;
36 }
37 public void fieldStore(CodeStream codeStream, FieldBinding fieldBinding, MethodBinding syntheticWriteAccessor, boolean valueRequired) {
38
39         if (fieldBinding.isStatic()) {
40                 if (valueRequired) {
41                         if ((fieldBinding.type == LongBinding) || (fieldBinding.type == DoubleBinding)) {
42                                 codeStream.dup2();
43                         } else {
44                                 codeStream.dup();
45                         }
46                 }
47                 if (syntheticWriteAccessor == null) {
48                         codeStream.putstatic(fieldBinding);
49                 } else {
50                         codeStream.invokestatic(syntheticWriteAccessor);
51                 }
52         } else { // Stack:  [owner][new field value]  ---> [new field value][owner][new field value]
53                 if (valueRequired) {
54                         if ((fieldBinding.type == LongBinding) || (fieldBinding.type == DoubleBinding)) {
55                                 codeStream.dup2_x1();
56                         } else {
57                                 codeStream.dup_x1();
58                         }
59                 }
60                 if (syntheticWriteAccessor == null) {
61                         codeStream.putfield(fieldBinding);
62                 } else {
63                         codeStream.invokestatic(syntheticWriteAccessor);
64                 }
65         }
66 }
67 public void generateAssignment(BlockScope currentScope, CodeStream codeStream, Assignment assignment, boolean valueRequired) {
68         throw new ShouldNotImplement(Util.bind("ast.compoundPreShouldProvide")); //$NON-NLS-1$
69 }
70 public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeStream, Expression expression, int operator, int assignmentImplicitConversion, boolean valueRequired) {
71         throw new ShouldNotImplement(Util.bind("ast.compoundVariableShouldProvide")); //$NON-NLS-1$
72 }
73 public void generatePostIncrement(BlockScope currentScope, CodeStream codeStream, CompoundAssignment postIncrement, boolean valueRequired) {
74         throw new ShouldNotImplement(Util.bind("ast.postIncrShouldProvide")); //$NON-NLS-1$
75 }
76 }