Skip to content

Instantly share code, notes, and snippets.

@caitp caitp/results.sh Secret
Created Dec 23, 2014

Embed
What would you like to do?
IT WORKS!! (sort of... it breaks `arguments` slightly and doesn't work when optimized :( --- oh and doesn't work at all for arrow functions .____.)
[00:00|% 100|+ 0|- 1]: Done
EchoBeach-2:v8 caitp$ out/x64.release/d8 --harmony-rest-parameters test.js
STRICT MODE
[]
[2,3]
[2]
SLOPPY 'FAST' MODE
[]
[2,3]
[2]
SLOPPY 'SLOW' MODE
[1]
[1,2,3]
[1,2]
(function() {
"use strict";
function fn(a, ...b) {
return b;
}
print("STRICT MODE");
print(JSON.stringify(fn(1)));
print(JSON.stringify(fn(1, 2, 3)));
print(JSON.stringify(fn(1, 2)));
print("\n");
})();
(function() {
function fn(a, ...b) {
return b;
}
print("SLOPPY 'FAST' MODE");
print(JSON.stringify(fn(1)));
print(JSON.stringify(fn(1, 2, 3)));
print(JSON.stringify(fn(1, 2)));
print("\n");
})();
(function() {
function fn(a, a, ...b) {
return b;
}
print("SLOPPY 'SLOW' MODE");
print(JSON.stringify(fn(1, 1)));
print(JSON.stringify(fn(1, 1, 2, 3)));
print(JSON.stringify(fn(1, 1, 2)));
print("\n");
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.