removed Makefile; lifted repo/org.ibex.tool/src/ to src/
[org.ibex.tool.git] / src / org / eclipse / jdt / internal / compiler / lookup / SyntheticArgumentBinding.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.lookup;
12
13 /**
14  * Specific local variable location used to:
15  * - either provide emulation for outer local variables used from within innerclass constructs,
16  * - or provide emulation to enclosing instances. 
17  * When it is mapping to an outer local variable, this actual outer local is accessible through 
18  * the public field #actualOuterLocalVariable.
19  *
20  * Such a synthetic argument binding will be inserted in all constructors of local innertypes before
21  * the user arguments.
22  */
23
24 import org.eclipse.jdt.core.compiler.CharOperation;
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 outer actual variable
34         public LocalVariableBinding actualOuterLocalVariable;
35         // if the argument has a matching synthetic field
36         public FieldBinding matchingField;
37
38         final static char[] OuterLocalPrefix = { 'v', 'a', 'l', '$' };
39         final static char[] EnclosingInstancePrefix = { 't', 'h', 'i', 's', '$' };
40         
41         public SyntheticArgumentBinding(LocalVariableBinding actualOuterLocalVariable) {
42
43                 super(
44                         CharOperation.concat(OuterLocalPrefix, actualOuterLocalVariable.name), 
45                         actualOuterLocalVariable.type, 
46                         AccFinal,
47                         true);
48                 this.actualOuterLocalVariable = actualOuterLocalVariable;
49         }
50
51         public SyntheticArgumentBinding(ReferenceBinding enclosingType) {
52
53                 super(
54                         CharOperation.concat(
55                                 SyntheticArgumentBinding.EnclosingInstancePrefix,
56                                 String.valueOf(enclosingType.depth()).toCharArray()),
57                         enclosingType, 
58                         AccFinal,
59                         true);
60         }
61 }