Skip to content

Instantly share code, notes, and snippets.

@gskachkov
Created November 10, 2015 20:05
Show Gist options
  • Save gskachkov/757c66582083a7e411a6 to your computer and use it in GitHub Desktop.
Save gskachkov/757c66582083a7e411a6 to your computer and use it in GitHub Desktop.
var testCase = function (actual, expected, message) {
if (actual !== expected) {
throw message + ". Expected '" + expected + "', but was '" + actual + "'";
}
};
var testValue = 'test-value';
var A = class A {
constructor() {
this.idValue = testValue;
}
};
var B = class B extends A {
constructor (beforeSuper) {
var arrow = () => eval('(() => this.idValue)()');
if (beforeSuper) {
var result = arrow();
super();
testCase(result, testValue, "Error: has to be TDZ error");
} else {
super();
let result= arrow();
testCase(result, testValue, "Error: super() should create this and put value into idValue property");
}
}
};
for (var i=0; i < 10000; i++) {
var b = new B(false);
}
// Fixme: Failed test with 'Segmentation fault: 11' error in release mode in 6 cases from 14. List of failed case:
No, it doesn't. I think it should be fixed in separate patch, because it looks like some bug in optimization, and I don't have enough skill to fix it because it appear in only in release mode and only in listed type of tests.
// dfg-maximal-flush-validate-no-cjit, ftl-no-cjit-no-inline-validate, ftl-no-cjit-no-put-stack-validate,
// ftl-no-cjit-small-pool, ftl-no-cjit-validate, no-cjit-validate-phases
/*
var testException = function (value1, index) {
var exception;
try {
new B(value1);
} catch (e) {
exception = e;
if (!(e instanceof ReferenceError))
throw "Exception thrown was not a reference error";
}
if (!exception)
throw "Exception not thrown for an unitialized this at iteration #" + index;
}
for (var i=0; i < 10000; i++) {
testException(true, i);
}/* */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment