Samuel Reed
c307bbb3a9
Fix PathHoister hoisting before a same-scope variable declaration.
...
Seems we didn't have tests running for this very simple case.
Also fixes #5520
2017-05-01 14:32:11 -07:00
Samuel Reed
c3e8cc8ad6
Fix PathHoister error attaching after export declarations.
...
Fixes #5369 .
See also 4ee385e96c/packages/babel-plugin-transform-class-properties/src/index.js (L167)
2017-05-01 12:41:29 -07:00
Damien Maillard
299e51298c
Fix path.remove() leading & trailing comments sharing ( #5504 )
2017-03-23 11:55:14 -04:00
Samuel Reed
f20da57317
Fix PathHoister attaching to default parameters. ( #5415 )
...
* Fix PathHoister attaching to default parameters.
Ref: #5315
* Update hoister.js
2017-03-22 16:37:53 -04:00
MrSpider
5287e13817
Fix replacing function declaration in export default ( fixes #4468 ) ( #5444 )
2017-03-10 11:41:03 -08:00
Brian Ng
8a82cc060a
Run new lint rules ( #5413 )
2017-03-04 10:46:01 -05:00
Henry Zhu
3ff77a61e4
Update babylon beta 3 ( #5394 )
...
* Update babylon to v7-beta.3
* convert RestProperty/SpreadProperty to RestElement/SpreadElement
* add virtual types to make it easier to upgrade
2017-02-28 16:58:19 -05:00
Marcelo Dapper
724c949244
Replace lodash/assign with Object.assign ( #5356 )
...
Remove imports to lodash/assign and replace assign with Object.assign.
The lodash/assign is unnecessary for babel 7 as node >4 has the same
functionality built-in with Object.assign as used here.
This resolve the [issue 5353](https://github.com/babel/babel/issues/5353 )
2017-02-21 22:08:20 -05:00
Logan Smyth
4ee385e96c
Avoid usage of exports/module.exports/require().
2017-02-21 16:52:42 -08:00
Logan Smyth
454933ef76
Revert "Rewrite Hub as interface #5047 " ( #5306 )
2017-02-13 18:15:50 -08:00
Yongxu Ren
2985597d40
Rewrite Hub as interface #5047 ( #5050 )
...
* Rewrite Hub as interface #5047
* Update index.js
2017-02-13 12:49:10 -08:00
Logan Smyth
4edcd02965
Fix linting error
2017-02-12 18:48:07 -08:00
Samuel Reed
f4e3dfee74
Fix PathHoister hoisting before bindings. ( #5153 )
...
Fixes #5149 and enables a few additional safe hoists.
2017-02-12 18:35:08 -08:00
Samuel Reed
eb91bd831c
Fix PathHoister hoisting JSX member expressions on "this". ( #5143 )
...
The PathHoister ignored member references on "this", causing it
to potentially hoist an expression above its function scope.
This patch tells the hoister to watch for "this", and if seen,
mark the nearest non-arrow function scope as the upper limit
for hoistng.
This fixes #4397 and is an alternative to #4787 .
2017-02-12 18:34:07 -08:00
Brian Ng
6da9bb83df
Prevent multiple return statements in a loop when replacing expressions ( #5030 )
2017-02-09 13:06:41 -08:00
Boopathi Rajaa
f8ffe03e79
Deopt evaluation of undefined with a local binding. Fix #5204 ( #5206 )
2017-02-08 10:37:14 -05:00
Vicente Jr Yuchitcho
1ba4a3fe5d
Add path sibling traversal methods ( #5230 )
...
* getPrevSibling
* getNextSibling
* getAllNextSiblings
* getAllPrevSiblings
2017-02-07 11:17:50 -05:00
Logan Smyth
b845f2b69d
Re-enable the max-len ESLint rule. ( #5265 )
2017-02-04 11:07:15 -05:00
Jason Aslakson
ef25bebfa8
fix issue #5012 - Cannot read property 'declarations' of null ( #5019 )
...
- temporary fix
2017-01-19 21:36:18 -05:00
Henry Zhu
672adba9a1
enable prefer const ( #5113 )
2017-01-14 09:48:52 -05:00
Jeff Morrison
b820d8ebc9
Strip Flow's new shorthand import-type specifiers
2017-01-13 13:24:33 -05:00
Daniel Tschinder
dc617129f6
Optimize removal-hooks for ArrowFunctions ( #5076 )
2017-01-09 09:05:23 -05:00
Henry Zhu
670ee996c8
Merge pull request #4940 from appden/fix-react-constant-elements
...
Fix React constant element bugs
2016-12-16 15:29:05 -05:00
Brian Ng
196cdd4dce
Bail on sharing comments with siblings if key is a string ( #5007 )
2016-12-16 10:52:48 -05:00
Boopathi Rajaa
73ff13f326
Add getBindingIdentifierPaths/getOuterBindingIdentifierPaths ( #4876 )
2016-12-08 12:43:14 -05:00
Scott Kyle
c438209718
Fix constant elements hoisted before declarator ( #4804 )
...
When multiple declarators are present in a declaration, we want to insert the constant element inside the declaration rather than placing it before because it may rely on a declarator inside that same declaration.
2016-12-03 20:19:32 -08:00
Daniel Tschinder
1d9e509df2
Fix eslint ( #4897 )
...
* Fix eslint call
* Fix linting errors
2016-11-26 11:24:38 -05:00
Boopathi Rajaa
7e020272c1
Fix path.evaluate for references before declarations ( #4875 )
2016-11-20 22:44:56 -05:00
Henry Zhu
4462d59acd
refactor: switch ancestory/descendant logic [skip ci]
...
- Ref https://github.com/babel/babel/pull/4836#discussion_r88118790 @jridgewell
2016-11-15 16:41:08 -05:00
Boopathi Rajaa
55a47a8819
Add path utilities isAncestor and isDescendant ( #4836 )
...
* Add path utilities isAncestor and isDescendant
* Create ancestry.js
2016-11-15 16:36:45 -05:00
Andrew Levine
555ee0cb51
Don't treat JSXIdentifier in JSXMemberExpression as HTML tag. Closes #4027 ( #4765 )
2016-10-24 10:42:50 -04:00
Moti Zilberman
fd4667e649
Increase test coverage ( #4742 )
...
* Add tests for path type inferers
* Add test for babel-types.valueToNode
* Add tests for babel-types.toKeyAlias
* Add tests for babel-types.toStatement
* Add tests for babel-types.toExpression
* Lint fixes in babel-traverse/test/inference
2016-10-23 10:51:09 +02:00
Moti Zilberman
6bc10b5573
Support ObjectExpression in static path evaluation ( #4746 )
2016-10-17 18:55:02 -04:00
Sam Goldman
15183078e6
Add EmptyTypeAnnotation ( #4724 )
...
Added to Flow in facebook/flow#c603505583993aa953904005f91c350f4b65d6bd
Parser support added in babel/babylon#171 .
2016-10-14 15:16:02 -04:00
Daniel Tschinder
590ad4d24f
Replace phabricator tickets with github ones in code comments ( #4519 )
2016-09-17 22:50:02 -04:00
Boopathi Rajaa
183d9570f9
Fix bug where redeclaration of var doesn't deopt ( #3559 )
...
* Fix bug where redeclaration of var doesn't deopt. (Close T7470)
* [evaluate] Add tests for cases - let/const/different scopes
2016-08-17 19:23:09 -04:00
Erik Desjardins
aeb42c2228
Fix bug where path.evaluate treats repeated identifiers as undefined ( #3557 )
...
* babel-traverse: add test to demonstrate repeated identifiers being evaluated to `false`
* fix typo: `value` -> `val`
* path.evaluate: only mark item as resolved if we're confident
2016-08-04 16:58:41 -04:00
Sebastian McKenzie
3b4b3656a8
Fix React constant elements transform from hoisting elements to positions where their referenced bindings haven't been evaluated yet ( #3596 )
2016-07-27 10:54:21 -04:00
Jhen
e464b9ab87
Add block if parent is no block statement for remove-console/debugger
2016-07-19 12:56:29 +08:00
Sebastian McKenzie
b2390cca02
deopt on recursion in path.evaluate - fixes T7397
2016-06-19 22:08:39 +01:00
Jordan Klassen
dc1f40540d
Upgrade to lodash 4 ( #3315 )
...
* Upgrade to lodash 4
* Fix incorrect require in babel-runtime/scripts
* Replace cloneDeep with cloneDeepWith where applicable
2016-05-13 17:15:14 -04:00
Logan Smyth
9843c87573
Fix block statement code style. ( #3493 )
2016-05-02 21:15:37 -04:00
Logan Smyth
bad2c768f2
Remove this check which will never pass with the new cache.
2016-03-23 20:57:18 -07:00
Simeon Willbanks
93d438cf01
Fix misspelling
2016-03-16 22:17:09 -07:00
Logan Smyth
de21f2ef77
Resolve 'arguments' for rest args relative to direct parent.
2016-03-07 20:45:21 -08:00
Logan Smyth
836f398619
Re-use central inShadow logic.
2016-03-07 20:45:19 -08:00
Logan Smyth
8b8e3ddbec
Flatten inShadow logic for readability.
2016-03-07 20:45:18 -08:00
Amjad Masad
b53755422c
Move things around
2016-03-07 12:04:44 -08:00
Amjad Masad
bf91a68375
Move scope cache to the cache module
2016-03-07 12:04:44 -08:00
Amjad Masad
29ef158204
Semis
2016-03-07 12:03:48 -08:00