src/share/classes/com/sun/tools/javac/comp/AttrContext.java

Thu, 02 Oct 2008 19:58:40 -0700

author
xdono
date
Thu, 02 Oct 2008 19:58:40 -0700
changeset 117
24a47c3062fe
parent 94
6542933af8f4
child 554
9d9f26857129
permissions
-rw-r--r--

6754988: Update copyright year
Summary: Update for files that have been modified starting July 2008
Reviewed-by: ohair, tbell

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

mercurial