Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Private Static Class Fields Implementation
- Loading branch information
Robin Ricard
committed
Jun 21, 2018
1 parent
9283efa
commit 2824e86
Showing
51 changed files
with
833 additions
and
353 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 0 additions & 3 deletions
3
...-plugin-proposal-class-properties/test/fixtures/private-loose/native-classes/options.json
This file was deleted.
Oops, something went wrong.
39 changes: 29 additions & 10 deletions
39
...bel-plugin-proposal-class-properties/test/fixtures/private-loose/native-classes/output.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,37 @@ | ||
var _foo, _bar; | ||
var Foo = | ||
/*#__PURE__*/ | ||
function () { | ||
"use strict"; | ||
|
||
class Foo { | ||
constructor() { | ||
function Foo() { | ||
babelHelpers.classCallCheck(this, Foo); | ||
Object.defineProperty(this, _bar, { | ||
writable: true, | ||
value: "bar" | ||
}); | ||
} | ||
|
||
} | ||
babelHelpers.createClass(Foo, [{ | ||
key: "test", | ||
value: function test() { | ||
return babelHelpers.classPrivateFieldLooseBase(this, _bar)[_bar]; | ||
} | ||
}], [{ | ||
key: "test", | ||
value: function test() { | ||
return babelHelpers.classStaticPrivateFieldBase(Foo, Foo, _FooStatics)._foo; | ||
} | ||
}]); | ||
return Foo; | ||
}(); | ||
|
||
_foo = babelHelpers.classPrivateFieldKey("foo"); | ||
Object.defineProperty(Foo, _foo, { | ||
writable: true, | ||
value: "foo" | ||
}); | ||
_bar = babelHelpers.classPrivateFieldKey("bar"); | ||
var _FooStatics = {}; | ||
_FooStatics._foo = "foo"; | ||
|
||
var _bar = babelHelpers.classPrivateFieldLooseKey("bar"); | ||
|
||
var f = new Foo(); | ||
expect("foo" in Foo).toBe(false); | ||
expect("bar" in f).toBe(false); | ||
expect(Foo.test()).toBe("foo"); | ||
expect(f.test()).toBe("bar"); |
3 changes: 0 additions & 3 deletions
3
...n-proposal-class-properties/test/fixtures/private-loose/non-block-arrow-func/options.json
This file was deleted.
Oops, something went wrong.
41 changes: 22 additions & 19 deletions
41
...gin-proposal-class-properties/test/fixtures/private-loose/non-block-arrow-func/output.mjs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,28 @@ | ||
export default (param => { | ||
var _props, _class, _temp; | ||
var _class, _temp; | ||
|
||
return _temp = _class = | ||
/*#__PURE__*/ | ||
function () { | ||
function App() { | ||
babelHelpers.classCallCheck(this, App); | ||
} | ||
|
||
babelHelpers.createClass(App, [{ | ||
key: "getParam", | ||
value: function getParam() { | ||
return param; | ||
return function () { | ||
_temp = _class = | ||
/*#__PURE__*/ | ||
function () { | ||
function App() { | ||
babelHelpers.classCallCheck(this, App); | ||
} | ||
}]); | ||
return App; | ||
}(), _props = babelHelpers.classPrivateFieldKey("props"), Object.defineProperty(_class, _props, { | ||
writable: true, | ||
value: { | ||
|
||
babelHelpers.createClass(App, [{ | ||
key: "getParam", | ||
value: function getParam() { | ||
return param; | ||
} | ||
}]); | ||
return App; | ||
}(); | ||
|
||
var _classStatics = {}; | ||
_classStatics._props = { | ||
prop1: 'prop1', | ||
prop2: 'prop2' | ||
} | ||
}), _temp; | ||
}; | ||
return _temp; | ||
}(); | ||
}); |
3 changes: 0 additions & 3 deletions
3
...bel-plugin-proposal-class-properties/test/fixtures/private-loose/reevaluated/options.json
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.