private VariableResolveResult Node_Expr_Variable(XmlNode node)
{
var nameNode = node.GetSubNode(AstConstants.Subnode + ":" + AstConstants.Subnodes.Name);
if (nameNode.TryGetSubNode(AstConstants.Scalar + ":" + AstConstants.Scalars.String, out nameNode))
{
string varName = nameNode.InnerText;
Variable variable;
var localVariables = GetLocalScope(_scope);
if (_variableStorage.SuperGlobals.TryGetValue(varName, out variable) ||
localVariables.TryGetValue(varName, out variable) ||
_variableStorage.LocalAccessibleGlobals.TryGetValue(varName, out variable))
{
return new VariableResolveResult(variable);
}
var newVariable = new Variable(varName, variableScope);
localVariables.Add(varName, newVariable);
return new VariableResolveResult(newVariable, true);
}
// We do not support variable variables.
return new VariableResolveResult(new Variable("$UNKNOWN$", variableScope), true);
}