mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:57:35 +00:00
JSSpecCompiler: Make TranslationUnit fields private
For some reason I was afraid to add trivial accessors to classes in earlier PRs, so we now have dozens of classes with public fields. I'm not exactly looking forward to refactoring them all at once but I'll do so gradually.
This commit is contained in:
parent
a2f7849238
commit
3aec6952a2
8 changed files with 46 additions and 24 deletions
|
@ -15,14 +15,24 @@
|
|||
|
||||
namespace JSSpecCompiler {
|
||||
|
||||
struct TranslationUnit {
|
||||
class TranslationUnit {
|
||||
public:
|
||||
TranslationUnit(StringView filename);
|
||||
~TranslationUnit();
|
||||
|
||||
void adopt_declaration(NonnullRefPtr<FunctionDeclaration>&& declaration);
|
||||
FunctionDefinitionRef adopt_function(NonnullRefPtr<FunctionDefinition>&& definition);
|
||||
|
||||
StringView filename;
|
||||
Vector<FunctionDefinitionRef> functions_to_compile;
|
||||
Vector<NonnullRefPtr<FunctionDeclaration>> declarations_owner;
|
||||
HashMap<StringView, FunctionDeclarationRef> function_index;
|
||||
FunctionDeclarationRef find_declaration_by_name(StringView name) const;
|
||||
|
||||
StringView filename() const { return m_filename; }
|
||||
Vector<FunctionDefinitionRef> functions_to_compile() const { return m_functions_to_compile; }
|
||||
|
||||
private:
|
||||
StringView m_filename;
|
||||
Vector<FunctionDefinitionRef> m_functions_to_compile;
|
||||
Vector<NonnullRefPtr<FunctionDeclaration>> m_declarations_owner;
|
||||
HashMap<StringView, FunctionDeclarationRef> m_function_index;
|
||||
};
|
||||
|
||||
class FunctionDeclaration : public RefCounted<FunctionDeclaration> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue