Implement harmony generators and yield
Uses #716's implementation and adds tests. Fixes #716.
This commit is contained in:
committed by
Richard van Velzen
parent
634f231b78
commit
91cdb93e57
@@ -418,3 +418,19 @@ regression_cannot_use_of: {
|
||||
foo(); /* Label statement missing? No prob. */
|
||||
}
|
||||
}
|
||||
|
||||
generators: {
|
||||
input: {
|
||||
function* fn() {};
|
||||
}
|
||||
expect_exact: "function*fn(){}"
|
||||
}
|
||||
|
||||
generators_yield: {
|
||||
input: {
|
||||
function* fn() {
|
||||
yield remote();
|
||||
}
|
||||
}
|
||||
expect_exact: "function*fn(){yield remote()}"
|
||||
}
|
||||
|
||||
@@ -118,6 +118,17 @@ module.exports = function () {
|
||||
ok.equal(expanding_def.name.names[0].TYPE, 'SymbolVar');
|
||||
ok.equal(expanding_def.name.names[1].TYPE, 'Expansion');
|
||||
ok.equal(expanding_def.name.names[1].symbol.TYPE, 'SymbolVar');
|
||||
|
||||
// generators
|
||||
var generators_def = UglifyJS.parse('function* fn() {}').body[0];
|
||||
ok.equal(generators_def.is_generator, true);
|
||||
|
||||
ok.throws(function () {
|
||||
UglifyJS.parse('function* (){ }');
|
||||
});
|
||||
|
||||
var generators_yield_def = UglifyJS.parse('function* fn() {\nyield remote();\}').body[0].body[0];
|
||||
ok.equal(generators_yield_def.body.operator, 'yield');
|
||||
}
|
||||
|
||||
// Run standalone
|
||||
|
||||
Reference in New Issue
Block a user