mirror of
https://codeberg.org/ProgramSnail/lang.git
synced 2025-12-25 08:18:45 +00:00
utils functions, expect, ensure, error handling refactoring (string -> string_view), std::source_location
This commit is contained in:
parent
5afbaf06ae
commit
d6a3ce1946
7 changed files with 149 additions and 29 deletions
|
|
@ -381,6 +381,7 @@ nodes::TypeCheckResult type_check_return(const nodes::Return &expression,
|
|||
arguments, expression, sources_manager);
|
||||
}
|
||||
|
||||
// TODO: warning if name is same to package prefix, function prefix, etc. ??
|
||||
nodes::TypeCheckResult
|
||||
type_check_name_definition(const nodes::NameDefinition &expression,
|
||||
SourcesManager &sources_manager, State &state,
|
||||
|
|
@ -541,13 +542,17 @@ type_check_name_expression(const nodes::NameExpression &expression,
|
|||
const Arguments &arguments) {
|
||||
// TODO: constraints ??
|
||||
|
||||
const auto name = expression.get_name();
|
||||
for (size_t i = 0; i < /*fragments_count*/; ++i) { // go in prefixes and try to find matching var name
|
||||
}
|
||||
|
||||
// --- TODO --- deal with passed type --- TODO --- (additional argument)
|
||||
// TODO: deal with given ->(out) Args (type not expected, but passed into)
|
||||
|
||||
// TODO: check, if there is variable with this name
|
||||
// TODO: check var + fields
|
||||
const auto maybe_function_definition = find_name_definition_handle_errors(
|
||||
*expression.get_name()->get(), expression, sources_manager);
|
||||
*name->get(), expression, sources_manager);
|
||||
if (!maybe_function_definition.has_value()) {
|
||||
return nodes::TypeCheckResult::construct_invalid_result();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ namespace printers {
|
|||
|
||||
// TODO: better printing format for builtin types
|
||||
void print_type(const nodes::Type &type, printers::Printer &printer) {
|
||||
if (type.get_annotation().has_value()) {
|
||||
if (type.has_annotation()) {
|
||||
print_annotation(*type.get_annotation().value(), printer);
|
||||
printer.space();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue