A massive organize imports and formatting of the sources using default Eclipse code...
[phpeclipse.git] / net.sourceforge.phpeclipse / src / net / sourceforge / phpdt / internal / compiler / lookup / SyntheticArgumentBinding.java
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
7  * 
8  * Contributors:
9  *     IBM Corporation - initial API and implementation
10  *******************************************************************************/
11 package net.sourceforge.phpdt.internal.compiler.lookup;
12
13 import net.sourceforge.phpdt.core.compiler.CharOperation;
14
15 /**
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.
21  * 
22  * Such a synthetic argument binding will be inserted in all constructors of
23  * local innertypes before the user arguments.
24  */
25
26 public class SyntheticArgumentBinding extends LocalVariableBinding {
27
28         {
29                 this.isArgument = true;
30                 this.useFlag = USED;
31         }
32
33         // if the argument is mapping to an outer local variable, this denotes the
34         // outer actual variable
35         public LocalVariableBinding actualOuterLocalVariable;
36
37         // if the argument has a matching synthetic field
38         public FieldBinding matchingField;
39
40         final static char[] OuterLocalPrefix = { 'v', 'a', 'l', '$' };
41
42         final static char[] EnclosingInstancePrefix = { 't', 'h', 'i', 's', '$' };
43
44         public SyntheticArgumentBinding(
45                         LocalVariableBinding actualOuterLocalVariable) {
46
47                 super(CharOperation.concat(OuterLocalPrefix,
48                                 actualOuterLocalVariable.name), actualOuterLocalVariable.type,
49                                 AccFinal, true);
50                 this.actualOuterLocalVariable = actualOuterLocalVariable;
51         }
52
53         public SyntheticArgumentBinding(ReferenceBinding enclosingType) {
54
55                 super(CharOperation.concat(
56                                 SyntheticArgumentBinding.EnclosingInstancePrefix, String
57                                                 .valueOf(enclosingType.depth()).toCharArray()),
58                                 enclosingType, AccFinal, true);
59         }
60 }