author | jjg |
Wed, 21 Sep 2011 21:56:53 -0700 | |
changeset 10637 | 2ea5fbb913ac |
parent 5847 | 1908176fd6e3 |
child 12915 | 28cf1e0dafdc |
permissions | -rw-r--r-- |
10 | 1 |
/* |
5520 | 2 |
* Copyright (c) 1999, 2008, Oracle and/or its affiliates. All rights reserved. |
10 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5520 | 7 |
* published by the Free Software Foundation. Oracle designates this |
10 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5520 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
10 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5520 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
10 | 24 |
*/ |
25 |
||
26 |
package com.sun.tools.javac.comp; |
|
27 |
||
28 |
import com.sun.tools.javac.util.*; |
|
29 |
import com.sun.tools.javac.code.*; |
|
30 |
||
31 |
/** Contains information specific to the attribute and enter |
|
32 |
* passes, to be used in place of the generic field in environments. |
|
33 |
* |
|
5847
1908176fd6e3
6944312: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents:
5520
diff
changeset
|
34 |
* <p><b>This is NOT part of any supported API. |
1908176fd6e3
6944312: Potential rebranding issues in openjdk/langtools repository sources
jjg
parents:
5520
diff
changeset
|
35 |
* If you write code that depends on this, you do so at your own risk. |
10 | 36 |
* This code and its internal interfaces are subject to change or |
37 |
* deletion without notice.</b> |
|
38 |
*/ |
|
39 |
public class AttrContext { |
|
40 |
||
41 |
/** The scope of local symbols. |
|
42 |
*/ |
|
43 |
Scope scope = null; |
|
44 |
||
45 |
/** The number of enclosing `static' modifiers. |
|
46 |
*/ |
|
47 |
int staticLevel = 0; |
|
48 |
||
49 |
/** Is this an environment for a this(...) or super(...) call? |
|
50 |
*/ |
|
51 |
boolean isSelfCall = false; |
|
52 |
||
53 |
/** Are we evaluating the selector of a `super' or type name? |
|
54 |
*/ |
|
55 |
boolean selectSuper = false; |
|
56 |
||
57 |
/** Are arguments to current function applications boxed into an array for varargs? |
|
58 |
*/ |
|
59 |
boolean varArgs = false; |
|
60 |
||
61 |
/** A list of type variables that are all-quantifed in current context. |
|
62 |
*/ |
|
63 |
List<Type> tvars = List.nil(); |
|
64 |
||
65 |
/** A record of the lint/SuppressWarnings currently in effect |
|
66 |
*/ |
|
67 |
Lint lint; |
|
68 |
||
1045
56f6e84f7825
6676362: Spurious forward reference error with final var + instance variable initializer
mcimadamore
parents:
10
diff
changeset
|
69 |
/** The variable whose initializer is being attributed |
56f6e84f7825
6676362: Spurious forward reference error with final var + instance variable initializer
mcimadamore
parents:
10
diff
changeset
|
70 |
* useful for detecting self-references in variable initializers |
56f6e84f7825
6676362: Spurious forward reference error with final var + instance variable initializer
mcimadamore
parents:
10
diff
changeset
|
71 |
*/ |
56f6e84f7825
6676362: Spurious forward reference error with final var + instance variable initializer
mcimadamore
parents:
10
diff
changeset
|
72 |
Symbol enclVar = null; |
56f6e84f7825
6676362: Spurious forward reference error with final var + instance variable initializer
mcimadamore
parents:
10
diff
changeset
|
73 |
|
10 | 74 |
/** Duplicate this context, replacing scope field and copying all others. |
75 |
*/ |
|
76 |
AttrContext dup(Scope scope) { |
|
77 |
AttrContext info = new AttrContext(); |
|
78 |
info.scope = scope; |
|
79 |
info.staticLevel = staticLevel; |
|
80 |
info.isSelfCall = isSelfCall; |
|
81 |
info.selectSuper = selectSuper; |
|
82 |
info.varArgs = varArgs; |
|
83 |
info.tvars = tvars; |
|
84 |
info.lint = lint; |
|
1045
56f6e84f7825
6676362: Spurious forward reference error with final var + instance variable initializer
mcimadamore
parents:
10
diff
changeset
|
85 |
info.enclVar = enclVar; |
10 | 86 |
return info; |
87 |
} |
|
88 |
||
89 |
/** Duplicate this context, copying all fields. |
|
90 |
*/ |
|
91 |
AttrContext dup() { |
|
92 |
return dup(scope); |
|
93 |
} |
|
94 |
||
95 |
public Iterable<Symbol> getLocalElements() { |
|
96 |
if (scope == null) |
|
97 |
return List.nil(); |
|
98 |
return scope.getElements(); |
|
99 |
} |
|
100 |
||
101 |
public String toString() { |
|
102 |
return "AttrContext[" + scope.toString() + "]"; |
|
103 |
} |
|
104 |
} |