mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-20 05:20:28 +00:00
Commit import _ changes
This commit is contained in:
@@ -4365,15 +4365,12 @@ void check_add_import_decl(CheckerContext *ctx, Ast *decl) {
|
||||
// import_name = scope->pkg->name;
|
||||
// }
|
||||
|
||||
if (import_name.len == 0 || is_blank_ident(import_name)) {
|
||||
if (id->import_name.string == "") {
|
||||
String invalid_name = id->fullpath;
|
||||
invalid_name = get_invalid_import_name(invalid_name);
|
||||
if (import_name.len == 0) {
|
||||
String invalid_name = id->fullpath;
|
||||
invalid_name = get_invalid_import_name(invalid_name);
|
||||
|
||||
error(id->token, "Import name %.*s, is not a valid identifier. Perhaps you want to reference the package by a different name like this: import <new_name> \"%.*s\" ", LIT(invalid_name), LIT(invalid_name));
|
||||
} else {
|
||||
error(token, "Import name, %.*s, cannot be use as an import name as it is not a valid identifier", LIT(id->import_name.string));
|
||||
}
|
||||
error(id->token, "Import name %.*s, is not a valid identifier. Perhaps you want to reference the package by a different name like this: import <new_name> \"%.*s\" ", LIT(invalid_name), LIT(invalid_name));
|
||||
error(token, "Import name, %.*s, cannot be use as an import name as it is not a valid identifier", LIT(id->import_name.string));
|
||||
} else {
|
||||
GB_ASSERT(id->import_name.pos.line != 0);
|
||||
id->import_name.string = import_name;
|
||||
|
||||
Reference in New Issue
Block a user