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
9 * IBM Corporation - initial API and implementation
10 ******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler.ast;
13 import net.sourceforge.phpdt.internal.compiler.codegen.CodeStream;
14 import net.sourceforge.phpdt.internal.compiler.flow.FlowContext;
15 import net.sourceforge.phpdt.internal.compiler.flow.FlowInfo;
16 import net.sourceforge.phpdt.internal.compiler.lookup.BlockScope;
17 import net.sourceforge.phpdt.internal.compiler.lookup.FieldBinding;
18 import net.sourceforge.phpdt.internal.compiler.lookup.MethodBinding;
19 import net.sourceforge.phpdt.internal.compiler.problem.ShouldNotImplement;
20 import net.sourceforge.phpdt.internal.compiler.util.Util;
22 public abstract class Reference extends Expression {
24 * BaseLevelReference constructor comment.
29 public FlowInfo analyseAssignment(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo, Assignment assignment, boolean isCompound) {
30 throw new ShouldNotImplement(Util.bind("ast.variableShouldProvide")); //$NON-NLS-1$
32 public FlowInfo analyseCode(BlockScope currentScope, FlowContext flowContext, FlowInfo flowInfo) {
35 public FieldBinding fieldBinding() {
36 //this method should be sent one FIELD-tagged references
37 // (ref.bits & BindingIds.FIELD != 0)()
40 public void fieldStore(CodeStream codeStream, FieldBinding fieldBinding, MethodBinding syntheticWriteAccessor, boolean valueRequired) {
42 if (fieldBinding.isStatic()) {
44 if ((fieldBinding.type == LongBinding) || (fieldBinding.type == DoubleBinding)) {
50 if (syntheticWriteAccessor == null) {
51 codeStream.putstatic(fieldBinding);
53 codeStream.invokestatic(syntheticWriteAccessor);
55 } else { // Stack: [owner][new field value] ---> [new field value][owner][new field value]
57 if ((fieldBinding.type == LongBinding) || (fieldBinding.type == DoubleBinding)) {
63 if (syntheticWriteAccessor == null) {
64 codeStream.putfield(fieldBinding);
66 codeStream.invokestatic(syntheticWriteAccessor);
70 public void generateAssignment(BlockScope currentScope, CodeStream codeStream, Assignment assignment, boolean valueRequired) {
71 throw new ShouldNotImplement(Util.bind("ast.compoundPreShouldProvide")); //$NON-NLS-1$
73 public void generateCompoundAssignment(BlockScope currentScope, CodeStream codeStream, Expression expression, int operator, int assignmentImplicitConversion, boolean valueRequired) {
74 throw new ShouldNotImplement(Util.bind("ast.compoundVariableShouldProvide")); //$NON-NLS-1$
76 public void generatePostIncrement(BlockScope currentScope, CodeStream codeStream, CompoundAssignment postIncrement, boolean valueRequired) {
77 throw new ShouldNotImplement(Util.bind("ast.postIncrShouldProvide")); //$NON-NLS-1$