a352f28785
All of our static evaluation & dead-code elimination transforms need to happen in post-order, transforming inner nodes first. This is so that in complex nested cases all transforms see the simplified version of their inner nodes. For example: async getNimbusExperimentData() { if (!PDFJSDev.test("GECKOVIEW")) { return null; } // other code } -> [evaluation of PDFJSDev.*] async getNimbusExperimentData() { if (!false) { return null; } // other code } -> [!false -> true] async getNimbusExperimentData() { if (true) { return null; } // other code } -> [if (true) -> replace with the if branch] async getNimbusExperimentData() { return null; // other code } -> [early return -> remove dead code] async getNimbusExperimentData() { return null; // other code } This was done correctly in all cases except for our `UnaryExpression` transform, which was happening in pre-order.
13 lines
525 B
JavaScript
13 lines
525 B
JavaScript
var a = typeof PDFJSDev === 'undefined';
|
|
var b = typeof PDFJSDev !== 'undefined';
|
|
var c = PDFJSDev.test('TRUE');
|
|
var d = PDFJSDev.test('FALSE');
|
|
var e = PDFJSDev.eval('TRUE');
|
|
var f = PDFJSDev.eval('TEXT');
|
|
var g = PDFJSDev.eval('OBJ');
|
|
var h = PDFJSDev.json('$ROOT/external/builder/fixtures_esprima/evals.json');
|
|
var i = typeof PDFJSDev === 'undefined' ? PDFJSDev.eval('FALSE') : '0';
|
|
var j = typeof PDFJSDev !== 'undefined' ? PDFJSDev.eval('OBJ.obj') : '0';
|
|
var k = !PDFJSDev.test('TRUE');
|
|
var l = !PDFJSDev.test('FALSE');
|