37 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; |
37 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition; |
38 import com.sun.tools.javac.util.List; |
38 import com.sun.tools.javac.util.List; |
39 |
39 |
40 import com.sun.tools.javac.code.Symbol.*; |
40 import com.sun.tools.javac.code.Symbol.*; |
41 import com.sun.tools.javac.code.Symbol.OperatorSymbol.AccessCode; |
41 import com.sun.tools.javac.code.Symbol.OperatorSymbol.AccessCode; |
|
42 import com.sun.tools.javac.resources.CompilerProperties.Errors; |
42 import com.sun.tools.javac.tree.JCTree.*; |
43 import com.sun.tools.javac.tree.JCTree.*; |
43 import com.sun.tools.javac.code.Type.*; |
44 import com.sun.tools.javac.code.Type.*; |
44 |
45 |
45 import com.sun.tools.javac.jvm.Target; |
46 import com.sun.tools.javac.jvm.Target; |
46 import com.sun.tools.javac.tree.EndPosTable; |
47 import com.sun.tools.javac.tree.EndPosTable; |
1758 * @param c The qualifier class. |
1759 * @param c The qualifier class. |
1759 */ |
1760 */ |
1760 JCExpression makeOuterThis(DiagnosticPosition pos, TypeSymbol c) { |
1761 JCExpression makeOuterThis(DiagnosticPosition pos, TypeSymbol c) { |
1761 List<VarSymbol> ots = outerThisStack; |
1762 List<VarSymbol> ots = outerThisStack; |
1762 if (ots.isEmpty()) { |
1763 if (ots.isEmpty()) { |
1763 log.error(pos, "no.encl.instance.of.type.in.scope", c); |
1764 log.error(pos, Errors.NoEnclInstanceOfTypeInScope(c)); |
1764 Assert.error(); |
1765 Assert.error(); |
1765 return makeNull(); |
1766 return makeNull(); |
1766 } |
1767 } |
1767 VarSymbol ot = ots.head; |
1768 VarSymbol ot = ots.head; |
1768 JCExpression tree = access(make.at(pos).Ident(ot)); |
1769 JCExpression tree = access(make.at(pos).Ident(ot)); |
1769 TypeSymbol otc = ot.type.tsym; |
1770 TypeSymbol otc = ot.type.tsym; |
1770 while (otc != c) { |
1771 while (otc != c) { |
1771 do { |
1772 do { |
1772 ots = ots.tail; |
1773 ots = ots.tail; |
1773 if (ots.isEmpty()) { |
1774 if (ots.isEmpty()) { |
1774 log.error(pos, |
1775 log.error(pos, Errors.NoEnclInstanceOfTypeInScope(c)); |
1775 "no.encl.instance.of.type.in.scope", |
|
1776 c); |
|
1777 Assert.error(); // should have been caught in Attr |
1776 Assert.error(); // should have been caught in Attr |
1778 return tree; |
1777 return tree; |
1779 } |
1778 } |
1780 ot = ots.head; |
1779 ot = ots.head; |
1781 } while (ot.owner != otc); |
1780 } while (ot.owner != otc); |
1816 */ |
1815 */ |
1817 JCExpression makeOwnerThisN(DiagnosticPosition pos, Symbol sym, boolean preciseMatch) { |
1816 JCExpression makeOwnerThisN(DiagnosticPosition pos, Symbol sym, boolean preciseMatch) { |
1818 Symbol c = sym.owner; |
1817 Symbol c = sym.owner; |
1819 List<VarSymbol> ots = outerThisStack; |
1818 List<VarSymbol> ots = outerThisStack; |
1820 if (ots.isEmpty()) { |
1819 if (ots.isEmpty()) { |
1821 log.error(pos, "no.encl.instance.of.type.in.scope", c); |
1820 log.error(pos, Errors.NoEnclInstanceOfTypeInScope(c)); |
1822 Assert.error(); |
1821 Assert.error(); |
1823 return makeNull(); |
1822 return makeNull(); |
1824 } |
1823 } |
1825 VarSymbol ot = ots.head; |
1824 VarSymbol ot = ots.head; |
1826 JCExpression tree = access(make.at(pos).Ident(ot)); |
1825 JCExpression tree = access(make.at(pos).Ident(ot)); |
1827 TypeSymbol otc = ot.type.tsym; |
1826 TypeSymbol otc = ot.type.tsym; |
1828 while (!(preciseMatch ? sym.isMemberOf(otc, types) : otc.isSubClass(sym.owner, types))) { |
1827 while (!(preciseMatch ? sym.isMemberOf(otc, types) : otc.isSubClass(sym.owner, types))) { |
1829 do { |
1828 do { |
1830 ots = ots.tail; |
1829 ots = ots.tail; |
1831 if (ots.isEmpty()) { |
1830 if (ots.isEmpty()) { |
1832 log.error(pos, |
1831 log.error(pos, Errors.NoEnclInstanceOfTypeInScope(c)); |
1833 "no.encl.instance.of.type.in.scope", |
|
1834 c); |
|
1835 Assert.error(); |
1832 Assert.error(); |
1836 return tree; |
1833 return tree; |
1837 } |
1834 } |
1838 ot = ots.head; |
1835 ot = ots.head; |
1839 } while (ot.owner != otc); |
1836 } while (ot.owner != otc); |