diff options
| author | Eugen Wissner <belka@caraus.de> | 2026-07-07 21:39:57 +0200 |
|---|---|---|
| committer | Eugen Wissner <belka@caraus.de> | 2026-07-07 21:39:57 +0200 |
| commit | 79521d91b2bb85652fd29f5c44279338d55c757f (patch) | |
| tree | d3b5b73177f63fd5ff684a8aba6f7b9af84dab27 /include | |
| parent | 470bfba45661d19558c0bf43b7819696a925ecb4 (diff) | |
| download | elna-79521d91b2bb85652fd29f5c44279338d55c757f.tar.gz | |
Allow multiple parameters with same type
Diffstat (limited to 'include')
| -rw-r--r-- | include/elna/boot/ast.h | 7 | ||||
| -rw-r--r-- | include/elna/boot/semantic.h | 13 |
2 files changed, 7 insertions, 13 deletions
diff --git a/include/elna/boot/ast.h b/include/elna/boot/ast.h index 03d3e27..b9414f0 100644 --- a/include/elna/boot/ast.h +++ b/include/elna/boot/ast.h @@ -381,9 +381,11 @@ namespace elna::boot using return_t = return_declaration<type_expression *>; const return_t return_type; - std::vector<type_expression *> parameters; + const std::vector<std::pair<std::vector<std::string>, std::shared_ptr<type_expression>>> parameters; - procedure_type_expression(const struct position position, return_t return_type = return_t()); + procedure_type_expression(const struct position position, + std::vector<std::pair<std::vector<std::string>, std::shared_ptr<type_expression>>>&& parameters, + return_t return_type = return_t()); ~procedure_type_expression(); void accept(parser_visitor *visitor) override; @@ -423,7 +425,6 @@ namespace elna::boot public: std::optional<block> body; - std::vector<std::string> parameter_names; procedure_declaration(const struct position position, identifier_definition identifier, procedure_type_expression *heading, block&& body); diff --git a/include/elna/boot/semantic.h b/include/elna/boot/semantic.h index 97286f0..a0a4a73 100644 --- a/include/elna/boot/semantic.h +++ b/include/elna/boot/semantic.h @@ -78,14 +78,6 @@ namespace elna::boot std::string what() const override; }; - class variable_initializer_error : public error - { - public: - variable_initializer_error(const struct position position); - - std::string what() const override; - }; - /** * Checks types. */ @@ -125,7 +117,8 @@ namespace elna::boot symbol_bag bag; - procedure_type build_procedure(procedure_type_expression& type_expression); + std::pair<procedure_type, std::vector<std::string>> build_procedure( + procedure_type_expression& type_expression); std::vector<type_field> build_composite_type(const std::vector<field_declaration>& fields); std::shared_ptr<variable_info> register_variable(const std::string& name, const bool is_extern, const struct position position); @@ -187,7 +180,7 @@ namespace elna::boot void visit(import_declaration *) override; void visit(unit *unit) override; void visit(type_declaration *definition) override; - void visit(variable_declaration *declaration) override; + void visit(variable_declaration *) override; void visit(procedure_declaration *definition) override; }; } |
