/* * This exercises stencil XDR encoding and decoding using a broad * smoke testing. * * A set of scripts exercising various codepaths are XDR-encoded, * then decoded, and then executed. Their output is compared to * the execution of the scripts through a normal path and the * outputs checked.
*/
/* * Exercises global scope access and object literals, as well as some * simple object destructuring.
*/ const testGlobal0 = 13;
let testGlobal1 = undefined; var testGlobal2 = undefined;
/* * Exercises function scopes, lexical scopes, var and let * within them, and some longer identifiers, and array destructuring in * arguments. Also contains some tiny atoms and globls access.
*/ const SCRIPT_1 = ` function foo(a, b, c) { var q = a * (b + c);
let bix = function (d, e) {
let x = a + d; var y = e * b; const a0 = q + x + y; for (let i = 0; i < 3; i++) {
y = a0 + Math.PI + y;
} return y;
}; function bang(d, [e, f]) {
let reallyLongIdentifierName = a + d; var y = e * b; const z = reallyLongIdentifierName + f; return z;
} return bix(1, 2) + bang(3, [4, 5, 6]);
}
foo(1, 2, 3)
`;
/* * Exercises eval and with scopes, object destructuring, function rest * arguments.
*/ const SCRIPT_2 = ` function foo(with_obj, ...xs) { const [x0, x1, ...xrest] = xs;
eval('var x2 = x0 + x1'); var sum = [];
with (with_obj) {
sum.push(x2 + xrest.length);
}
sum.push(x2 + xrest.length); return sum;
}
foo({x2: 99}, 1, 2, 3, 4, 5, 6)
`;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.