Refactored declaration code.

This commit is contained in:
arookas 2015-12-28 01:22:54 -05:00
parent fd21da0982
commit de28ee84f9

View file

@ -57,21 +57,11 @@ namespace arookas
} }
sunVariableSymbol DeclareGlobal(string name) sunVariableSymbol DeclareGlobal(string name)
{ {
var variableInfo = Top.DeclareVariable(name, 0, GlobalCount); return Top.DeclareVariable(name, 0, GlobalCount);
if (variableInfo == null)
{
return null;
}
return variableInfo;
} }
sunVariableSymbol DeclareLocal(string name) sunVariableSymbol DeclareLocal(string name)
{ {
var variableInfo = Top.DeclareVariable(name, 1, LocalCount); return Top.DeclareVariable(name, 1, LocalCount);
if (variableInfo == null)
{
return null;
}
return variableInfo;
} }
public IEnumerator<sunScope> GetEnumerator() { return Stack.GetEnumerator(); } public IEnumerator<sunScope> GetEnumerator() { return Stack.GetEnumerator(); }