1 29 30 package com.caucho.quercus.expr; 31 32 import com.caucho.quercus.program.FunctionInfo; 33 34 37 public class VarInfo { 38 private final FunctionInfo _function; 39 40 private final String _name; 41 42 private boolean _isGlobal; 43 private boolean _isArgument; 44 private boolean _isRefArgument; 45 private boolean _isAssigned; 46 47 private boolean _isReference; 49 50 private int _argumentIndex; 52 53 public VarInfo(String name, FunctionInfo function) 54 { 55 _name = name.intern(); 56 _function = function; 57 58 if (function != null && function.isPageMain()) { 59 _isReference = true; 60 } 61 } 62 63 66 public String getName() 67 { 68 return _name; 69 } 70 71 74 public FunctionInfo getFunction() 75 { 76 return _function; 77 } 78 79 82 public boolean isGlobal() 83 { 84 return _isGlobal; 85 } 86 87 90 public void setGlobal() 91 { 92 _isGlobal = true; 93 } 94 95 98 public boolean isVariable() 99 { 100 return _function != null && (_function.isUsesSymbolTable() || 102 _function.isVariableVar()); 103 } 104 105 108 public boolean isArgument() 109 { 110 return _isArgument; 111 } 112 113 116 public void setArgument(boolean isArgument) 117 { 118 _isArgument = isArgument; 119 } 120 121 124 public void setArgumentIndex(int index) 125 { 126 _argumentIndex = index; 127 } 128 129 132 public int getArgumentIndex() 133 { 134 return _argumentIndex; 135 } 136 137 140 public boolean isRefArgument() 141 { 142 return _isRefArgument; 143 } 144 145 148 public void setRefArgument() 149 { 150 _isRefArgument = true; 151 152 setReference(); 153 } 154 155 158 public boolean isAssigned() 159 { 160 return _isAssigned; 161 } 162 163 166 public void setAssigned() 167 { 168 _isAssigned = true; 169 170 if (isReference()) { 171 setModified(); 173 } 174 } 175 176 179 public boolean isValue() 180 { 181 return ! (_isArgument || _isReference || isGlobal() || isVariable()); 184 } 185 186 189 public boolean isReference() 190 { 191 return (_isReference || isGlobal() || isArgument() || isVariable()); 193 } 194 195 198 public void setReference() 199 { 200 _isReference = true; 201 202 if (_isAssigned) 203 setModified(); 204 } 205 206 210 public boolean isReadOnly() 211 { 212 return _function.isReadOnly(); 213 } 214 215 218 public void setModified() 219 { 220 _function.setModified(); 221 } 222 223 public String toString() 224 { 225 return "VarInfo[" + _name + "]"; 226 } 227 } 228 229 | Popular Tags |