Run Prettier for serializer tests too (#2234)

Summary:
Follow-up to https://github.com/facebook/prepack/pull/2212.
Pull Request resolved: https://github.com/facebook/prepack/pull/2234

Differential Revision: D8788834

Pulled By: gaearon

fbshipit-source-id: 08937736bed3df0ea13d5e7a3925fb2f58633d5c
This commit is contained in:
Dan Abramov 2018-07-11 03:52:56 -07:00 committed by Facebook Github Bot
parent 8f3ce551f8
commit ec37b77b6e
832 changed files with 5898 additions and 3958 deletions

View File

@ -31,7 +31,8 @@ const config = {
patterns: ["scripts/**/*.js"], patterns: ["scripts/**/*.js"],
}, },
jest: { jest: {
patterns: ["test/react/**/*.js"], patterns: ["test/**/*.js"],
ignore: ["test/**/syntaxError.js"],
}, },
}; };

View File

@ -1,11 +1,11 @@
// expected errors: [{"location":{"start":{"line":7,"column":16},"end":{"line":7,"column":18},"source":"test/error-handler/FinalObjectCannotBeMutated.js"},"severity":"FatalError","errorCode":"PP0026","callStack":"Error\n "}] // expected errors: [{"location":{"start":{"line":7,"column":12},"end":{"line":7,"column":14},"source":"test/error-handler/FinalObjectCannotBeMutated.js"},"severity":"FatalError","errorCode":"PP0026","callStack":"Error\n "}]
(function () { (function() {
function f() { function f() {
let o = {}; let o = {};
o.foo = 23; o.foo = 23;
__makeFinal(o); __makeFinal(o);
o.foo = 42; // <-- error expected here o.foo = 42; // <-- error expected here
} }
__optimize(f); __optimize(f);
global.inspect = f; global.inspect = f;
})(); })();

View File

@ -1,13 +1,19 @@
// expected errors: [{"severity":"Warning","errorCode":"PP1007","callStack":"Error\n "},{"location":{"start":{"line":5,"column":16},"end":{"line":5,"column":18},"source":"test/error-handler/ModifiedObjectPropertyLimitation.js"},"severity":"Warning","errorCode":"PP0023","callStack":"Error\n "},{"location":{"start":{"line":5,"column":16},"end":{"line":5,"column":18},"source":"test/error-handler/ModifiedObjectPropertyLimitation.js"},"severity":"FatalError","errorCode":"PP1006","callStack":"Error\n "}] // expected errors: [{"severity":"Warning","errorCode":"PP1007","callStack":"Error\n "},{"location":{"start":{"line":5,"column":12},"end":{"line":5,"column":14},"source":"test/error-handler/ModifiedObjectPropertyLimitation.js"},"severity":"Warning","errorCode":"PP0023","callStack":"Error\n "},{"location":{"start":{"line":5,"column":12},"end":{"line":5,"column":14},"source":"test/error-handler/ModifiedObjectPropertyLimitation.js"},"severity":"FatalError","errorCode":"PP1006","callStack":"Error\n "}]
(function () { (function() {
let p = {}; let p = {};
function f(c) { function f(c) {
let o = {}; let o = {};
if (c) { if (c) {
o.__proto__ = p; o.__proto__ = p;
throw o; throw o;
}
} }
if (global.__optimize) __optimize(f); }
inspect = function() { try { f(true); } catch (e) { return e.$Prototype === p; } } if (global.__optimize) __optimize(f);
inspect = function() {
try {
f(true);
} catch (e) {
return e.$Prototype === p;
}
};
})(); })();

View File

@ -1,7 +1,9 @@
// jsc // jsc
// recover-from-errors // recover-from-errors
// expected errors: [{"location":{"start":{"line":5,"column":22},"end":{"line":5,"column":25},"source":"test/error-handler/Set.js"},"severity":"RecoverableError","errorCode":"PP0001"}] // expected errors: [{"location":{"start":{"line":5,"column":22},"end":{"line":5,"column":25},"source":"test/error-handler/Set.js"},"severity":"RecoverableError","errorCode":"PP0001"}]
let s = new Set(["a", "a"]); let s = new Set(["a", "a"]);
inspect = function() { return s.size === 1; } inspect = function() {
return s.size === 1;
};

View File

@ -1,4 +1,4 @@
// expected errors: [{"location": {"start":{"line":4,"column":0},"end":{"line":4,"column":27},"source":"test/error-handler/abstract-value-check-dup-name-string.js"},"severity":"FatalError","errorCode":"PP0019","message":"An abstract value with the same name exists"}] // expected errors: [{"location": {"start":{"line":4,"column":0},"end":{"line":4,"column":27},"source":"test/error-handler/abstract-value-check-dup-name-string.js"},"severity":"FatalError","errorCode":"PP0019","message":"An abstract value with the same name exists"}]
__abstract('number', 'foo'); __abstract("number", "foo");
__abstract('number', 'foo'); __abstract("number", "foo");

View File

@ -21,4 +21,4 @@ inspect = function() {
additional2(); additional2();
additional1(); additional1();
return global.a; return global.a;
} };

View File

@ -1,9 +1,13 @@
// recover-from-errors // recover-from-errors
// expected errors: [{location: {"start":{"line":11,"column":12},"end":{"line":11,"column":13},"identifierName":"y","source":"test/error-handler/binaryExpression.js"}, errorCode: "PP0002", severity: "RecoverableError", message: "might be an object with an unknown valueOf or toString or Symbol.toPrimitive method"},{location: {"start":{"line":12,"column":6},"end":{"line":12,"column":7},"identifierName":"y","source":"test/error-handler/binaryExpression.js"}, errorCode: "PP0002", severity: "RecoverableError", message: "might be an object with an unknown valueOf or toString or Symbol.toPrimitive method"}, {"location":{"start":{"line":17,"column":5},"end":{"line":17,"column":6},"identifierName":"y","source":"test/error-handler/binaryExpression.js"},"severity":"RecoverableError","errorCode":"PP0002"}, {"location":{"start":{"line":17,"column":55},"end":{"line":17,"column":56},"identifierName":"y","source":"test/error-handler/binaryExpression.js"},"severity":"RecoverableError","errorCode":"PP0002"}] // expected errors: [{location: {"start":{"line":15,"column":12},"end":{"line":15,"column":13},"identifierName":"y","source":"test/error-handler/binaryExpression.js"}, errorCode: "PP0002", severity: "RecoverableError", message: "might be an object with an unknown valueOf or toString or Symbol.toPrimitive method"},{location: {"start":{"line":16,"column":6},"end":{"line":16,"column":7},"identifierName":"y","source":"test/error-handler/binaryExpression.js"}, errorCode: "PP0002", severity: "RecoverableError", message: "might be an object with an unknown valueOf or toString or Symbol.toPrimitive method"}, {"location":{"start":{"line":21,"column":5},"end":{"line":21,"column":6},"identifierName":"y","source":"test/error-handler/binaryExpression.js"},"severity":"RecoverableError","errorCode":"PP0002"}, {"location":{"start":{"line":21,"column":55},"end":{"line":21,"column":56},"identifierName":"y","source":"test/error-handler/binaryExpression.js"},"severity":"RecoverableError","errorCode":"PP0002"}]
var b = global.__abstract ? __abstract("boolean", "true") : true; var b = global.__abstract ? __abstract("boolean", "true") : true;
var x = global.__abstract ? __abstract("number", "123") : 123; var x = global.__abstract ? __abstract("number", "123") : 123;
var badOb = { valueOf: function() { throw 13;} } var badOb = {
valueOf: function() {
throw 13;
},
};
var ob = global.__makePartial ? __makePartial({}) : badOb; var ob = global.__makePartial ? __makePartial({}) : badOb;
var y = b ? ob : x; var y = b ? ob : x;
@ -16,4 +20,6 @@ try {
z1 = y < 13 && x > 122 && 123 <= x && x >= 123 && x == y && x != 1 && x === x && x !== y; z1 = y < 13 && x > 122 && 123 <= x && x >= 123 && x == y && x != 1 && x === x && x !== y;
inspect = function() { return "" + z + z1; } inspect = function() {
return "" + z + z1;
};

View File

@ -1,9 +1,9 @@
// recover-from-errors // recover-from-errors
// expected errors: [{"location":{"start":{"line":10,"column":0},"end":{"line":10,"column":1},"identifierName":"o","source":"test/error-handler/call.js"},"severity":"RecoverableError","errorCode":"PP0005"}, {"location":{"start":{"line":11,"column":2},"end":{"line":11,"column":3},"identifierName":"m","source":"test/error-handler/call.js"},"severity":"RecoverableError","errorCode":"PP0005"}, {"location":{"start":{"line":14,"column":5},"end":{"line":14,"column":8},"identifierName":"str","source":"test/error-handler/call.js"},"severity":"RecoverableError","errorCode":"PP0006"}] // expected errors: [{"location":{"start":{"line":10,"column":0},"end":{"line":10,"column":1},"identifierName":"o","source":"test/error-handler/call.js"},"severity":"RecoverableError","errorCode":"PP0005"}, {"location":{"start":{"line":11,"column":2},"end":{"line":11,"column":3},"identifierName":"m","source":"test/error-handler/call.js"},"severity":"RecoverableError","errorCode":"PP0005"}, {"location":{"start":{"line":14,"column":5},"end":{"line":14,"column":8},"identifierName":"str","source":"test/error-handler/call.js"},"severity":"RecoverableError","errorCode":"PP0006"}]
function foo(){}; function foo() {}
var f = global.__abstract ? __abstract(foo, "foo") : foo; var f = global.__abstract ? __abstract(foo, "foo") : foo;
var o = global.__abstract ? __abstract(({}), "({})") : {}; var o = global.__abstract ? __abstract({}, "({})") : {};
if (global.__makeSimple) global.__makeSimple(o); if (global.__makeSimple) global.__makeSimple(o);
foo(); foo();

View File

@ -1,12 +1,20 @@
// recover-from-errors // recover-from-errors
// expected errors: [{"location":{"start":{"line":8,"column":4},"end":{"line":8,"column":13},"source":"test/error-handler/call2.js"},"severity":"RecoverableError","errorCode":"PP0017"}] // expected errors: [{"location":{"start":{"line":12,"column":4},"end":{"line":12,"column":13},"source":"test/error-handler/call2.js"},"severity":"RecoverableError","errorCode":"PP0017"}]
let bar = {x: 1}; let bar = { x: 1 };
let foo = global.__abstract ? __abstract('function', '(function() { return this.x; })') : function() { return this.x; }; let foo = global.__abstract
? __abstract("function", "(function() { return this.x; })")
: function() {
return this.x;
};
bar.foo = foo; bar.foo = foo;
x = bar.foo(); x = bar.foo();
bar.foo = function() { return "abc"; } bar.foo = function() {
return "abc";
};
y = bar.foo(); y = bar.foo();
inspect = function() { return "" + x + y; } inspect = function() {
return "" + x + y;
};

View File

@ -1,11 +1,11 @@
// recover-from-errors // recover-from-errors
// expected errors: [{"location":{"start":{"line":7,"column":18},"end":{"line":7,"column":26},"identifierName":"absSuper","source":"test/error-handler/class.js"},"severity":"RecoverableError","errorCode":"PP0009"}, {"location":{"start":{"line":11,"column":18},"end":{"line":11,"column":28},"identifierName":"superClass","source":"test/error-handler/class.js"},"severity":"RecoverableError","errorCode":"PP0010"}] // expected errors: [{"location":{"start":{"line":7,"column":18},"end":{"line":7,"column":26},"identifierName":"absSuper","source":"test/error-handler/class.js"},"severity":"RecoverableError","errorCode":"PP0009"}, {"location":{"start":{"line":11,"column":18},"end":{"line":11,"column":28},"identifierName":"superClass","source":"test/error-handler/class.js"},"severity":"RecoverableError","errorCode":"PP0010"}]
let superClass = function() { }; let superClass = function() {};
let absSuper = __abstract("object"); let absSuper = __abstract("object");
class foo extends absSuper{} class foo extends absSuper {}
superClass.prototype = absSuper; superClass.prototype = absSuper;
class bar extends superClass{} class bar extends superClass {}

View File

@ -12,11 +12,13 @@ function f() {
} }
function g() { function g() {
f() f();
//condition from line 7 should have been undone and this should fail. //condition from line 7 should have been undone and this should fail.
return n2 - n1; return n2 - n1;
} }
g(); g();
inspect = function (){return true;} inspect = function() {
return true;
};

View File

@ -1,6 +1,6 @@
// expected errors: [{"location":{"start":{"line":9,"column":17},"end":{"line":9,"column":32},"source":"test/error-handler/forLoop1.js"},"severity":"FatalError","errorCode":"PP0034"}] // expected errors: [{"location":{"start":{"line":9,"column":17},"end":{"line":9,"column":32},"source":"test/error-handler/forLoop1.js"},"severity":"FatalError","errorCode":"PP0034"}]
var x = global.__abstract ? x = __abstract("number", "(1)") : 1; var x = global.__abstract ? (x = __abstract("number", "(1)")) : 1;
let i; let i;
let j; let j;
@ -10,4 +10,6 @@ label: for (i = 0; i < 2; i++) {
} }
} }
inspect = function() { return j; } inspect = function() {
return j;
};

View File

@ -16,4 +16,6 @@ try {
if (err instanceof TypeError) x3 = true; if (err instanceof TypeError) x3 = true;
} }
inspect = function() { return "" + x1 + x3; } inspect = function() {
return "" + x1 + x3;
};

View File

@ -3,13 +3,15 @@
var b = global.__abstract ? __abstract("boolean", "true") : true; var b = global.__abstract ? __abstract("boolean", "true") : true;
var a0 = { "4": 5 }; var a0 = { "4": 5 };
var a1 = global.__makeSimple ? __makeSimple({ '4': 5 }) : a0; var a1 = global.__makeSimple ? __makeSimple({ "4": 5 }) : a0;
var tArr = new Int8Array(4); var tArr = new Int8Array(4);
var a2 = global.__abstract ? __abstract("object", "tArr"): tArr; var a2 = global.__abstract ? __abstract("object", "tArr") : tArr;
x0 = "4" in a0; x0 = "4" in a0;
x1 = "4" in a1; x1 = "4" in a1;
x2 = "4" in a2; x2 = "4" in a2;
inspect = function() { return "" + x0 + x1 + x2; } inspect = function() {
return "" + x0 + x1 + x2;
};

View File

@ -1,9 +1,13 @@
// recover-from-errors // recover-from-errors
// expected errors: [{"location":{"start":{"line":11,"column":20},"end":{"line":11,"column":23},"identifierName":"foo","source":"test/error-handler/instanceof.js"},"severity":"RecoverableError","errorCode":"PP0004"}, {"location":{"start":{"line":17,"column":20},"end":{"line":17,"column":21},"identifierName":"b","source":"test/error-handler/instanceof.js"},"severity":"RecoverableError","errorCode":"PP0003"}, {"location":{"start":{"line":23,"column":20},"end":{"line":23,"column":21},"identifierName":"f","source":"test/error-handler/instanceof.js"},"severity":"RecoverableError","errorCode":"PP0004"}] // expected errors: [{"location":{"start":{"line":15,"column":20},"end":{"line":15,"column":23},"identifierName":"foo","source":"test/error-handler/instanceof.js"},"severity":"RecoverableError","errorCode":"PP0004"}, {"location":{"start":{"line":21,"column":20},"end":{"line":21,"column":21},"identifierName":"b","source":"test/error-handler/instanceof.js"},"severity":"RecoverableError","errorCode":"PP0003"}, {"location":{"start":{"line":27,"column":20},"end":{"line":27,"column":21},"identifierName":"f","source":"test/error-handler/instanceof.js"},"severity":"RecoverableError","errorCode":"PP0004"}]
var b = global.__abstract ? __abstract("boolean", "true") : true; var b = global.__abstract ? __abstract("boolean", "true") : true;
function foo(){}; function foo() {}
Object.defineProperty(foo, Symbol.hasInstance, { value: function() { throw 123; } }) Object.defineProperty(foo, Symbol.hasInstance, {
value: function() {
throw 123;
},
});
var f = global.__abstract ? __abstract("object", "foo") : foo; var f = global.__abstract ? __abstract("object", "foo") : foo;
var o = global.__abstract ? __abstract("object", "({})") : {}; var o = global.__abstract ? __abstract("object", "({})") : {};

View File

@ -1,5 +1,5 @@
// recover-from-errors // recover-from-errors
// expected errors: [{"location":{"start":{"line":5,"column":34},"end":{"line":5,"column":37},"identifierName":"obj","source":"test/error-handler/object-assign.js"},"severity":"FatalError","errorCode":"PP0001"}] // expected errors: [{"location":{"start":{"line":5,"column":34},"end":{"line":5,"column":37},"identifierName":"obj","source":"test/error-handler/object-assign.js"},"severity":"FatalError","errorCode":"PP0001"}]
var obj = global.__abstract && global.__makePartial ? __makePartial(__abstract({}, "({foo:1})")) : {foo:1}; var obj = global.__abstract && global.__makePartial ? __makePartial(__abstract({}, "({foo:1})")) : { foo: 1 };
var copyOfObj = Object.assign({}, obj); var copyOfObj = Object.assign({}, obj);

View File

@ -1,7 +1,7 @@
// recover-from-errors // recover-from-errors
// expected errors: [{"location":{"start":{"line":7,"column":11},"end":{"line":7,"column":30},"source":"test/error-handler/objectExpression.js"},"severity":"FatalError","errorCode":"PP0011"}, {"location":{"start":{"line":7,"column":32},"end":{"line":7,"column":38},"source":"test/error-handler/objectExpression.js"},"severity":"FatalError","errorCode":"PP0011"}] // expected errors: [{"location":{"start":{"line":7,"column":11},"end":{"line":7,"column":29},"source":"test/error-handler/objectExpression.js"},"severity":"FatalError","errorCode":"PP0011"}, {"location":{"start":{"line":7,"column":31},"end":{"line":7,"column":37},"source":"test/error-handler/objectExpression.js"},"severity":"FatalError","errorCode":"PP0011"}]
let x = __abstract("number"); let x = __abstract("number");
let y = __abstract("number"); let y = __abstract("number");
let ob = { [x]: function () {}, [y]: 2 }; let ob = { [x]: function() {}, [y]: 2 };

View File

@ -1,6 +1,6 @@
// expected errors: [{"location":{"start":{"line":6,"column":11},"end":{"line":6,"column":30},"source":"test/error-handler/objectExpression2.js"},"severity":"FatalError","errorCode":"PP0011"}] // expected errors: [{"location":{"start":{"line":6,"column":11},"end":{"line":6,"column":29},"source":"test/error-handler/objectExpression2.js"},"severity":"FatalError","errorCode":"PP0011"}]
let x = __abstract("number"); let x = __abstract("number");
let y = __abstract("number"); let y = __abstract("number");
let ob = { [x]: function () {}, [y]: 2 }; let ob = { [x]: function() {}, [y]: 2 };

View File

@ -1,6 +1,6 @@
// delay unsupported requires // delay unsupported requires
// recover-from-errors // recover-from-errors
// expected errors: [{"location":{"start":{"line":85,"column":4},"end":{"line":85,"column":12},"source":"test/error-handler/require_throws2.js"},"severity":"Warning","errorCode":"PP0018"}] // expected errors: [{"location":{"start":{"line":84,"column":4},"end":{"line":84,"column":12},"source":"test/error-handler/require_throws2.js"},"severity":"Warning","errorCode":"PP0018"}]
let b = global.__abstract ? __abstract("boolean", "true") : true; let b = global.__abstract ? __abstract("boolean", "true") : true;
@ -22,7 +22,7 @@ function define(factory, moduleId, dependencyMap) {
exports: undefined, exports: undefined,
factory: factory, factory: factory,
hasError: false, hasError: false,
isInitialized: false isInitialized: false,
}; };
var _verboseName = arguments[3]; var _verboseName = arguments[3];
@ -65,19 +65,18 @@ function loadModuleImplementation(moduleId, module) {
} }
module.isInitialized = true; module.isInitialized = true;
var exports = module.exports = {}; var exports = (module.exports = {});
var _module = module, var _module = module,
factory = _module.factory, factory = _module.factory,
dependencyMap = _module.dependencyMap; dependencyMap = _module.dependencyMap;
try { try {
var _moduleObject = { exports: exports }; var _moduleObject = { exports: exports };
factory(global, require, _moduleObject, exports, dependencyMap); factory(global, require, _moduleObject, exports, dependencyMap);
module.factory = undefined; module.factory = undefined;
return module.exports = _moduleObject.exports; return (module.exports = _moduleObject.exports);
} catch (e) { } catch (e) {
module.hasError = true; module.hasError = true;
module.isInitialized = false; module.isInitialized = false;
@ -98,7 +97,9 @@ function moduleThrewError(id) {
// === End require code === // === End require code ===
define(function(global, require, module, exports) { define(function(global, require, module, exports) {
var obj = global.__abstract ? __makeSimple(__abstract({unsupported: true}, "({unsupported: true})")) : ({unsupported: true}); var obj = global.__abstract
? __makeSimple(__abstract({ unsupported: true }, "({unsupported: true})"))
: { unsupported: true };
if (obj.unsupported) { if (obj.unsupported) {
exports.magic = 42; exports.magic = 42;
} else { } else {
@ -110,9 +111,13 @@ define(function(global, require, module, exports) {
define(function(global, require, module, exports) { define(function(global, require, module, exports) {
var x = require(0); var x = require(0);
module.exports = function() { return x.notmagic; } module.exports = function() {
return x.notmagic;
};
}, 1, null); }, 1, null);
var f = require(1); var f = require(1);
inspect = function() { return f().magic; } inspect = function() {
return f().magic;
};

View File

@ -1,9 +1,15 @@
// abstract effects // abstract effects
// recover-from-errors // recover-from-errors
// expected errors: [{location: {"start":{"line":13,"column":11},"end":{"line":13,"column":15},"identifierName":"obj1","source":"test/error-handler/try-and-access-abstract-property.js"}, errorCode: "PP0021", severity: "RecoverableError", message: "Possible throw inside try/catch is not yet supported"},{location: {"start":{"line":21,"column":11},"end":{"line":21,"column":15},"identifierName":"obj2","source":"test/error-handler/try-and-access-abstract-property.js"}, errorCode: "PP0021", severity: "RecoverableError", message: "Possible throw inside try/catch is not yet supported"}] // expected errors: [{location: {"start":{"line":19,"column":11},"end":{"line":19,"column":15},"identifierName":"obj1","source":"test/error-handler/try-and-access-abstract-property.js"}, errorCode: "PP0021", severity: "RecoverableError", message: "Possible throw inside try/catch is not yet supported"},{location: {"start":{"line":27,"column":11},"end":{"line":27,"column":15},"identifierName":"obj2","source":"test/error-handler/try-and-access-abstract-property.js"}, errorCode: "PP0021", severity: "RecoverableError", message: "Possible throw inside try/catch is not yet supported"}]
let obj1 = global.__abstract ? __abstract('object', '({get foo() { return "bar"; }})') : {get foo() { return "bar"; }}; let obj1 = global.__abstract
let obj2 = global.__abstract ? __abstract('object', '({foo:{bar:"baz"}})') : {foo:{bar:"baz"}}; ? __abstract("object", '({get foo() { return "bar"; }})')
: {
get foo() {
return "bar";
},
};
let obj2 = global.__abstract ? __abstract("object", '({foo:{bar:"baz"}})') : { foo: { bar: "baz" } };
if (global.__makeSimple) { if (global.__makeSimple) {
__makeSimple(obj2); __makeSimple(obj2);
} }
@ -33,4 +39,4 @@ inspect = function() {
let ret1 = additional1(); let ret1 = additional1();
let ret2 = additional2(); let ret2 = additional2();
return JSON.stringify({ ret1, ret2 }); return JSON.stringify({ ret1, ret2 });
} };

View File

@ -1,8 +1,12 @@
// abstract effects // abstract effects
// expected errors: [{location: {"start":{"line":26,"column":11},"end":{"line":26,"column":21},"identifierName":"abstractFn","source":"test/error-handler/try-and-call-abstract-function.js"}, errorCode: "PP0021", severity: "RecoverableError", message: "Possible throw inside try/catch is not yet supported"}] // expected errors: [{location: {"start":{"line":30,"column":11},"end":{"line":30,"column":21},"identifierName":"abstractFn","source":"test/error-handler/try-and-call-abstract-function.js"}, errorCode: "PP0021", severity: "RecoverableError", message: "Possible throw inside try/catch is not yet supported"}]
// recover-from-errors // recover-from-errors
let abstractFn = global.__abstract ? __abstract('function', '(function() { return true; })') : function() { return true; }; let abstractFn = global.__abstract
? __abstract("function", "(function() { return true; })")
: function() {
return true;
};
function concreteFunction() { function concreteFunction() {
return true; return true;
@ -38,4 +42,4 @@ inspect = function() {
let ret1 = additional1(); let ret1 = additional1();
let ret2 = additional2(); let ret2 = additional2();
return JSON.stringify({ ret1, ret2 }); return JSON.stringify({ ret1, ret2 });
} };

View File

@ -1,11 +1,13 @@
// recover-from-errors // recover-from-errors
// expected errors: [{"location":{"start":{"line":11,"column":10},"end":{"line":11,"column":19},"identifierName":"mysteryOb","source":"test/error-handler/unaryExpression.js"},"severity":"RecoverableError","errorCode":"PP0008"}, {"location":{"start":{"line":13,"column":10},"end":{"line":13,"column":19},"identifierName":"mysteryOb","source":"test/error-handler/unaryExpression.js"},"severity":"RecoverableError","errorCode":"PP0008"}, {"location":{"start":{"line":15,"column":10},"end":{"line":15,"column":19},"identifierName":"mysteryOb","source":"test/error-handler/unaryExpression.js"},"severity":"RecoverableError","errorCode":"PP0008"}] // expected errors: [{"location":{"start":{"line":13,"column":10},"end":{"line":13,"column":19},"identifierName":"mysteryOb","source":"test/error-handler/unaryExpression.js"},"severity":"RecoverableError","errorCode":"PP0008"}, {"location":{"start":{"line":15,"column":10},"end":{"line":15,"column":19},"identifierName":"mysteryOb","source":"test/error-handler/unaryExpression.js"},"severity":"RecoverableError","errorCode":"PP0008"}, {"location":{"start":{"line":17,"column":10},"end":{"line":17,"column":19},"identifierName":"mysteryOb","source":"test/error-handler/unaryExpression.js"},"severity":"RecoverableError","errorCode":"PP0008"}]
var b = global.__abstract ? __abstract("boolean", "true") : true; var b = global.__abstract ? __abstract("boolean", "true") : true;
var x = global.__abstract ? __abstract("number", "123") : 123; var x = global.__abstract ? __abstract("number", "123") : 123;
var badOb = {}; var badOb = {};
if (global.__makeSimple) global.__makeSimple(badOb); if (global.__makeSimple) global.__makeSimple(badOb);
badOb[Symbol.toPrimitive] = function() { throw 13;} badOb[Symbol.toPrimitive] = function() {
throw 13;
};
var mysteryOb = b ? null : badOb; var mysteryOb = b ? null : badOb;
var x1 = +mysteryOb; var x1 = +mysteryOb;

View File

@ -1,9 +1,13 @@
// recover-from-errors // recover-from-errors
// expected errors: [{"location":{"start":{"line":10,"column":0},"end":{"line":10,"column":1},"identifierName":"y","source":"test/error-handler/updateExpression.js"},"severity":"RecoverableError","errorCode":"PP0008"}, {"location":{"start":{"line":11,"column":2},"end":{"line":11,"column":4},"identifierName":"ob","source":"test/error-handler/updateExpression.js"},"severity":"RecoverableError","errorCode":"PP0008"}] // expected errors: [{"location":{"start":{"line":14,"column":0},"end":{"line":14,"column":1},"identifierName":"y","source":"test/error-handler/updateExpression.js"},"severity":"RecoverableError","errorCode":"PP0008"}, {"location":{"start":{"line":15,"column":2},"end":{"line":15,"column":4},"identifierName":"ob","source":"test/error-handler/updateExpression.js"},"severity":"RecoverableError","errorCode":"PP0008"}]
var b = global.__abstract ? __abstract("boolean", "true") : true; var b = global.__abstract ? __abstract("boolean", "true") : true;
var x = global.__abstract ? __abstract("number", "123") : 123; var x = global.__abstract ? __abstract("number", "123") : 123;
var badOb = { valueOf: function() { throw 13;} } var badOb = {
valueOf: function() {
throw 13;
},
};
var ob = global.__abstract ? __abstract("object", "({ valueOf: function() { throw 13;} })") : badOb; var ob = global.__abstract ? __abstract("object", "({ valueOf: function() { throw 13;} })") : badOb;
var y = b ? ob : x; var y = b ? ob : x;

View File

@ -1,10 +1,12 @@
// recover-from-errors // recover-from-errors
// expected errors: [{"location":{"start":{"line":7,"column":5},"end":{"line":7,"column":8},"identifierName":"obj","source":"test/error-handler/with.js"},"severity":"RecoverableError","errorCode":"PP0007"}] // expected errors: [{"location":{"start":{"line":7,"column":6},"end":{"line":7,"column":9},"identifierName":"obj","source":"test/error-handler/with.js"},"severity":"RecoverableError","errorCode":"PP0007"}]
let obj = global.__abstract ? __makePartial({x:1,y:3}, '({x:1,y:3})') : {x:1,y:3}; let obj = global.__abstract ? __makePartial({ x: 1, y: 3 }, "({x:1,y:3})") : { x: 1, y: 3 };
if (global.__makeSimple) global.__makeSimple(obj); if (global.__makeSimple) global.__makeSimple(obj);
let y = 2; let y = 2;
with(obj) { with (obj) {
z = x + y; z = x + y;
} }
inspect = function() { return z; } inspect = function() {
return z;
};

View File

@ -1,9 +1,11 @@
// recover-from-errors // recover-from-errors
// expected errors: [{"location":{"start":{"line":6,"column":5},"end":{"line":6,"column":8},"identifierName":"obj","source":"test/error-handler/with2.js"},"severity":"RecoverableError","errorCode":"PP0007"}, {"location":{"start":{"line":7,"column":2},"end":{"line":7,"column":3},"identifierName":"z","source":"test/error-handler/with2.js"},"severity":"FatalError","errorCode":"PP0001"}] // expected errors: [{"location":{"start":{"line":6,"column":6},"end":{"line":6,"column":9},"identifierName":"obj","source":"test/error-handler/with2.js"},"severity":"RecoverableError","errorCode":"PP0007"}, {"location":{"start":{"line":7,"column":2},"end":{"line":7,"column":3},"identifierName":"z","source":"test/error-handler/with2.js"},"severity":"FatalError","errorCode":"PP0001"}]
let obj = global.__abstract ? __makePartial({x:1,y:3}, '({x:1,y:3})') : {x:1,y:3}; let obj = global.__abstract ? __makePartial({ x: 1, y: 3 }, "({x:1,y:3})") : { x: 1, y: 3 };
let y = 2; let y = 2;
with(obj) { with (obj) {
z = x + y; z = x + y;
} }
inspect = function() { return z; } inspect = function() {
return z;
};

View File

@ -7,7 +7,6 @@ function additional1() {
function additional2() { function additional2() {
for (let p in global.a) { for (let p in global.a) {
} }
} }
@ -20,4 +19,4 @@ inspect = function() {
additional2(); additional2();
additional1(); additional1();
return global.b; return global.b;
} };

View File

@ -18,4 +18,4 @@ inspect = function() {
additional2(); additional2();
additional1(); additional1();
return global.b; return global.b;
} };

View File

@ -20,4 +20,4 @@ inspect = function() {
additional2(); additional2();
additional1(); additional1();
return global.b; return global.b;
} };

View File

@ -20,4 +20,4 @@ inspect = function() {
additional2(); additional2();
additional1(); additional1();
return global.a; return global.a;
} };

View File

@ -20,4 +20,4 @@ inspect = function() {
additional2(); additional2();
additional1(); additional1();
return global.a; return global.a;
} };

View File

@ -20,4 +20,4 @@ inspect = function() {
additional2(); additional2();
additional1(); additional1();
return global.a; return global.a;
} };

View File

@ -20,4 +20,4 @@ inspect = function() {
additional2(); additional2();
additional1(); additional1();
return global.a + global.b; return global.a + global.b;
} };

View File

@ -2,7 +2,7 @@
// expected errors: [{"severity":"Warning","errorCode":"PP1007","callStack":"Error\n "},{"severity":"Warning","errorCode":"PP1007","callStack":"Error\n "},{"severity":"Warning","errorCode":"PP1007","callStack":"Error\n "},{"severity":"Warning","errorCode":"PP1007","callStack":"Error\n "},{"location":{"start":{"line":12,"column":16},"end":{"line":12,"column":21},"source":"test/error-handler/write-write-unknown-prop-conflict.js"},"severity":"FatalError","errorCode":"PP1003"},{"location":{"start":{"line":8,"column":16},"end":{"line":8,"column":21},"source":"test/error-handler/write-write-unknown-prop-conflict.js"},"severity":"FatalError","errorCode":"PP1003"}] // expected errors: [{"severity":"Warning","errorCode":"PP1007","callStack":"Error\n "},{"severity":"Warning","errorCode":"PP1007","callStack":"Error\n "},{"severity":"Warning","errorCode":"PP1007","callStack":"Error\n "},{"severity":"Warning","errorCode":"PP1007","callStack":"Error\n "},{"location":{"start":{"line":12,"column":16},"end":{"line":12,"column":21},"source":"test/error-handler/write-write-unknown-prop-conflict.js"},"severity":"FatalError","errorCode":"PP1003"},{"location":{"start":{"line":8,"column":16},"end":{"line":8,"column":21},"source":"test/error-handler/write-write-unknown-prop-conflict.js"},"severity":"FatalError","errorCode":"PP1003"}]
let i = global.__abstract ? __abstract("string", "x") : "x"; let i = global.__abstract ? __abstract("string", "x") : "x";
global.a = { x: "" } global.a = { x: "" };
function additional1() { function additional1() {
global.a[i] = "foo"; global.a[i] = "foo";
@ -21,4 +21,4 @@ inspect = function() {
additional2(); additional2();
additional1(); additional1();
return global.a.x; return global.a.x;
} };

View File

@ -1,19 +1,24 @@
var fs = require('fs'); var fs = require("fs");
var greetingPath = require.resolve('./Greeting.txt'); var greetingPath = require.resolve("./Greeting.txt");
var greetingJSON = require('./Greeting.json'); var greetingJSON = require("./Greeting.json");
// The residual program after initialization. // The residual program after initialization.
__residual('boolean', function(fs, greetingJSON, greetingPath, console, JSON) { __residual(
"boolean",
function(fs, greetingJSON, greetingPath, console, JSON) {
var greetingText = fs.readFileSync(greetingPath, "utf8");
var greetingText = fs.readFileSync(greetingPath, 'utf8'); console.log(`${greetingJSON.greeting} ${greetingText} world!`);
console.log( // Currently, we're required to have a return value even though
`${greetingJSON.greeting} ${greetingText} world!` // we're not going to use it.
); return false;
},
// Currently, we're required to have a return value even though fs,
// we're not going to use it. greetingJSON,
return false; greetingPath,
}, fs, greetingJSON, greetingPath, console, JSON); console,
JSON
);

View File

@ -1,11 +1,15 @@
var greeting = require('./Greeting'); var greeting = require("./Greeting");
// The residual program after initialization. // The residual program after initialization.
__residual('boolean', function(greeting, console) { __residual(
"boolean",
function(greeting, console) {
console.log(greeting + " world!");
console.log(greeting + ' world!'); // Currently, we're required to have a return value even though
// we're not going to use it.
// Currently, we're required to have a return value even though return false;
// we're not going to use it. },
return false; greeting,
}, greeting, console); console
);

View File

@ -1 +1 @@
var __result = [1+2, "2", [3], ...[4, 5]] var __result = [1 + 2, "2", [3], ...[4, 5]];

View File

@ -1 +1,3 @@
{let __result = 1;} {
let __result = 1;
}

View File

@ -4,28 +4,21 @@ let b = global.__abstract ? __abstract("boolean", "true") : true;
let y = 1; let y = 1;
function foo(x) { function foo(x) {
if (b) if (b) y += x;
y += x; else throw x;
else
throw x;
} }
foo(2); foo(2);
function bar(x) { function bar(x) {
if (x) if (x) return foo;
return foo; else throw foo;
else
throw foo;
} }
if (b) if (b) bar(b)(3);
bar(b)(3); else bar(false)(4);
else
bar(false)(4);
if (b) { if (b) {
} else { } else {
bar(b)(bar(false)); bar(b)(bar(false));
} }

View File

@ -1,3 +1,5 @@
function f() { return 123; } function f() {
return 123;
}
var g = global.__abstract ? global.__abstract(f, "f") : f; var g = global.__abstract ? global.__abstract(f, "f") : f;
__result = g(); __result = g();

View File

@ -1,12 +1,18 @@
var o = global.__abstract ? global.__abstract('number', '1') : 1; var o = global.__abstract ? global.__abstract("number", "1") : 1;
var obj = {}; var obj = {};
function bar(x) { function bar(x) {
if (o > 1) { if (o > 1) {
obj.foo = function() { return 1 + x; } obj.foo = function() {
return 1 + x;
};
} else if (o > 2) { } else if (o > 2) {
obj.foo = function() { return 2 + x; } obj.foo = function() {
return 2 + x;
};
} else { } else {
obj.foo = function() { return 3 + x; } obj.foo = function() {
return 3 + x;
};
} }
} }
bar(5); bar(5);

View File

@ -1,12 +1,18 @@
var o = global.__abstract ? global.__abstract('number', '1') : 1; var o = global.__abstract ? global.__abstract("number", "1") : 1;
var obj = {}; var obj = {};
function bar(x) { function bar(x) {
if (o > 1) { if (o > 1) {
obj.foo = function() { return 1 + x; } obj.foo = function() {
return 1 + x;
};
} else if (o > 2) { } else if (o > 2) {
obj.foo = function() { return 2 + x; } obj.foo = function() {
return 2 + x;
};
} else { } else {
obj.foo = function() { return 3 + x; } obj.foo = function() {
return 3 + x;
};
} }
} }
bar(5); bar(5);

View File

@ -1,5 +1,7 @@
eval("var ohSo = 'evil';"); eval("var ohSo = 'evil';");
evil = eval(); evil = eval();
eval = function () { return " very "; }; eval = function() {
return " very ";
};
very = eval(); very = eval();
__result = ohSo + very + evil; __result = ohSo + very + evil;

View File

@ -1,6 +1,8 @@
// add at runtime:function __nextComponentID() { return 42; } // add at runtime:function __nextComponentID() { return 42; }
(function() { (function() {
let f = global.__abstract ? __abstract(":number", "__nextComponentID") : __nextComponentID; let f = global.__abstract ? __abstract(":number", "__nextComponentID") : __nextComponentID;
let t = typeof f(); let t = typeof f();
inspect = function() { return t; } inspect = function() {
})(); return t;
};
})();

View File

@ -1,7 +1,13 @@
// add at runtime: global.z = { 0: "test string" }; // add at runtime: global.z = { 0: "test string" };
if (global.__assumeDataProperty) if (global.__assumeDataProperty)
__assumeDataProperty(this, "z", __abstract({ __assumeDataProperty(
0: __abstract("string") this,
})); "z",
__abstract({
0: __abstract("string"),
})
);
let check = z && typeof z[0] === "string" && z[0]; let check = z && typeof z[0] === "string" && z[0];
inspect = function() { return check; } inspect = function() {
return check;
};

View File

@ -1,8 +1,13 @@
// add at runtime: global.o = { foo: undefined }; // add at runtime: global.o = { foo: undefined };
if (global.__abstract) if (global.__abstract)
o = __abstract({ o = __abstract(
foo: __abstractOrNullOrUndefined('number') {
}, "global.o"); foo: __abstractOrNullOrUndefined("number"),
let check = o && typeof o.foo === 'number' && o.foo >= 3; },
"global.o"
);
let check = o && typeof o.foo === "number" && o.foo >= 3;
inspect = function() { return check + ' ' + global.o.foo; } inspect = function() {
return check + " " + global.o.foo;
};

View File

@ -1,7 +1,7 @@
// add at runtime:global.__obj1 = { a: 1 }; global.__obj2 = { a: 2 }; // add at runtime:global.__obj1 = { a: 1 }; global.__obj2 = { a: 2 };
let obj1 = global.__abstract ? __abstract({}, 'global.__obj1') : { a: 1 }; let obj1 = global.__abstract ? __abstract({}, "global.__obj1") : { a: 1 };
let obj2 = global.__abstract ? __abstract({}, 'global.__obj2') : { a: 2 }; let obj2 = global.__abstract ? __abstract({}, "global.__obj2") : { a: 2 };
if (global.__makePartial) { if (global.__makePartial) {
__makePartial(obj1); __makePartial(obj1);
@ -38,4 +38,4 @@ inspect = function() {
result += ret2[key]; result += ret2[key];
} }
return result; return result;
} };

View File

@ -1,7 +1,7 @@
// add at runtime:global.__obj1 = { a: Math.random(), b: 10 }; global.__obj2 = { a: Math.random(), b: 10 }; // add at runtime:global.__obj1 = { a: Math.random(), b: 10 }; global.__obj2 = { a: Math.random(), b: 10 };
let obj1 = global.__abstract ? __abstract({}, 'global.__obj1') : { a: Math.random(), b: 10 }; let obj1 = global.__abstract ? __abstract({}, "global.__obj1") : { a: Math.random(), b: 10 };
let obj2 = global.__abstract ? __abstract({}, 'global.__obj2') : { a: Math.random(), b: 10 }; let obj2 = global.__abstract ? __abstract({}, "global.__obj2") : { a: Math.random(), b: 10 };
if (global.__makePartial) { if (global.__makePartial) {
__makePartial(obj1); __makePartial(obj1);
@ -40,4 +40,4 @@ inspect = function() {
result += ret1.b; result += ret1.b;
result += ret2.b; result += ret2.b;
return result; return result;
} };

View File

@ -1,7 +1,7 @@
// add at runtime:global.__obj1 = { "extends": Math.random(), b: 10 }; global.__obj2 = { "while": Math.random(), b: 10 }; // add at runtime:global.__obj1 = { "extends": Math.random(), b: 10 }; global.__obj2 = { "while": Math.random(), b: 10 };
let obj1 = global.__abstract ? __abstract({}, 'global.__obj1') : { "extends": Math.random(), b: 10 }; let obj1 = global.__abstract ? __abstract({}, "global.__obj1") : { extends: Math.random(), b: 10 };
let obj2 = global.__abstract ? __abstract({}, 'global.__obj2') : { "while": Math.random(), b: 10 }; let obj2 = global.__abstract ? __abstract({}, "global.__obj2") : { while: Math.random(), b: 10 };
if (global.__makePartial) { if (global.__makePartial) {
__makePartial(obj1); __makePartial(obj1);
@ -14,13 +14,13 @@ if (global.__makeSimple) {
function additional1() { function additional1() {
obj1.c = 10; obj1.c = 10;
delete obj1['extends']; delete obj1["extends"];
return obj1; return obj1;
} }
function additional2() { function additional2() {
obj2.c = 5; obj2.c = 5;
delete obj2['while']; delete obj2["while"];
return obj2; return obj2;
} }
@ -40,4 +40,4 @@ inspect = function() {
result += ret1.b; result += ret1.b;
result += ret2.b; result += ret2.b;
return result; return result;
} };

View File

@ -5,4 +5,6 @@ Constructor.prototype = obj;
let obj2 = new Constructor(); let obj2 = new Constructor();
inspect = function() { return Object.getPrototypeOf(obj2) === obj; } inspect = function() {
return Object.getPrototypeOf(obj2) === obj;
};

View File

@ -2,4 +2,5 @@
var l = __abstract("number"); var l = __abstract("number");
var a = new Array(l); var a = new Array(l);
if (a.length) {} if (a.length) {
}

View File

@ -1,8 +1,10 @@
// add at runtime:function __nextComponentID() { return 42; } // add at runtime:function __nextComponentID() { return 42; }
(function() { (function() {
let f = global.__abstract ? __abstract(":number", "__nextComponentID") : __nextComponentID; let f = global.__abstract ? __abstract(":number", "__nextComponentID") : __nextComponentID;
let n = f(); let n = f();
let a = [].concat([n]);; let a = [].concat([n]);
inspect = function() { return a[0]; } inspect = function() {
})(); return a[0];
};
})();

View File

@ -8,5 +8,7 @@
o.push(3); o.push(3);
} else { } else {
} }
inspect = function() { return o; } inspect = function() {
return o;
};
})(); })();

View File

@ -1,4 +1,6 @@
var x = global.__abstract ? __abstract("boolean", "true") : true; var x = global.__abstract ? __abstract("boolean", "true") : true;
var a = []; var a = [];
if (x) a.push(42); if (x) a.push(42);
inspect = function() { return a.length; } inspect = function() {
return a.length;
};

View File

@ -2,6 +2,8 @@ var x = global.__abstract ? __abstract("boolean", "true") : true;
var a = []; var a = [];
var b = x ? a : []; var b = x ? a : [];
if (b === a) { if (b === a) {
a.push(42); a.push(42);
} }
inspect = function() { return a.length; } inspect = function() {
return a.length;
};

View File

@ -1,9 +1,11 @@
// does contain:[1,, 3,, 5, 6] // does contain:[1,, 3,, 5, 6]
(function() { (function() {
let x = global.__abstract ? __abstract("boolean", "true") : true; let x = global.__abstract ? __abstract("boolean", "true") : true;
let a = [1,,3,,5,6,,,,]; // Hole in the middle and end. let a = [1, , 3, , 5, 6, , , ,]; // Hole in the middle and end.
if (x) { if (x) {
a.length = 100; a.length = 100;
} }
inspect = function() { return a.length; } inspect = function() {
return a.length;
};
})(); })();

View File

@ -4,4 +4,6 @@ let a = [1];
if (c) a.push(2); if (c) a.push(2);
let x = a.map(x => x + 42); let x = a.map(x => x + 42);
global.inspect = function() { JSON.stringify(x); } global.inspect = function() {
JSON.stringify(x);
};

View File

@ -3,6 +3,11 @@ let c = global.__abstract ? __abstract("boolean", "true") : true;
let a = [1]; let a = [1];
let sum = 0; let sum = 0;
if (c) a.push(2); if (c) a.push(2);
let x = a.map(x => { sum += x; return x + 42; } ); let x = a.map(x => {
sum += x;
return x + 42;
});
global.inspect = function() { sum + JSON.stringify(x); } global.inspect = function() {
sum + JSON.stringify(x);
};

View File

@ -4,9 +4,14 @@ let a = [1];
if (c) a.push(2); if (c) a.push(2);
let x; let x;
try { try {
x = a.map(x => { if (x === 2) throw x; else return x + 42; } ); x = a.map(x => {
if (x === 2) throw x;
else return x + 42;
});
} catch (e) { } catch (e) {
x = e; x = e;
} }
global.inspect = function() { JSON.stringify(x); } global.inspect = function() {
JSON.stringify(x);
};

View File

@ -2,7 +2,11 @@
var b = global.__abstract ? __abstract("boolean", "true") : true; var b = global.__abstract ? __abstract("boolean", "true") : true;
var x = global.__abstract ? __abstract("number", "123") : 123; var x = global.__abstract ? __abstract("number", "123") : 123;
var badOb = { valueOf: function() { throw 13;} } var badOb = {
valueOf: function() {
throw 13;
},
};
var ob = global.__abstract ? __abstract("object", "({ valueOf: function() { throw 13;} })") : badOb; var ob = global.__abstract ? __abstract("object", "({ valueOf: function() { throw 13;} })") : badOb;
var y = b ? ob : x; var y = b ? ob : x;
@ -12,4 +16,6 @@ try {
z = 200 + err; z = 200 + err;
} }
inspect = function() { return "" + z; } inspect = function() {
return "" + z;
};

View File

@ -1,2 +1,4 @@
if (Date.now() > 0) x = Date.now(); if (Date.now() > 0) x = Date.now();
inspect = function() { return ""; } inspect = function() {
return "";
};

View File

@ -12,4 +12,6 @@ if (y) {
console.log("false"); console.log("false");
} }
inspect = function() { return ""; } inspect = function() {
return "";
};

View File

@ -4,9 +4,12 @@ let arr = [];
xyz: while (true) { xyz: while (true) {
arr[0] = 123; arr[0] = 123;
if (x) break xyz; else break xyz; if (x) break xyz;
else break xyz;
} }
var z = arr; var z = arr;
inspect = function() { return "" + z; } inspect = function() {
return "" + z;
};

View File

@ -6,7 +6,8 @@ function foo() {
let x = __abstract("boolean", "true"); let x = __abstract("boolean", "true");
xyz: while (true) { xyz: while (true) {
arr[0] = 123; arr[0] = 123;
if (x) break; else break xyz; if (x) break;
else break xyz;
} }
} }

View File

@ -12,5 +12,5 @@ var y = eval(`
} while (true);`); } while (true);`);
inspect = function() { inspect = function() {
return y; return y;
} };

View File

@ -1,5 +1,9 @@
function f() { return 123; } function f() {
return 123;
}
var g = global.__abstract ? global.__abstract("function", "f") : f; var g = global.__abstract ? global.__abstract("function", "f") : f;
var z = g(); var z = g();
inspect = function() { return "" + z } inspect = function() {
return "" + z;
};

View File

@ -1,15 +1,23 @@
var o = global.__abstract ? global.__abstract('number', '1') : 1; var o = global.__abstract ? global.__abstract("number", "1") : 1;
var obj = {}; var obj = {};
function bar(x) { function bar(x) {
if (o > 1) { if (o > 1) {
obj.foo = function() { return 1 + x; } obj.foo = function() {
return 1 + x;
};
} else if (o > 2) { } else if (o > 2) {
obj.foo = function() { return 2 + x; } obj.foo = function() {
return 2 + x;
};
} else { } else {
obj.foo = function() { return 3 + x; } obj.foo = function() {
return 3 + x;
};
} }
} }
bar(5); bar(5);
var z = obj.foo(); var z = obj.foo();
inspect = function() { return "" + z } inspect = function() {
return "" + z;
};

View File

@ -1,5 +1,9 @@
function f(v) { return v*2; } function f(v) {
return v * 2;
}
var g = global.__abstract ? global.__abstract("function", "f") : f; var g = global.__abstract ? global.__abstract("function", "f") : f;
let v = Object.freeze([1]).map(g) let v = Object.freeze([1]).map(g);
inspect = function() { return v } inspect = function() {
return v;
};

View File

@ -4,7 +4,7 @@ let x = __abstract("boolean", "true");
try { try {
var obj = __abstract("object"); var obj = __abstract("object");
if (x) delete obj.someProperty; if (x) delete obj.someProperty;
} catch(err) { } catch (err) {
throw new Error("Cannot catch"); throw new Error("Cannot catch");
} finally { } finally {
throw new Error("Cannot finally"); throw new Error("Cannot finally");

View File

@ -3,8 +3,9 @@ let x = __abstract("boolean", "true");
try { try {
var obj = __abstract("object"); var obj = __abstract("object");
if (x) {} else delete obj.someProperty; if (x) {
} catch(err) { } else delete obj.someProperty;
} catch (err) {
throw new Error("Cannot catch"); throw new Error("Cannot catch");
} finally { } finally {
throw new Error("Cannot finally"); throw new Error("Cannot finally");

View File

@ -1,5 +1,7 @@
(function() { (function() {
var x = global.__abstract ? __abstract("object", "({})") : {}; var x = global.__abstract ? __abstract("object", "({})") : {};
var c = x === global; var c = x === global;
inspect = function() { return c; } inspect = function() {
})(); return c;
};
})();

View File

@ -7,11 +7,13 @@ function bar(y) {
function fn(x, y) { function fn(x, y) {
if (x) { if (x) {
bar(y) bar(y);
} }
return 123; return 123;
} }
if (global.__optimize) __optimize(fn); if (global.__optimize) __optimize(fn);
inspect = function() { return fn(true, false); } inspect = function() {
return fn(true, false);
};

View File

@ -14,4 +14,4 @@ if (global.__makePartial) __makePartial(global);
inspect = function() { inspect = function() {
return global.fooFunc() === undefined && global.barUndefined === undefined && global.barzAbstract === undefined; return global.fooFunc() === undefined && global.barUndefined === undefined && global.barzAbstract === undefined;
} };

View File

@ -2,37 +2,64 @@
if (global.__assumeDataProperty) { if (global.__assumeDataProperty) {
__assumeDataProperty(global, "inspect", undefined); __assumeDataProperty(global, "inspect", undefined);
__assumeDataProperty(this, "nativeTraceBeginAsyncSection", function(tag, name, cookie) { __assumeDataProperty(
if (global.__residual) this,
return global.__residual("void", function(tag, name, cookie, global) { "nativeTraceBeginAsyncSection",
return global.nativeTraceBeginAsyncSection(tag, name, cookie); function(tag, name, cookie) {
}, tag, name, cookie, global); if (global.__residual)
else return global.__residual(
return this.nativeTraceBeginAsyncSection(tag, name, cookie); "void",
}, "VALUE_DEFINED_INVARIANT"); function(tag, name, cookie, global) {
__assumeDataProperty(this, "nativeModuleProxy", __abstract({ return global.nativeTraceBeginAsyncSection(tag, name, cookie);
nativePerformanceNow: __abstract("function"), },
UIManager: __abstract({ tag,
customBubblingEventTypes: __abstract("string"), name,
customDirectEventTypes: __abstract(), cookie,
AndroidLazyViewManagersEnabled: __abstract("boolean"), global
ViewManagerNames: undefined, );
}), else return this.nativeTraceBeginAsyncSection(tag, name, cookie);
DeviceInfo: __abstract({ },
Dimensions: __abstract({ "VALUE_DEFINED_INVARIANT"
window: undefined, );
screen: undefined, __assumeDataProperty(
windowPhysicalPixels: __abstract({ this,
width: __abstract("number"), "nativeModuleProxy",
__abstract(
{
nativePerformanceNow: __abstract("function"),
UIManager: __abstract({
customBubblingEventTypes: __abstract("string"),
customDirectEventTypes: __abstract(),
AndroidLazyViewManagersEnabled: __abstract("boolean"),
ViewManagerNames: undefined,
}), }),
}), DeviceInfo: __abstract({
}), Dimensions: __abstract({
}, "global.nativeModuleProxy")); window: undefined,
screen: undefined,
windowPhysicalPixels: __abstract({
width: __abstract("number"),
}),
}),
}),
},
"global.nativeModuleProxy"
)
);
} else { } else {
global.nativeTraceBeginAsyncSection = function (tag, name, cookie) { global.nativeTraceBeginAsyncSection = function(tag, name, cookie) {
if (global.__residual) return global.__residual("void", function (tag, name, cookie, global) { if (global.__residual)
return global.nativeTraceBeginAsyncSection(tag, name, cookie); return global.__residual(
}, tag, name, cookie, global);else return this.nativeTraceBeginAsyncSection(tag, name, cookie); "void",
function(tag, name, cookie, global) {
return global.nativeTraceBeginAsyncSection(tag, name, cookie);
},
tag,
name,
cookie,
global
);
else return this.nativeTraceBeginAsyncSection(tag, name, cookie);
}; };
global.nativeModuleProxy = { global.nativeModuleProxy = {
nativePerformanceNow: function() {}, nativePerformanceNow: function() {},
@ -49,16 +76,18 @@ if (global.__assumeDataProperty) {
windowPhysicalPixels: { windowPhysicalPixels: {
width: 42, width: 42,
}, },
} },
}, },
}; };
} }
if (global.__makePartial) __makePartial(global); if (global.__makePartial) __makePartial(global);
inspect = function() { inspect = function() {
return global.nativeTraceBeginAsyncSection !== undefined && return (
global.nativeTraceBeginAsyncSection !== undefined &&
global.nativeModuleProxy.nativePerformanceNow() === undefined && global.nativeModuleProxy.nativePerformanceNow() === undefined &&
global.nativeModuleProxy.UIManager.customBubblingEventTypes !== undefined && global.nativeModuleProxy.UIManager.customBubblingEventTypes !== undefined &&
global.nativeModuleProxy.UIManager.AndroidLazyViewManagersEnabled !== undefined && global.nativeModuleProxy.UIManager.AndroidLazyViewManagersEnabled !== undefined &&
global.nativeModuleProxy.DeviceInfo.Dimensions.windowPhysicalPixels.width !== undefined; global.nativeModuleProxy.DeviceInfo.Dimensions.windowPhysicalPixels.width !== undefined
} );
};

View File

@ -1,5 +1,7 @@
let x = global.__abstract ? __abstract("boolean", "true") : true; let x = global.__abstract ? __abstract("boolean", "true") : true;
let y = x ? 1 : 2; let y = x ? 1 : 2;
var z = y; var z = y;
var z1 = x ? { a : 123 } : { y : 456 }; var z1 = x ? { a: 123 } : { y: 456 };
inspect = function() { return z + JSON.stringify(z1); } inspect = function() {
return z + JSON.stringify(z1);
};

View File

@ -1,7 +1,8 @@
(function () { (function() {
let c = global.__abstract ? __abstract("boolean", "(true)") : true; let c = global.__abstract ? __abstract("boolean", "(true)") : true;
let o = c ? {} : {}; let o = c ? {} : {};
global.foo = o.bar; global.foo = o.bar;
inspect = function() { return global.foo; }; inspect = function() {
return global.foo;
};
})(); })();

View File

@ -1,10 +1,11 @@
(function () { (function() {
let c = global.__abstract ? __abstract("boolean", "(true)") : true; let c = global.__abstract ? __abstract("boolean", "(true)") : true;
let o1 = {}; let o1 = {};
o1.__proto__ = { bar: 42 }; o1.__proto__ = { bar: 42 };
let o2 = {}; let o2 = {};
let o = c ? o1 : o2; let o = c ? o1 : o2;
global.foo = o.bar; global.foo = o.bar;
inspect = function() { return global.foo; }; inspect = function() {
return global.foo;
};
})(); })();

View File

@ -7,16 +7,12 @@
} else { } else {
obj1.foo = true; obj1.foo = true;
} }
return {obj1, obj2}; return { obj1, obj2 };
} }
if (global.__optimize) __optimize(fn); if (global.__optimize) __optimize(fn);
global.inspect = function() { global.inspect = function() {
return JSON.stringify([ return JSON.stringify([fn(null), fn(undefined), fn(10)]);
fn(null), };
fn(undefined), })();
fn(10),
]);
}
})();

View File

@ -4,9 +4,12 @@ let arr = [];
for (let i of [1, 2, 3]) { for (let i of [1, 2, 3]) {
arr[i] = i * 10; arr[i] = i * 10;
if (x) continue; else continue; if (x) continue;
else continue;
} }
z = arr; z = arr;
inspect = function() { return "" + global.z; } inspect = function() {
return "" + global.z;
};

View File

@ -6,5 +6,6 @@ let arr = [];
for (let i of [1, 2, 3]) { for (let i of [1, 2, 3]) {
arr[i] = i * 10; arr[i] = i * 10;
if (x) continue; else break; if (x) continue;
else break;
} }

View File

@ -3,4 +3,6 @@ var obj = global.__abstract ? __abstract("object", "({ p: 41} )") : { p: 41 };
delete obj.p; delete obj.p;
z = obj.p; z = obj.p;
inspect = function() { return global.z; } inspect = function() {
return global.z;
};

View File

@ -1,7 +1,7 @@
let x = global.__abstract ? __abstract("boolean", "true") : true; let x = global.__abstract ? __abstract("boolean", "true") : true;
let ob1 = { x : 123 }; let ob1 = { x: 123 };
let ob2 = { x : 456 }; let ob2 = { x: 456 };
let o = x ? ob1 : ob2; let o = x ? ob1 : ob2;
delete o.x; delete o.x;
@ -10,4 +10,6 @@ z = o.x;
z1 = ob1.x; z1 = ob1.x;
z2 = ob2.x; z2 = ob2.x;
inspect = function() { return "" + global.z + global.z1 + global.z2; } inspect = function() {
return "" + global.z + global.z1 + global.z2;
};

View File

@ -1,7 +1,7 @@
let x = global.__abstract ? __abstract("boolean", "true") : true; let x = global.__abstract ? __abstract("boolean", "true") : true;
let ob1 = { x : 123 }; let ob1 = { x: 123 };
let ob2 = { y : 456 }; let ob2 = { y: 456 };
let o = x ? ob1 : ob2; let o = x ? ob1 : ob2;
delete o.x; delete o.x;
@ -10,4 +10,6 @@ z = o.x;
z1 = ob1.x; z1 = ob1.x;
z2 = ob2.x; z2 = ob2.x;
inspect = function() { return "" + global.z + global.z1 + global.z2; } inspect = function() {
return "" + global.z + global.z1 + global.z2;
};

View File

@ -1,8 +1,12 @@
// throws introspection error // throws introspection error
let x = __abstract("boolean", "true"); let x = __abstract("boolean", "true");
let ob1 = { x : 123 }; let ob1 = { x: 123 };
let ob2 = { get x(){ return 456; } }; let ob2 = {
get x() {
return 456;
},
};
let o = x ? ob1 : ob2; let o = x ? ob1 : ob2;
delete o.x; delete o.x;

View File

@ -1,8 +1,8 @@
// throws introspection error // throws introspection error
let x = __abstract("boolean", "true"); let x = __abstract("boolean", "true");
let ob1 = { x : 123 }; let ob1 = { x: 123 };
let ob2 = { }; let ob2 = {};
Object.defineProperty(ob2, "x", { writable: false, value: 456 }); Object.defineProperty(ob2, "x", { writable: false, value: 456 });
let o = x ? ob1 : ob2; let o = x ? ob1 : ob2;

View File

@ -1,8 +1,8 @@
let x = global.__abstract ? __abstract("boolean", "true") : true; let x = global.__abstract ? __abstract("boolean", "true") : true;
let ob1 = { x : 123 }; let ob1 = { x: 123 };
let ob2 = { y : 456 }; let ob2 = { y: 456 };
let ob3 = { }; let ob3 = {};
let o = x ? ob1 : ob2; let o = x ? ob1 : ob2;
delete o.x; delete o.x;
@ -10,4 +10,6 @@ ob1.x = ob3.x;
z = ob1.x; z = ob1.x;
inspect = function() { return "" + global.z; } inspect = function() {
return "" + global.z;
};

View File

@ -3,9 +3,9 @@ let x = global.__abstract ? __abstract("boolean", "true") : true;
let proto = {}; let proto = {};
Object.defineProperty(proto, "x", { writable: false, value: 111 }); Object.defineProperty(proto, "x", { writable: false, value: 111 });
let ob1 = { x : 123 }; let ob1 = { x: 123 };
Object.setPrototypeOf(ob1, proto); Object.setPrototypeOf(ob1, proto);
let ob2 = { y : 456 }; let ob2 = { y: 456 };
let o = x ? ob1 : ob2; let o = x ? ob1 : ob2;
delete o.x; delete o.x;

View File

@ -2,10 +2,10 @@
let x = global.__abstract ? __abstract("boolean", "true") : true; let x = global.__abstract ? __abstract("boolean", "true") : true;
let proto = { x: 111 }; let proto = { x: 111 };
let ob1 = { }; let ob1 = {};
Object.defineProperty(ob1, "x", { writable: false, configurable: true, value: 123 }); Object.defineProperty(ob1, "x", { writable: false, configurable: true, value: 123 });
Object.setPrototypeOf(ob1, proto); Object.setPrototypeOf(ob1, proto);
let ob2 = { y : 456 }; let ob2 = { y: 456 };
let o = x ? ob1 : ob2; let o = x ? ob1 : ob2;
delete o.x; delete o.x;

View File

@ -1,5 +1,6 @@
var x = global.__abstract ? __abstract("boolean", "true") : true; var x = global.__abstract ? __abstract("boolean", "true") : true;
var o = [42]; var o = [42];
if (x) delete o[0]; if (x) delete o[0];
inspect = function() { return o[0]; } inspect = function() {
return o[0];
};

View File

@ -2,4 +2,6 @@ var x = global.__abstract ? __abstract("boolean", "true") : true;
var a = [42]; var a = [42];
var o = global.__makePartial ? __makePartial(a) : a; var o = global.__makePartial ? __makePartial(a) : a;
if (x) delete o[0]; if (x) delete o[0];
inspect = function() { return o[0]; } inspect = function() {
return o[0];
};

View File

@ -1,6 +1,7 @@
var x = global.__abstract ? __abstract("boolean", "true") : true; var x = global.__abstract ? __abstract("boolean", "true") : true;
var o = function f() {} var o = function f() {};
o.x = 42; o.x = 42;
if (x) delete o.x; if (x) delete o.x;
inspect = function() { return o.x; } inspect = function() {
return o.x;
};

View File

@ -1,5 +1,6 @@
var x = global.__abstract ? __abstract("boolean", "true") : true; var x = global.__abstract ? __abstract("boolean", "true") : true;
var o = {x: 42}; var o = { x: 42 };
if (x) delete o.x; if (x) delete o.x;
inspect = function() { return o.x; } inspect = function() {
return o.x;
};

View File

@ -1,9 +1,11 @@
// does not contain:infeasible // does not contain:infeasible
(function () { (function() {
let c = global.__abstract ? __abstract("boolean", "(true)") : true; let c = global.__abstract ? __abstract("boolean", "(true)") : true;
let left = c ? 0 : 10; let left = c ? 0 : 10;
let right = c ? 5 : 15; let right = c ? 5 : 15;
let infeasible = left > right; let infeasible = left > right;
if (infeasible) throw new Error("infeasible!"); if (infeasible) throw new Error("infeasible!");
inspect = function() { return infeasible; } inspect = function() {
return infeasible;
};
})(); })();

View File

@ -6,4 +6,6 @@ do {
j = 0; j = 0;
} while (i < n); } while (i < n);
inspect = function() { return i + " " + j; } inspect = function() {
return i + " " + j;
};

View File

@ -10,4 +10,6 @@ do {
} }
} while (i < n); } while (i < n);
inspect = function() { return i + " " + j + " " + k; } inspect = function() {
return i + " " + j + " " + k;
};

View File

@ -1,9 +1,11 @@
let n = global.__abstract ? __abstract("number", "(3)") : 3; let n = global.__abstract ? __abstract("number", "(3)") : 3;
let i = 0; let i = 0;
let o = {x:0}; let o = { x: 0 };
do { do {
o.x = i; o.x = i;
i++; i++;
} while (i < n); } while (i < n);
inspect = function() { return JSON.stringify(o); } inspect = function() {
return JSON.stringify(o);
};

View File

@ -6,4 +6,6 @@ do {
i++; i++;
} while (i < n); } while (i < n);
inspect = function() { return JSON.stringify(o); } inspect = function() {
return JSON.stringify(o);
};

View File

@ -1,7 +1,9 @@
var n = global.__abstract ? __abstract('number', '(2)') : 2; var n = global.__abstract ? __abstract("number", "(2)") : 2;
let i = 0; let i = 0;
do { do {
console.log(i++); console.log(i++);
} while (i++ < n); } while (i++ < n);
inspect = function() { return i; } inspect = function() {
return i;
};

View File

@ -1,8 +1,16 @@
let template = global.__abstract ? __abstract({x: __abstract("number")}, "({ set x(v) { console.log(v); } })") : { set x(v) { console.log(v); } }; let template = global.__abstract
let n = global.__abstract ? __abstract('number', '(2)') : 2; ? __abstract({ x: __abstract("number") }, "({ set x(v) { console.log(v); } })")
: {
set x(v) {
console.log(v);
},
};
let n = global.__abstract ? __abstract("number", "(2)") : 2;
let i = 0; let i = 0;
do { do {
template.x = 3; template.x = 3;
} while (++i < n); } while (++i < n);
inspect = function() { return template.x; } inspect = function() {
return template.x;
};

View File

@ -7,4 +7,6 @@ do {
if (i > 5) throw "oopsie"; if (i > 5) throw "oopsie";
} while (i < n); } while (i < n);
inspect = function() { return i; } inspect = function() {
return i;
};

View File

@ -7,4 +7,6 @@ do {
throw "oopsie"; throw "oopsie";
} while (i < n); } while (i < n);
inspect = function() { return i; } inspect = function() {
return i;
};

Some files were not shown because too many files have changed in this diff Show More