Improve yield support and restrict usage of strict
- Partially reverting91cdb93e57andeaf3911c31and reimplement - Add generators support for objects and classes - Only classes can have static methods so restrict use of it Special thanks to @rvanvelzen and @kzc for reviewing this patch and providing constructive feedback over and over again.
This commit is contained in:
20
test/mocha/object.js
Normal file
20
test/mocha/object.js
Normal file
@@ -0,0 +1,20 @@
|
||||
var Uglify = require("../../");
|
||||
var assert = require("assert");
|
||||
|
||||
describe("Object", function() {
|
||||
it ("Should allow objects to have a methodDefinition as property", function() {
|
||||
var code = "var a = {test() {return true;}}";
|
||||
assert.equal(Uglify.minify(code, {fromString: true}).code, "var a={test(){return!0}};");
|
||||
});
|
||||
|
||||
it ("Should not allow objects to use static keywords like in classes", function() {
|
||||
var code = "{static test() {}}";
|
||||
var parse = function() {
|
||||
Uglify.parse(code);
|
||||
}
|
||||
var expect = function(e) {
|
||||
return e instanceof Uglify.JS_Parse_Error;
|
||||
}
|
||||
assert.throws(parse, expect);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user