Skip to content

Commit 72d0fe6

Browse files
authored
Clean up resolver API (#703)
1 parent 4784cf4 commit 72d0fe6

File tree

3 files changed

+486
-472
lines changed

3 files changed

+486
-472
lines changed

src/builtins.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -637,7 +637,7 @@ export function compileCall(
637637
let element = compiler.resolver.resolveExpression(
638638
operands[0],
639639
compiler.currentFlow,
640-
Type.void,
640+
Type.auto,
641641
ReportMode.SWALLOW
642642
);
643643
return module.i32(element ? 1 : 0);

src/compiler.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ export class Compiler extends DiagnosticEmitter {
271271
/** Program reference. */
272272
program: Program;
273273
/** Resolver reference. */
274-
resolver: Resolver;
274+
get resolver(): Resolver { return this.program.resolver; }
275275
/** Provided options. */
276276
options: Options;
277277
/** Module instance being compiled. */
@@ -312,7 +312,6 @@ export class Compiler extends DiagnosticEmitter {
312312
constructor(program: Program, options: Options | null = null) {
313313
super(program.diagnostics);
314314
this.program = program;
315-
this.resolver = program.resolver;
316315
if (!options) options = new Options();
317316
this.options = options;
318317
this.memoryOffset = i64_new(
@@ -456,6 +455,8 @@ export class Compiler extends DiagnosticEmitter {
456455
return module;
457456
}
458457

458+
// === Exports ==================================================================================
459+
459460
/** Applies the respective module exports for the specified file. */
460461
private ensureModuleExports(file: File): void {
461462
var members = file.exports;
@@ -5079,7 +5080,7 @@ export class Compiler extends DiagnosticEmitter {
50795080
}
50805081
if (!compound) return expr;
50815082
var resolver = this.resolver;
5082-
var target = this.resolver.resolveExpression(left, this.currentFlow);
5083+
var target = resolver.resolveExpression(left, this.currentFlow);
50835084
if (!target) return module.unreachable();
50845085
return this.makeAssignment(
50855086
target,

0 commit comments

Comments
 (0)