add class property initializers, add more TraversalPath flexibility with additional node injection method

This commit is contained in:
Sebastian McKenzie
2015-03-24 03:34:34 +11:00
parent 0ee230d13c
commit de88b28988
38 changed files with 425 additions and 103 deletions

View File

@@ -0,0 +1,6 @@
@foo
class Foo {}
@foo
@bar
class Bar {}

View File

@@ -0,0 +1,20 @@
"use strict";
var Foo = (function () {
function Foo() {
babelHelpers.classCallCheck(this, Foo);
}
Foo = foo(Foo) || Foo;
return Foo;
})();
var Bar = (function () {
function Bar() {
babelHelpers.classCallCheck(this, Bar);
}
Bar = foo(Bar) || Bar;
Bar = bar(Bar) || Bar;
return Bar;
})();

View File

@@ -0,0 +1,22 @@
var autobind = function (target, name, descriptor) {
var fn = descriptor.value;
delete descriptor.value;
delete descriptor.writable;
descriptor.get = function () {
return fn.bind(this);
};
};
class Person {
constructor() {
this.first = "Sebastian";
this.last = "McKenzie";
}
@autobind
getName() {
return `${this.first} ${this.last}`;
}
}
assert.equal(new Person().getName.call(null), "Sebastian McKenzie")

View File

@@ -0,0 +1,4 @@
{
"externalHelpers": true,
"optional": ["es7.decorators"]
}

View File

@@ -0,0 +1 @@
assert.ok(false);

View File

@@ -0,0 +1 @@
assert.equal(do {}, undefined);

View File

@@ -0,0 +1,6 @@
assert.equal(do {
var obj = { foo: "bar", bar: "foo" };
for (var key in obj) {
obj[key];
}
}, "foo");

View File

@@ -0,0 +1,5 @@
assert.equal(do {
for (var i = 0; i < 5; i++) {
i;
}
}, 5);

View File

@@ -0,0 +1,7 @@
assert.equal(do {
if (false) {
"foo";
} else if (true) {
"bar";
}
}, "bar");

View File

@@ -0,0 +1,7 @@
assert.equal(do {
if (false) {
"foo";
} else {
"bar";
}
}, "bar");

View File

@@ -0,0 +1,5 @@
assert.equal(do {
if (true) {
"bar";
}
}, "bar");

View File

@@ -0,0 +1,3 @@
assert.equal(do {
do { "foo" };
}, "foo");

View File

@@ -0,0 +1,3 @@
{
"optional": ["es7.doExpressions"]
}

View File

@@ -0,0 +1,3 @@
assert.equal(do {
"foo";
}, "foo");

View File

@@ -0,0 +1,3 @@
assert.equal(do {
var bar = "foo";
}, undefined);

View File

@@ -0,0 +1,4 @@
assert.equal(do {
var bar = "foo";
bar;
}, "foo");

View File

@@ -0,0 +1 @@
assert.ok(false);