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.lookup;
13 import net.sourceforge.phpdt.core.compiler.CharOperation;
16 * Specific local variable location used to: - either provide emulation for
17 * outer local variables used from within innerclass constructs, - or provide
18 * emulation to enclosing instances. When it is mapping to an outer local
19 * variable, this actual outer local is accessible through the public field
20 * #actualOuterLocalVariable.
22 * Such a synthetic argument binding will be inserted in all constructors of
23 * local innertypes before the user arguments.
26 public class SyntheticArgumentBinding extends LocalVariableBinding {
29 this.isArgument = true;
33 // if the argument is mapping to an outer local variable, this denotes the
34 // outer actual variable
35 public LocalVariableBinding actualOuterLocalVariable;
37 // if the argument has a matching synthetic field
38 public FieldBinding matchingField;
40 final static char[] OuterLocalPrefix = { 'v', 'a', 'l', '$' };
42 final static char[] EnclosingInstancePrefix = { 't', 'h', 'i', 's', '$' };
44 public SyntheticArgumentBinding(
45 LocalVariableBinding actualOuterLocalVariable) {
47 super(CharOperation.concat(OuterLocalPrefix,
48 actualOuterLocalVariable.name), actualOuterLocalVariable.type,
50 this.actualOuterLocalVariable = actualOuterLocalVariable;
53 public SyntheticArgumentBinding(ReferenceBinding enclosingType) {
55 super(CharOperation.concat(
56 SyntheticArgumentBinding.EnclosingInstancePrefix, String
57 .valueOf(enclosingType.depth()).toCharArray()),
58 enclosingType, AccFinal, true);