Refactored variable- and constant- resolution.

This commit is contained in:
arookas 2015-12-27 23:41:37 -05:00
parent 61e0b220b4
commit 237c6f746f

View file

@ -211,27 +211,11 @@ namespace arookas
} }
public sunVariableSymbol ResolveVariable(sunIdentifier node) public sunVariableSymbol ResolveVariable(sunIdentifier node)
{ {
for (int i = Scopes.Count - 1; i >= 0; --i) return ResolveStorable(node) as sunVariableSymbol;
{
var symbol = Scopes[i].ResolveVariable(node.Value);
if (symbol != null)
{
return symbol;
}
}
return null;
} }
public sunConstantSymbol ResolveConstant(sunIdentifier node) public sunConstantSymbol ResolveConstant(sunIdentifier node)
{ {
for (int i = Scopes.Count - 1; i >= 0; --i) return ResolveStorable(node) as sunConstantSymbol;
{
var symbol = Scopes[i].ResolveConstant(node.Value);
if (symbol != null)
{
return symbol;
}
}
return null;
} }
public sunStorableSymbol MustResolveStorable(sunIdentifier node) public sunStorableSymbol MustResolveStorable(sunIdentifier node)
{ {