JSSpecCompiler: Parse enumerators in xspec mode

This commit is contained in:
Dan Klishch 2024-01-20 22:10:07 -05:00 committed by Andrew Kaster
parent 3d365326af
commit 990e30f458
Notes: sideshowbarker 2024-07-17 08:25:15 +09:00
13 changed files with 69 additions and 0 deletions

View file

@ -40,6 +40,16 @@ FunctionDeclarationRef TranslationUnit::find_declaration_by_name(StringView name
return it->value;
}
EnumeratorRef TranslationUnit::get_node_for_enumerator_value(StringView value)
{
if (auto it = m_enumerator_nodes.find(value); it != m_enumerator_nodes.end())
return it->value;
auto enumerator = NonnullRefPtr(NonnullRefPtr<Enumerator>::Adopt, *new Enumerator { {}, value });
m_enumerator_nodes.set(value, enumerator);
return enumerator;
}
FunctionDeclaration::FunctionDeclaration(StringView name, Vector<FunctionArgument>&& arguments)
: m_name(name)
, m_arguments(arguments)