Skip to content

Commit e6c24ae

Browse files
committed
inlined constants fix
1 parent dd85fcf commit e6c24ae

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

src/compiler.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -8477,15 +8477,6 @@ export class Compiler extends DiagnosticEmitter {
84778477
if (localClosureContextOffset > 0) {
84788478
let contextLocal = assert(flow.lookupLocal(CommonNames.this_));
84798479

8480-
if (flow.isLocalFlag(local.index, LocalFlags.CONSTANT)) {
8481-
this.error(
8482-
DiagnosticCode.Not_implemented_0,
8483-
expression.range,
8484-
"Closed Over Constants"
8485-
);
8486-
return module.unreachable();
8487-
}
8488-
84898480
// TODO: replace this with a class field access, once we are able to construct the class before
84908481
// compiling
84918482
return module.load(

src/program.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,8 @@ import {
134134
} from "./resolver";
135135

136136
import {
137-
Flow
137+
Flow,
138+
LocalFlags
138139
} from "./flow";
139140

140141
import {
@@ -3575,6 +3576,10 @@ export class Function extends TypedElement {
35753576
}
35763577
if (parentResult.kind == ElementKind.LOCAL) {
35773578
let local = changetype<Local>(parentResult);
3579+
3580+
// We don't need to assign a closure offset for inlined values
3581+
if (local.is(CommonFlags.INLINED)) return local;
3582+
35783583
if (this.closedLocals.has(local.name)) return assert(this.closedLocals.get(local.name));
35793584
let mask = local.type.byteSize - 1;
35803585
let memoryOffset = this.nextGlobalClosureOffset;

0 commit comments

Comments
 (0)