Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Gusarich committed Apr 2, 2024
1 parent 69836f7 commit a884f72
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/types/resolveExpression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ export function resolveConditional(ast: ASTConditional, sctx: StatementContext,

export function resolveLValueRef(path: ASTLvalueRef[], sctx: StatementContext, ctx: CompilerContext): CompilerContext {
const paths: ASTLvalueRef[] = path;
let t = sctx.vars[paths[0].name];
let t = sctx.vars.get(paths[0].name);
if (!t) {
throwError(`Variable "${paths[0].name}" not found`, paths[0].ref);
}
Expand Down Expand Up @@ -487,7 +487,7 @@ export function resolveExpression(exp: ASTExpression, sctx: StatementContext, ct
if (exp.kind === 'id') {

// Find variable
const v = sctx.vars[exp.value];
const v = sctx.vars.get(exp.value);
if (!v) {
if (!hasStaticConstant(ctx, exp.value)) {
throwError('Unable to resolve id ' + exp.value, exp.ref);
Expand Down
7 changes: 2 additions & 5 deletions src/types/resolveStatements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,8 @@ function addVariable(name: string, ref: TypeRef, src: StatementContext): Stateme
}
return {
...src,
vars: new Map({
...src.vars,
[name]: ref
})
};
vars: new Map(src.vars).set(name, ref)
}
}

function processCondition(condition: ASTCondition, sctx: StatementContext, ctx: CompilerContext): { ctx: CompilerContext, sctx: StatementContext } {
Expand Down

0 comments on commit a884f72

Please sign in to comment.