Skip to content

Commit 7890314

Browse files
authored
Merge pull request #14 from ssutar/class_fields
Add options for class fields
2 parents 12c70f0 + a5b985d commit 7890314

18 files changed

Lines changed: 151 additions & 241 deletions

transforms/ember-object/__testfixtures__/basic.input.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Program comments
33
*/
4-
const Foo = Test.extend({
4+
const Foo = Test.extend(MyMixin, {
55
/**
66
* Property comments
77
*/
@@ -31,3 +31,5 @@ const Foo = Test.extend({
3131
this._super(...arguments);
3232
}
3333
});
34+
35+
const Foo = EmberObject.extend(MixinA, MixinB);

transforms/ember-object/__testfixtures__/basic.output.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* Program comments
33
*/
4-
class Foo extends Test {
4+
class Foo extends Test.extend(MyMixin) {
55
/**
66
* Property comments
77
*/
@@ -31,4 +31,6 @@ class Foo extends Test {
3131
anotherMethod() {
3232
super.anotherMethod(...arguments);
3333
}
34-
}
34+
}
35+
36+
class Foo extends EmberObject.extend(MixinA, MixinB) {}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Program comments
3+
*/
4+
const Foo = Test.extend({
5+
/**
6+
* Property comments
7+
*/
8+
prop: "defaultValue",
9+
boolProp: true,
10+
numProp: 123,
11+
[MY_VAL]: "val",
12+
13+
/**
14+
* Method comments
15+
*/
16+
method() {
17+
// do things
18+
},
19+
20+
otherMethod: function() {},
21+
22+
get accessor() {
23+
return this._value;
24+
},
25+
26+
set accessor(value) {
27+
this._value = value;
28+
},
29+
30+
anotherMethod() {
31+
this._super(...arguments);
32+
}
33+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"classFields": false
3+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/**
2+
* Program comments
3+
*/
4+
const Foo = Test.extend({
5+
/**
6+
* Property comments
7+
*/
8+
prop: "defaultValue",
9+
boolProp: true,
10+
numProp: 123,
11+
[MY_VAL]: "val",
12+
13+
/**
14+
* Method comments
15+
*/
16+
method() {
17+
// do things
18+
},
19+
20+
otherMethod: function() {},
21+
22+
get accessor() {
23+
return this._value;
24+
},
25+
26+
set accessor(value) {
27+
this._value = value;
28+
},
29+
30+
anotherMethod() {
31+
this._super(...arguments);
32+
}
33+
});
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* Program comments
3+
*/
4+
const Foo = Test.extend({
5+
/**
6+
* Method comments
7+
*/
8+
method() {
9+
// do things
10+
},
11+
12+
otherMethod: function() {},
13+
14+
get accessor() {
15+
return this._value;
16+
},
17+
18+
set accessor(value) {
19+
this._value = value;
20+
},
21+
22+
anotherMethod() {
23+
this._super(...arguments);
24+
}
25+
});
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"classFields": false
3+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/**
2+
* Program comments
3+
*/
4+
class Foo extends Test {
5+
/**
6+
* Method comments
7+
*/
8+
method() {
9+
// do things
10+
}
11+
12+
otherMethod() {}
13+
14+
get accessor() {
15+
return this._value;
16+
}
17+
18+
set accessor(value) {
19+
this._value = value;
20+
}
21+
22+
anotherMethod() {
23+
super.anotherMethod(...arguments);
24+
}
25+
}

transforms/ember-object/__testfixtures__/decorators.invalid.input.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,3 @@ const Foo = EmberObject.extend({
88
const Foo = EmberObject.extend({
99
macroValue: macro()
1010
});
11-
12-
// Do not transform as extends Mixin
13-
const Foo = EmberObject.extend(MyMixin, {
14-
biz: "div"
15-
});

transforms/ember-object/__testfixtures__/decorators.invalid.output.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,3 @@ const Foo = EmberObject.extend({
88
const Foo = EmberObject.extend({
99
macroValue: macro()
1010
});
11-
12-
// Do not transform as extends Mixin
13-
const Foo = EmberObject.extend(MyMixin, {
14-
biz: "div"
15-
});

0 commit comments

Comments
 (0)