Skip to content

Commit 684fca5

Browse files
committed
Improve error message (#393)
1 parent 9964c7b commit 684fca5

File tree

2 files changed

+4
-21
lines changed

2 files changed

+4
-21
lines changed

playground/umka.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/umka_decl.c

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -215,39 +215,22 @@ static void parseSignature(Umka *umka, Signature *sig)
215215

216216
static const Type *parseTypeOrForwardType(Umka *umka)
217217
{
218-
const Type *type = NULL;
219-
220218
// Forward declaration?
221-
bool forward = false;
222219
if (umka->types.forwardTypesEnabled && umka->lex.tok.kind == TOK_IDENT)
223220
{
224-
const Ident *ident = NULL;
225-
226221
Lexer lookaheadLex = umka->lex;
227222
lexNext(&lookaheadLex);
228-
if (lookaheadLex.tok.kind == TOK_COLONCOLON)
229-
ident = identFindModule(&umka->idents, &umka->modules, &umka->blocks, umka->blocks.module, umka->lex.tok.name, true);
230-
else
231-
ident = identFind(&umka->idents, &umka->modules, &umka->blocks, umka->blocks.module, umka->lex.tok.name, NULL, true);
232-
233-
if (!ident)
223+
if (lookaheadLex.tok.kind != TOK_COLONCOLON && !identFind(&umka->idents, &umka->modules, &umka->blocks, umka->blocks.module, umka->lex.tok.name, NULL, true))
234224
{
235225
Type *forwardType = typeAdd(&umka->types, &umka->blocks, TYPE_FORWARD);
236226
forwardType->typeIdent = identAddType(&umka->idents, &umka->modules, &umka->blocks, umka->lex.tok.name, forwardType, false);
237227
identSetUsed(forwardType->typeIdent);
238-
239228
lexNext(&umka->lex);
240-
241-
type = forwardType;
242-
forward = true;
229+
return forwardType;
243230
}
244231
}
245232

246-
// Conventional declaration
247-
if (!forward)
248-
type = parseType(umka, NULL);
249-
250-
return type;
233+
return parseType(umka, NULL);
251234
}
252235

253236

0 commit comments

Comments
 (0)