Nicolò Ribaudo
8ad6b75cde
Use function rather than var to compile private methods ( #12990 )
2021-03-11 02:08:31 +01:00
Nicolò Ribaudo
d04842a700
Avoid using CJS globals in internal source files ( #12963 )
...
* Lint against CJS globals in modules
* Use `import.meta.url` instead of `__filename` in `src` files
* Prepare fixtures runner for `import.meta.url`
* Use `import.meta.url` instead of `__filename` in `test/index` files
* Remove `__dirname` from remaining test files
dirname
* Avoid using `module` in `src` files
* Avoid using `require` in `src` files
* Avoid using `require` in `test` files
* Update `@types/node`
* Compile dynamic import in `@babel/node`
* Fix windows
* Use `@babel/plugin-proposal-dynamic-import` from npm
2021-03-05 19:55:36 +01:00
Huáng Jùnliàng
ac758f7d70
Ensure static private method init run before static property ( #12918 )
2021-03-04 00:02:23 +01:00
Huáng Jùnliàng
bdb207cb75
Class static private field destructure set ( #12917 )
...
* fix: support static private field destructure set ([C.#p] = [0])
* 🚧
* fix: add compatibility warning for older @babel/helper versions
* refactor: extract common routines among classPrivateFiled helpers
* More 🚧
2021-03-03 16:38:16 -05:00
Huáng Jùnliàng
70c77e550c
check descriptor before private field access ( #12910 )
...
* fix: check descriptor before private field access
* add test cases
2021-03-03 15:06:38 -05:00
Huáng Jùnliàng
82e089c7dd
Evaluate object and initializer when setting a private method ( #12707 )
...
* fix: evaluate initializer when a private method is set as a field
* make legacy node happy
* add accessor test cases
* fix: evaluate object before RHS
* fix: evaluate object before throwing writeOnlyError
2021-03-01 17:49:59 -05:00
Nicolò Ribaudo
ea6a438315
Enable external-helpers by default in tests ( #12911 )
...
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
Co-authored-by: Babel Bot <babel-bot@users.noreply.github.com>
2021-02-26 23:33:26 +01:00
Nicolò Ribaudo
6ef7b51a11
Implement assumptions defined in the babel/rfcs#5 RFC
...
- `mutableTemplateObject` and `ignoreToPrimitiveHint` (#12408 )
- `setClassMethods` (#12407 )
- `setComputedProperties` (#12490 )
- `ignoreFunctionLength` (#12491 )
- `noDocumentAll` (#12481 )
- `iterableIsArray` and `arrayLikeIsIterable` (#12489 )
- `pureGetters` (#12504 )
- `skipForOfIteratorClosing` (#12496 )
- `objectRestNoSymbols`, `setSpreadProperties` and `pureGetters` (#12505 )
- `noNewArrows` (#12613 , #12793 )
- `setPublicClassFields` and `privateFieldsAsProperties` (#12497 )
- `constantReexports` and `enumerableModuleMeta` (#12618 )
- `constantSuper`, `superIsCallableConstructor` and `noClassCalls` (#12726 )
Co-authored-by: Justin Ridgewell <justin@ridgewell.name>
Co-authored-by: Huáng Jùnliàng <JLHwung@users.noreply.github.com>
2021-02-21 17:09:45 +01:00
Nicolò Ribaudo
8063fde0d8
Reuse the readOnlyError helper for private methods ( #12792 )
2021-02-12 14:33:23 +01:00
Nicolò Ribaudo
3d69dc9471
Add # to the private name in "write-only" errors ( #12713 )
2021-01-29 17:58:13 +01:00
Federico Ciardi
5a020b24b7
fix: throw error when accessing private method without a getter ( #12689 )
...
* fix: class private accessor without getter
* Provide default return if 'writeOnlyError' is not available
* Add warning for old `@babel/helpers`
* Add missing helper call
2021-01-26 11:16:47 -05:00
Ajay Poshak
b1923fd140
Add a check for privateMap's existence ( #11571 )
...
Co-authored-by: Ajay Poshak <ajay.poshak@bookmyshow.com>
2020-05-30 22:38:15 +02:00
Nicolò Ribaudo
771c730fda
[parser] Disallow duplicate and undeclared private names ( #10456 )
...
* [parser] Add private names tracking to Scope
- Disallow duplicate private names
- Disallow undeclared private names
* Update tests
* Test all possible duplications
* Test undeclared private names
* Better error message for top-level private names
* Fix flow
* Update test262 whitelist
* Update fixtures
* Update flow whitelist
* Remove old output.json
* Move ClassScopeHandler to a separate class
* Make the code readable
2020-01-10 02:22:05 +01:00
Tim McClure
3e4889d649
Class Private Static Accessors ( #10217 )
...
* Remove error for static private accessors
* Private static accessors strict
* Add loose mode support
* Move `value` decl for early return
* Reuse getter/setter template
* Reuse getter/setter templates
* Use `buildUndefinedNode` in accessor templates
* Extract `isAccessor` variable
2019-09-06 18:08:10 +02:00
Mattias Buelens
3c11a4a930
Fix super method call in private instance method calling overridden method ( #9801 )
...
* Fix super method call in private instance method calling overridden method
* Change return value in test fixtures
* Update tests to verify that overridden method is not called
2019-03-31 18:50:29 -04:00
Tim McClure
e068281e28
Fix super Method Calls in Class Private Methods ( #9704 )
...
This fixes an issue with the use of super method calls in class private methods. See https://github.com/babel/babel/issues/9580 for more info re: behavior of the bug.
2019-03-19 18:43:02 +01:00
Tim McClure
81c130ffc9
Private Static Class Methods (Stage 3) ( #9446 )
2019-03-13 00:11:16 +01:00
Tim McClure
f44b29522c
Remove transform-classes from priv method tests ( #9537 )
2019-02-18 19:57:29 +01:00
gverni
65cbbc1ef8
Fix duplicate definition error in private class methods ( #9453 )
2019-02-04 09:19:04 -06:00
Nicolò Ribaudo
d37c958637
Transform private async and generator functions ( #9423 )
2019-02-04 15:10:46 +01:00
Tim McClure
e8de6fa5d4
Private Class Methods Stage 3: Private Accessors ( #9101 )
...
* Add accessor loose support
* Add private accessors spec support
* Fix private dupe name check
* Changes from code review
* Add duplicated names tests
* Add get/set-only tests
* Move accessors tests
* Split out updates tests
* Add helper change tests
* Update test output
* Update test options
2019-01-21 22:05:37 +01:00
Nicolò Ribaudo
865eb93c2d
[private methods] Define private methods before executing initializers ( #9248 )
2019-01-03 20:33:44 +01:00
Tim McClure
0859535b62
Private class methods stage 3 ( #8654 )
...
* Add private method syntax support
* Add private method spec support
* Add private method loose support
* Throw error if static private method is used
* Add more isStatic & isMethod checks
* Remove `writable:false` from private method inits
`writable` is false by default.
* Add private method func obj equality check
* Throw if private accessor is used
* Add check for fields === private method loose mode
* Throw buildCodeFrameErrors instead of Errors
* Move obj destructuring inside for loop
* Remove "computed" from ClassPrivateMethod type def
2018-11-28 16:20:09 -08:00