View Javadoc

    1   /*
    2    * UnreferencedVariable.java created on 14.12.2005
    3    *
    4    * To change this generated comment go to
    5    * Window>Preferences>Java>Code Generation>Code and Comments
    6    */
    7   package org.codehaus.groovy.ast;
    8
    9   import org.codehaus.groovy.ast.expr.Expression;
    10
    11  public class DynamicVariable implements Variable {
    12
    13      private String name;
    14      private boolean closureShare = false;
    15      private boolean staticContext = false;
    16
    17      public DynamicVariable(String name, boolean context) {
    18          this.name = name;
    19          staticContext = context;
    20      }
    21
    22      public ClassNode getType() {
    23          return ClassHelper.DYNAMIC_TYPE;
    24      }
    25
    26      public String getName() {
    27          return name;
    28      }
    29
    30      public Expression getInitialExpression() {
    31          return null;
    32      }
    33
    34      public boolean hasInitialExpression() {
    35          return false;
    36      }
    37
    38      public boolean isInStaticContext() {
    39          return staticContext;
    40      }
    41
    42      public boolean isDynamicTyped() {
    43          return true;
    44      }
    45
    46      public boolean isClosureSharedVariable() {
    47          return closureShare;
    48      }
    49
    50      public void setClosureSharedVariable(boolean inClosure) {
    51          closureShare = inClosure;
    52      }
    53
    54  }