Skip to content

Commit

Permalink
Update index.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
AjaniBilby committed Sep 21, 2023
1 parent 370d601 commit abf8ae5
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions source/compiler/codegen/expression/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,12 @@ function CompileBrackets(ctx: Context, syntax: Syntax.Term_Expr_brackets, expect
function CompileName(ctx: Context, syntax: Syntax.Term_Name, expect?: Intrinsic) {
const name = syntax.value[0].value;
const variable = ctx.scope.getVariable(name);
if (!variable) Yeet(`${colors.red("Error")}: Undeclared variable name ${name}\n`, {
path: ctx.file.path, name: ctx.file.name, ref: syntax.ref
});
if (!variable) {
// TODO: Attempt resolve function/type
Yeet(`${colors.red("Error")}: Undeclared variable ${name}\n`, {
path: ctx.file.path, name: ctx.file.name, ref: syntax.ref
});
}

if (!variable.isDefined) Yeet(`${colors.red("Error")}: Variable ${name} has no value assigned to it\n`, {
path: ctx.file.path, name: ctx.file.name, ref: syntax.ref
Expand Down

0 comments on commit abf8ae5

Please sign in to comment.