Skip to content

fix: instanceof in override function compile as unreachable #2661

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -559,25 +559,6 @@ export class Compiler extends DiagnosticEmitter {
}
} while (lazyFunctions.size);

// compile pending instanceof helpers
for (let _keys = Map_keys(this.pendingInstanceOf), i = 0, k = _keys.length; i < k; ++i) {
let elem = _keys[i];
let name = assert(this.pendingInstanceOf.get(elem));
switch (elem.kind) {
case ElementKind.Class:
case ElementKind.Interface: {
this.finalizeInstanceOf(<Class>elem, name);
break;
}
case ElementKind.ClassPrototype:
case ElementKind.InterfacePrototype: {
this.finalizeAnyInstanceOf(<ClassPrototype>elem, name);
break;
}
default: assert(false);
}
}

// set up override stubs
let functionTable = this.functionTable;
let overrideStubs = this.overrideStubs;
Expand Down Expand Up @@ -611,6 +592,25 @@ export class Compiler extends DiagnosticEmitter {
this.finalizeOverrideStub(_values[i]);
}

// compile pending instanceof helpers
for (let _keys = Map_keys(this.pendingInstanceOf), i = 0, k = _keys.length; i < k; ++i) {
let elem = _keys[i];
let name = assert(this.pendingInstanceOf.get(elem));
switch (elem.kind) {
case ElementKind.Class:
case ElementKind.Interface: {
this.finalizeInstanceOf(<Class>elem, name);
break;
}
case ElementKind.ClassPrototype:
case ElementKind.InterfacePrototype: {
this.finalizeAnyInstanceOf(<ClassPrototype>elem, name);
break;
}
default: assert(false);
}
}

// finalize runtime features
module.removeGlobal(BuiltinNames.rtti_base);
if (this.runtimeFeatures & RuntimeFeatures.Rtti) compileRTTI(this);
Expand Down
Loading