private void GenerateCodeForExpressionWithoutOperator(Expression expression)
{
System.Diagnostics.Trace.WriteLine(expression.ToString());
ScriptReader reader = new ScriptReader(expression, _source.LineNumber);
Token firstToken = reader.ReadNextToken();
Token memberName = null;
bool staticAccess = false;
if (firstToken.IsVariableType)
{
staticAccess = true;
}
else if (reader.NextIsKeyword(PredefinedSymbol.OpenSquareBracket))
{
Expression arrayIndex = ReadExpression(reader, true, PredefinedSymbol.CloseSquareBracket);
GenerateCodeForExpression(arrayIndex);
// TODO: Array access
}
if (reader.NextIsKeyword(PredefinedSymbol.Dot))
{
if ((firstToken.Type != TokenType.LocalVariable) &&
(firstToken.Type != TokenType.GlobalVariable) &&
(firstToken.Type != TokenType.StructType))
{
throw new CompilerMessage(ErrorCode.ParentIsNotAStruct, "'" + firstToken.Name + "' is not a struct");
}
memberName = reader.ReadNextToken();
// TODO: struct member stuff
if (staticAccess)
{
}
}
else if (staticAccess)
{
throw new CompilerMessage(ErrorCode.InvalidUseOfStruct, "Struct cannot be used in this way");
}
else
{
// TODO: just read the variable itself / execute the function
}
// TODO: Code this
}