Gyoji Compiler
Loading...
Searching...
No Matches
type-resolver.hpp
1#pragma once
2
3#include <gyoji-mir.hpp>
4#include <gyoji-frontend.hpp>
5
7
22 public:
24 Gyoji::context::CompilerContext & _compiler_context,
25 const Gyoji::frontend::tree::TranslationUnit & _translation_unit,
26 Gyoji::mir::MIR & _mir);
34
41 void resolve();
42
51 private:
52 Gyoji::mir::MIR & mir;
53 Gyoji::context::CompilerContext & compiler_context;
54 const Gyoji::frontend::tree::TranslationUnit & translation_unit;
55
56 const Gyoji::mir::Type* extract_from_type_specifier_simple(const Gyoji::frontend::tree::TypeSpecifierSimple & type_specifier);
57 const Gyoji::mir::Type* extract_from_type_specifier_template(const Gyoji::frontend::tree::TypeSpecifierTemplate & type_specifier);
58 const Gyoji::mir::Type* extract_from_type_specifier_function_pointer(const Gyoji::frontend::tree::TypeSpecifierFunctionPointer & type_specifier);
59 const Gyoji::mir::Type* extract_from_type_specifier_pointer_to(const Gyoji::frontend::tree::TypeSpecifierPointerTo & type_specifier);
60 const Gyoji::mir::Type* extract_from_type_specifier_reference_to(const Gyoji::frontend::tree::TypeSpecifierReferenceTo & type_specifier);
61 const Gyoji::mir::Type* extract_from_type_specifier_array(const Gyoji::frontend::tree::TypeSpecifierArray & type_specifier);
62
63 void extract_from_class_declaration(const Gyoji::frontend::tree::ClassDeclaration & declaration);
64 void extract_from_class_members(Gyoji::mir::Type & type, const Gyoji::frontend::tree::ClassDefinition & definition);
65 void extract_from_class_definition(const Gyoji::frontend::tree::ClassDefinition & definition);
66 void extract_from_enum_definition(const Gyoji::frontend::tree::EnumDefinition & enum_definition);
67 void extract_from_type_definition(const Gyoji::frontend::tree::TypeDefinition & type_definition);
68 void extract_from_namespace(const Gyoji::frontend::tree::FileStatementNamespace & namespace_declaration);
69 void extract_types(const std::vector<Gyoji::owned<Gyoji::frontend::tree::FileStatement>> & statements);
70
71 void extract_from_function_specifications(
73 const Gyoji::frontend::tree::TypeSpecifier & type_specifier,
75 );
76
77 void extract_from_function_definition(const Gyoji::frontend::tree::FileStatementFunctionDefinition & function_definition);
78 void extract_from_function_declaration(const Gyoji::frontend::tree::FileStatementFunctionDeclaration & function_declaration);
79
80 Gyoji::mir::Type *get_or_create(
81 std::string pointer_name,
83 bool complete,
84 const Gyoji::context::SourceReference & source_ref
85 );
86
87 // Move to analysis
88 void check_complete_type(Gyoji::mir::Type *type) const;
89
90 };
91};
92
93
Compiler Context.
Definition gyoji-context.hpp:30
References a location in the source-file.
Definition source-reference.hpp:16
The TypeResolver is the lowering process for types. This function reads the result of a parse and pro...
Definition type-resolver.hpp:21
void resolve()
Definition type-resolver.cpp:22
~TypeResolver()
Move along, nothing to see here.
Definition type-resolver.cpp:19
const Gyoji::mir::Type * extract_from_type_specifier(const Gyoji::frontend::tree::TypeSpecifier &type_specifier)
Definition type-resolver.cpp:173
Represents the declaration of a function.
Definition tree.hpp:942
Represents the list of arguments to a function definition.
Definition tree.hpp:906
Represents tokens from the lexer used to represent keywords and identifiers found in the source.
Definition tree.hpp:89
Represents the top-level syntax unit for a source file.
Definition tree.hpp:2759
Represents a pointer to a function.
Definition tree.hpp:617
Represents an unsafe poniter to a specific type.
Definition tree.hpp:694
Represents a safe reference to a specific type.
Definition tree.hpp:785
Represents a simple type.
Definition tree.hpp:531
Represents a type with type-arguments modifying the type's definition.
Definition tree.hpp:581
Represents a type being specified.
Definition tree.hpp:848
The middle-tier intermediate representation (MIR) of a translation unit.
Definition gyoji-mir.hpp:57
This represents a type as declared in a translation unit.
Definition types.hpp:299
TypeType
Type of type.
Definition types.hpp:321
Converts the strongly-typed syntax tree into the MIR representation.
Definition function-resolver.hpp:23