summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/class/bug1628719.js
blob: 76d3b976649ab257091f5a9c73bbc567f81874eb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
class BaseOne {
  static build() { return 'BaseOne'; }
}

class BaseTwo {
  static build() { return 'BaseTwo'; }
}

class ClassOne extends BaseOne {
  constructor() { super(); }
}

class ClassTwo extends BaseTwo {
  constructor() { super(); }
}

const ClassMap = { 1: ClassOne, 2: ClassTwo };
const TimeLine = [2,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,2];

function run() {
  for (var i = 0; i < TimeLine.length; ++i) {
    var j = TimeLine[i];
    var expected = j === 1 ? 'BaseOne' : 'BaseTwo';
    var actual = ClassMap[j].build();
    assertEq(actual, expected);
  }
}
run();