Added getAllOf(Type) function

develop_before_lexer_parser_merge_parseName
Tristan B. V. Kildaire 2021-03-21 22:01:38 +02:00
parent f1d1f7d610
commit b04060af80
1 changed files with 16 additions and 0 deletions

View File

@ -341,6 +341,22 @@ public class Program
statements ~= statement;
}
public StatementType[] getAllOf(StatementType)(StatementType)
{
StatementType[] statementsMatched;
foreach(Statement statement; statements)
{
/* TODO: Remove null, this is for unimpemented */
if(statement !is null && typeid(statement) == typeid(StatementType))
{
statementsMatched ~= cast(StatementType)statement;
}
}
return statementsMatched;
}
public Variable[] getGlobals()
{
Variable[] variables;