Skip to content

Commit

Permalink
fix worker cornercase during uglifying
Browse files Browse the repository at this point in the history
  • Loading branch information
sgratzl committed Dec 25, 2018
1 parent e5bf781 commit 4b0e69e
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/internal/math.ts
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,9 @@ export function categoricalValueCache2Value<T extends {name: string}>(v: number,
}


function sortWorkerMain(self: IPoorManWorkerScope) {
function sortWorkerMain() {
const wself = <IPoorManWorkerScope><unknown>self;

// stored refs to avoid duplicate copy
const refs = new Map<string, UIntTypedArray | Float32Array | Int32Array | Float64Array>();

Expand All @@ -959,7 +961,7 @@ function sortWorkerMain(self: IPoorManWorkerScope) {
}
const order = r.indices;

self.postMessage(<ISortMessageResponse>{
wself.postMessage(<ISortMessageResponse>{
type: r.type,
uid: r.uid,
ref: r.ref,
Expand Down Expand Up @@ -1018,7 +1020,7 @@ function sortWorkerMain(self: IPoorManWorkerScope) {
b.push(dateValueCache2Value(data[i]));
}
}
self.postMessage(<IDateStatsMessageResponse>{
wself.postMessage(<IDateStatsMessageResponse>{
type: r.type,
uid: r.uid,
stats: b.build()
Expand All @@ -1042,7 +1044,7 @@ function sortWorkerMain(self: IPoorManWorkerScope) {
}
}

self.postMessage(<ICategoricalStatsMessageResponse>{
wself.postMessage(<ICategoricalStatsMessageResponse>{
type: r.type,
uid: r.uid,
stats: b.build()
Expand All @@ -1066,7 +1068,7 @@ function sortWorkerMain(self: IPoorManWorkerScope) {
}
}

self.postMessage(<INumberStatsMessageResponse>{
wself.postMessage(<INumberStatsMessageResponse>{
type: r.type,
uid: r.uid,
stats: b.build()
Expand All @@ -1089,7 +1091,7 @@ function sortWorkerMain(self: IPoorManWorkerScope) {
stats = b.build();
}

self.postMessage(<IBoxPlotStatsMessageResponse>{
wself.postMessage(<IBoxPlotStatsMessageResponse>{
type: r.type,
uid: r.uid,
stats
Expand All @@ -1107,7 +1109,7 @@ function sortWorkerMain(self: IPoorManWorkerScope) {
boxplotStats
};

self.addEventListener('message', (evt) => {
wself.addEventListener('message', (evt) => {
const r = evt.data;
if (typeof r.uid !== 'number' || typeof r.type !== 'string') {
return;
Expand Down

0 comments on commit 4b0e69e

Please sign in to comment.