001 /* 002 * UnreferencedVariable.java created on 14.12.2005 003 * 004 * To change this generated comment go to 005 * Window>Preferences>Java>Code Generation>Code and Comments 006 */ 007 package org.codehaus.groovy.ast; 008 009 import org.codehaus.groovy.ast.expr.Expression; 010 011 public class DynamicVariable implements Variable { 012 013 private String name; 014 private boolean closureShare = false; 015 private boolean staticContext = false; 016 017 public DynamicVariable(String name, boolean context) { 018 this.name = name; 019 staticContext = context; 020 } 021 022 public ClassNode getType() { 023 return ClassHelper.DYNAMIC_TYPE; 024 } 025 026 public String getName() { 027 return name; 028 } 029 030 public Expression getInitialExpression() { 031 return null; 032 } 033 034 public boolean hasInitialExpression() { 035 return false; 036 } 037 038 public boolean isInStaticContext() { 039 return staticContext; 040 } 041 042 public boolean isDynamicTyped() { 043 return true; 044 } 045 046 public boolean isClosureSharedVariable() { 047 return closureShare; 048 } 049 050 public void setClosureSharedVariable(boolean inClosure) { 051 closureShare = inClosure; 052 } 053 054 }