aboutsummaryrefslogtreecommitdiff
path: root/src/checker.cpp
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2022-05-15 16:37:05 +0100
committergingerBill <bill@gingerbill.org>2022-05-15 16:37:05 +0100
commit23cb96de022f91e1798f73b920f972845081b370 (patch)
treec80c5bda06d2635a699f214c4d97b69496723354 /src/checker.cpp
parenta2c771876ed66498225c30d8bdbabf763fe671e6 (diff)
Commit `import _` changes
Diffstat (limited to 'src/checker.cpp')
-rw-r--r--src/checker.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src/checker.cpp b/src/checker.cpp
index da9a97622..8afc6eb14 100644
--- a/src/checker.cpp
+++ b/src/checker.cpp
@@ -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;