add loose option to computed property names

This commit is contained in:
Sebastian McKenzie
2015-01-14 00:35:45 +11:00
parent 8afec8b12a
commit afd3af834d
22 changed files with 168 additions and 14 deletions

View File

@@ -0,0 +1,3 @@
foo({
[bar]: "foobar"
});

View File

@@ -0,0 +1,8 @@
"use strict";
foo((function () {
var _foo = {};
_foo[bar] = "foobar";
return _foo;
})());

View File

@@ -0,0 +1,3 @@
foo = {
[bar]: "foobar"
};

View File

@@ -0,0 +1,8 @@
"use strict";
foo = (function () {
var _foo = {};
_foo[bar] = "foobar";
return _foo;
})();

View File

@@ -0,0 +1,3 @@
var foo = {
[Symbol.iterator]: "foobar"
};

View File

@@ -0,0 +1,8 @@
"use strict";
var foo = (function () {
var _foo = {};
_foo[Symbol.iterator] = "foobar";
return _foo;
})();

View File

@@ -0,0 +1,5 @@
var obj = {
[foobar]() {
return "foobar";
}
};

View File

@@ -0,0 +1,11 @@
"use strict";
var obj = (function () {
var _obj = {};
_obj[foobar] = function () {
return "foobar";
};
return _obj;
})();

View File

@@ -0,0 +1,6 @@
var obj = {
["x" + foo]: "heh",
["y" + bar]: "noo",
foo: "foo",
bar: "bar"
};

View File

@@ -0,0 +1,11 @@
"use strict";
var obj = (function () {
var _obj = {};
_obj["x" + foo] = "heh";
_obj["y" + bar] = "noo";
_obj.foo = "foo";
_obj.bar = "bar";
return _obj;
})();

View File

@@ -0,0 +1,4 @@
var obj = {
["x" + foo]: "heh",
["y" + bar]: "noo"
};

View File

@@ -0,0 +1,9 @@
"use strict";
var obj = (function () {
var _obj = {};
_obj["x" + foo] = "heh";
_obj["y" + bar] = "noo";
return _obj;
})();

View File

@@ -0,0 +1,3 @@
{
"loose": ["computedPropertyNames"]
}

View File

@@ -0,0 +1,3 @@
var obj = {
["x" + foo]: "heh"
};

View File

@@ -0,0 +1,8 @@
"use strict";
var obj = (function () {
var _obj = {};
_obj["x" + foo] = "heh";
return _obj;
})();

View File

@@ -0,0 +1,3 @@
var obj = {
["x" + this.foo]: "heh"
};

View File

@@ -0,0 +1,9 @@
"use strict";
var _this = this;
var obj = (function () {
var _obj = {};
_obj["x" + _this.foo] = "heh";
return _obj;
})();

View File

@@ -0,0 +1,4 @@
var obj = {
first: "first",
["second"]: "second",
};

View File

@@ -0,0 +1,9 @@
"use strict";
var obj = (function () {
var _obj = {};
_obj.first = "first";
_obj.second = "second";
return _obj;
})();

View File

@@ -0,0 +1,3 @@
var foo = {
[bar]: "foobar"
};

View File

@@ -0,0 +1,8 @@
"use strict";
var foo = (function () {
var _foo = {};
_foo[bar] = "foobar";
return _foo;
})();