Justin Ridgewell
21c7ff3f37
Classes cleanup ( #7737 )
...
* Cleanup
* Move verifyConstructorVisitor out of closure
2018-04-17 17:52:43 -04:00
Justin Ridgewell
668358c4d0
Fix class properties after nested class' bare super ( #7671 )
...
* Fix class properties after nested class' bare super
Fixes #7371 .
* Fix node 4 test
* This damn node 4 test
* All of the ClassBody, but not the methods or field inits
* tmp
* tmp
* Use common class environment visitor
* Tests
* Use skipKey to avoid recursive traversal
* Remove old state
* Use jest expect
2018-04-14 13:48:38 -04:00
Justin Ridgewell
7ae724f553
Add Path#isInStrictMode ( #7712 )
...
* Add Path#isInStrictMode
* Fix undefined directives
* Explicitly return for arrow expressions
2018-04-11 09:13:38 -04:00
Devon Govett
6a8c4ab433
Make babel-types type checking functions 36% faster ( #7685 )
...
* Precompile 25% faster type checking functions
* Pre-fetch type-check function when generating NodePath methods
Additional ~11% speed improvement.
* Slightly faster assert calls
2018-04-09 15:11:04 -04:00
Justin Ridgewell
43040a4181
Private Properties phase 1 ( #7666 )
...
* Private Properties phase 1
Co-authored-by: CodingItWrong
* Private fields are optional
* Docs update
2018-04-05 11:17:34 +01:00
Logan Smyth
4d76d5dddc
Refactor Babel's helpers into smaller functions.
2018-03-05 09:32:39 -08:00
Mateusz Burzyński
d283324f8a
Mark hoisted react constant elements as #__PURE__ ( #7372 )
2018-02-21 18:58:56 +01:00
Mateusz Burzyński
4d164bd8e6
Added babel-helper-split-export-declaration ( #7313 )
2018-02-13 16:44:05 +01:00
Nicolò Ribaudo
4887d81929
Remove bindings of removed paths from scope
2018-02-06 23:59:12 +01:00
Kai Cataldo
7234442fde
Add location information to parsing errors ( #7314 )
2018-02-04 13:00:03 -06:00
Logan Smyth
278cd5e572
Preserve identifier location information when mapping this and arguments. ( #7312 )
2018-02-01 18:54:15 -08:00
Nicolò Ribaudo
252ea5a966
Fix reused nodes - part 2 ( #7149 )
2018-01-29 22:59:06 +01:00
Mateusz Burzyński
912bcc186d
Fix reused nodes - part 1 ( #7149 )
2018-01-29 22:59:06 +01:00
Brian Ng
064c17e03f
Bump prettier and related deps ( #7244 )
2018-01-20 17:00:21 +01:00
Luca
5ac8ba19a4
Fix typo [skip ci] ( #7229 )
2018-01-17 13:43:59 -05:00
Mateusz Burzyński
0a517b51cd
Added custom NodePath.prototype.toString method as debug utility ( #7218 )
2018-01-15 13:07:05 +01:00
Mateusz Burzyński
79c84f2f9b
Fixed _containerInsertAfter setting path key as stringified index ( #7213 )
2018-01-15 08:08:42 +01:00
Nicolò Ribaudo
2297e2d764
Fix a regression introduced in #7040 ( #7116 )
2017-12-28 22:15:53 +01:00
Nicolò Ribaudo
68476b6ddd
Make .insert{Before,After} work by default when the parent is an eport declaration ( #7040 )
2017-12-19 00:05:29 +01:00
Brian Ng
c7980b2b90
Bump prettier ( #6991 )
2017-12-07 17:36:49 -05:00
Nicolò Ribaudo
a2aabbd33d
Generate better builder names for JSX* and TS* ( #6967 )
...
e.g. JSXIdentifier -> jsxIdentifier.
The jSXIdentifier alias isn't removed, so this commit doesn't introduce breaking changes.
2017-12-07 12:17:40 +01:00
Daniel Tschinder
9206df964d
Use only imports in babel-traverse and remove double exports ( #6881 )
2017-11-23 20:59:54 +01:00
Brian Ng
c583a04a55
Fix setting deopt properly after evaluating multiple expressions ( #6882 )
2017-11-22 20:06:57 -05:00
Logan Smyth
0e88156d0c
Add warnings to places where we might allow promises to be returned in later minors.
2017-11-13 11:58:30 -08:00
Nicolò Ribaudo
9a231c5671
Remove support for flow bindings ( #6528 )
...
Flow bindings have been deprecated for a while.
The reason behind this change is that `declare var foo`
doesn't introduce a new local binding, but it represents
a global one.
2017-11-09 12:29:04 -08:00
Diogo Franco
81811bf1b9
Fix transform-arrow-functions in { spec: true } shadowing ( #6760 )
...
* Fix transform-arrow-functions in { spec: true } shadowing
The function name matching the variable declaration name could
shadow the actual function object inside the generated function,
leading to invalid behavior due to holding a reference to the
original unbound function.
* Combine it with transform-function-name just to be sure in spec: false
* Revert "Fix transform-arrow-functions in { spec: true } shadowing"
This reverts commit 1cafe2561d0b0ddd181b956a85eb074621da12e8.
* Much simpler version of the above fix
* Missing fixture updates
* Avoid using rest/spread to make the tests pass on node 4
* ...actually update _all_ the fixtures
2017-11-08 17:21:30 -05:00
Mateusz Burzyński
a1c7449a92
Fixed incorrect static class field initialization order ( #6530 )
2017-10-30 16:32:45 -04:00
Benedikt Meurer
f9e0643460
Fix path.popContext() to not try to load "-1" from contexts array. ( #6580 )
...
* Fix path.popContext() to not try to load "-1" from contexts array.
The current implement of popContext does
```js
this.setContext(this.contexts[this.contexts.length - 1]);
```
even if `this.contexts` can be empty, which causes it to lookup the
property `"-1"`, which is not found on the array itself and obviously
also not in the `Object.prototype` and the `Array.prototype`. However
since `"-1"` is not a valid array index, but has a valid integer
representation, this is a very expensive lookup in V8 (and probably
other engines too, but that is probably less relevant, since Babel
most often runs on Node nowadays).
* Make zero check explicit (for readability).
2017-10-28 16:17:05 -04:00
Mateusz Burzyński
859ea4b175
Scoped: updated numerous docs with scoped packages change [skip ci]
2017-10-16 22:49:57 -04:00
Henry Zhu
cde0054227
Scoped: change src imports to @babel/ [skip ci]
2017-10-16 22:49:56 -04:00
William
36d8a13f4d
Fix catch error on do expression and add tests ( #6372 )
...
Fixes #6331
2017-10-04 18:19:54 +02:00
Logan Smyth
eae76e5b89
Break apart the File class into multiple files and add type definitions.
2017-10-02 13:55:37 -07:00
Logan Smyth
c1df126b83
Remove wrap function and calculate code frames earlier.
2017-10-02 13:48:02 -07:00
Justin Ridgewell
73fba55c9f
Requeueing sometimes has wrong scope ( #6351 )
...
This prevents a requeued path from inheriting a totally wrong scope later on. I can't find exactly where this is happening, but either way a path should only inherit scope from it's ancestors.
2017-10-02 15:26:10 -04:00
Henry Zhu
6816b26994
Merge pull request #6356 from JeromeFitz/babel-messages-inline
...
Remove babel-messages and inline the usages
2017-09-30 23:25:06 -04:00
JeromeFitz
ae168edcfa
Remove babel-messages ( #6347 ), continuation of #6352
...
package.json "babel-messages" removed:
- babel-core
- babel-helper-replace-supers
- babel-plugin-transform-es2015-classes
- babel-traverse
"messages" remove from:
- babel-plugin-check-es2015-constants/src/index.js
- babel-plugin-transform-es2015-for-of/src/index.js
export "babel-messages" removed from:
- babel-core/src/index.js
import "babel-messages" removed from:
- babel-generator/src/index.js
- babel-helper-replace-supers/src/index.js
- babel-traverse/src/index.js
- babel-traverse/src/scope/index.js
- babel-traverse/src/visitors.js
package "babel-messages" removed completely.
💯 ️ All tests pass.
2017-09-30 09:31:53 -04:00
Abhilash Singh
6230855b71
unshiftContainer seems to incorrectly handle function params #6150 ( #6354 )
2017-09-30 09:14:51 -04:00
Justin Ridgewell
0e432f0e0d
Remove debug closures ( #6349 )
...
God, can you imagine how many useless closures this was creating?
2017-09-29 21:31:43 -04:00
Justin Ridgewell
3746273eda
Path#ensureBlock keeps path context ( #6337 )
...
* Path#ensureBlock keeps path context
This ensures that if you're inside an ArrowFunction with an expression body (say, you're on the BooleanLiteral in `() => true`), you don't suddenly lose your path context after inserting a variable.
This is because of 82d8aded8e (diff-9e0668ad44535be897b934e7077ecea5R14) . Basically, an innocent `Scope#push` caused my visitor to suddenly stop working. Now, we mutate the Path so it's still in the tree.
* Tests
2017-09-29 19:00:10 -04:00
Logan Smyth
8339e036bf
Remove babel.analyse and surrounding helpers.
2017-09-29 15:17:11 -07:00
Mateusz Burzyński
413ffe6639
Extracted babel-helper-annotate-as-pure ( #6267 )
2017-09-25 17:40:51 +02:00
Logan Smyth
20679979fc
Remove the unused 'scope' param from 'traverse.hasType'.
2017-09-12 16:48:05 -07:00
Justin Ridgewell
4daf11528c
Return inserted/replaced paths ( #5710 )
...
* Return inserted/replaced paths
This gives `Path`’s replacement and insertion methods a consistent
return value: the inserted/replaced paths.
Before, they could return `undefined`, a `node`, or a the current path
inside an array. It was kinda pointless. But now they always return an
array of paths, which is useful for solving
https://github.com/babel/babel/pull/4935#discussion_r96151368 .
* Return inserted nodes and not BlockStatement
Addded test for bug #4363
* Cleanups
- `#replaceWith` will now return the current path if it's the same node
- `#insertAfter` and `#insertBefore` use public Path APIs now
- Makes container insertion faster (single splice call)
- Use public APIs in container insertion
- Replacing a statement with an expression returns the expression's path
- Replacing an expression with multiple statements returns the inserted
closure's body's paths.
2017-09-11 16:07:04 -04:00
Ruben Verborgh
6560a29c36
Redeclaring a variable counts as a modification ( #6219 )
...
* Redeclaring a variable counts as a modification.
Fixes #6217 .
* Remove "existing" logic from Binding.
Was added in #5745 , but no longer triggered since 6536e605a.
2017-09-08 23:02:26 -04:00
Justin Ridgewell
5df70e6a94
Fix bad Scope#parent caching ( #6155 )
...
* Fix bad Scope#parent caching
Now, we traverse the path until we find a parent scope.
Fixes #6057 .
* Fix bad merge
* Remove cached data
* I need to stop using Github editor
* Fix infinite loops due to scopable paths being moved up
2017-09-02 01:03:10 -04:00
Daniel Tschinder
ca117e08cb
fix(requeue): Always requeue implicitely created BlockStatements ( #6193 )
...
This reverts the former fix done in #5743 and always requeues
BlockStatements when they get created.
This also fixes a bug in babel-generator which would indent code
even though no comments are present.
2017-09-02 01:02:21 -04:00
Daniel Tschinder
44f6ff5e85
Update prettier, eslint + plugins, flow, husky and lint-staged ( #6183 )
2017-08-31 22:56:29 +02:00
Daniel Tschinder
0189b38702
Merge branch '6.x' into 7.0
...
# Conflicts:
# CONTRIBUTING.md
# Makefile
# README.md
# lerna.json
# lib/types.js
# package.json
# packages/babel-cli/package.json
# packages/babel-code-frame/package.json
# packages/babel-core/package.json
# packages/babel-core/test/fixtures/transformation/misc/regression-2892/expected.js
# packages/babel-generator/package.json
# packages/babel-generator/src/generators/flow.js
# packages/babel-generator/src/index.js
# packages/babel-generator/test/fixtures/flow/declare-statements/expected.js
# packages/babel-generator/test/fixtures/flow/object-literal-types/expected.js
# packages/babel-generator/test/fixtures/flow/opaque-type-alias/expected.js
# packages/babel-helper-bindify-decorators/package.json
# packages/babel-helper-builder-binary-assignment-operator-visitor/package.json
# packages/babel-helper-builder-conditional-assignment-operator-visitor/package.json
# packages/babel-helper-builder-react-jsx/package.json
# packages/babel-helper-call-delegate/package.json
# packages/babel-helper-define-map/package.json
# packages/babel-helper-explode-assignable-expression/package.json
# packages/babel-helper-explode-class/package.json
# packages/babel-helper-fixtures/package.json
# packages/babel-helper-function-name/package.json
# packages/babel-helper-get-function-arity/package.json
# packages/babel-helper-hoist-variables/package.json
# packages/babel-helper-optimise-call-expression/package.json
# packages/babel-helper-plugin-test-runner/package.json
# packages/babel-helper-regex/package.json
# packages/babel-helper-remap-async-to-generator/package.json
# packages/babel-helper-replace-supers/package.json
# packages/babel-helper-transform-fixture-test-runner/package.json
# packages/babel-helpers/package.json
# packages/babel-plugin-transform-async-generator-functions/package.json
# packages/babel-plugin-transform-async-to-generator/package.json
# packages/babel-plugin-transform-async-to-module-method/package.json
# packages/babel-plugin-transform-class-constructor-call/package.json
# packages/babel-plugin-transform-class-properties/package.json
# packages/babel-plugin-transform-decorators/package.json
# packages/babel-plugin-transform-es2015-block-scoping/package.json
# packages/babel-plugin-transform-es2015-classes/package.json
# packages/babel-plugin-transform-es2015-classes/test/fixtures/regression/T6755/expected.js
# packages/babel-plugin-transform-es2015-computed-properties/package.json
# packages/babel-plugin-transform-es2015-duplicate-keys/package.json
# packages/babel-plugin-transform-es2015-function-name/package.json
# packages/babel-plugin-transform-es2015-modules-amd/package.json
# packages/babel-plugin-transform-es2015-modules-commonjs/package.json
# packages/babel-plugin-transform-es2015-modules-commonjs/src/index.js
# packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/interop/export-destructured/expected.js
# packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/strict/export-const-destructuring-object-default-params/expected.js
# packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/strict/export-const-destructuring-object-rest/expected.js
# packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/strict/export-const-destructuring-object/expected.js
# packages/babel-plugin-transform-es2015-modules-commonjs/test/fixtures/strict/options.json
# packages/babel-plugin-transform-es2015-modules-systemjs/package.json
# packages/babel-plugin-transform-es2015-modules-umd/package.json
# packages/babel-plugin-transform-es2015-object-super/package.json
# packages/babel-plugin-transform-es2015-parameters/package.json
# packages/babel-plugin-transform-es2015-shorthand-properties/package.json
# packages/babel-plugin-transform-es2015-sticky-regex/package.json
# packages/babel-plugin-transform-es2015-unicode-regex/package.json
# packages/babel-plugin-transform-es5-property-mutators/package.json
# packages/babel-plugin-transform-exponentiation-operator/package.json
# packages/babel-plugin-transform-flow-comments/test/fixtures/flow-comments/opaque-type-alias/expected.js
# packages/babel-plugin-transform-object-rest-spread/package.json
# packages/babel-plugin-transform-object-rest-spread/src/index.js
# packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/nested-2/expected.js
# packages/babel-plugin-transform-object-rest-spread/test/fixtures/object-rest/nested/expected.js
# packages/babel-plugin-transform-proto-to-assign/package.json
# packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/regression-node-type-export-default/expected.js
# packages/babel-plugin-transform-react-constant-elements/test/fixtures/constant-elements/regression-node-type-export/expected.js
# packages/babel-plugin-transform-react-display-name/package.json
# packages/babel-plugin-transform-react-display-name/src/index.js
# packages/babel-plugin-transform-react-display-name/test/fixtures/display-name/assignment-expression/expected.js
# packages/babel-plugin-transform-react-display-name/test/fixtures/display-name/nested/expected.js
# packages/babel-plugin-transform-react-display-name/test/fixtures/display-name/object-property/expected.js
# packages/babel-plugin-transform-react-display-name/test/fixtures/display-name/variable-declarator/expected.js
# packages/babel-plugin-transform-react-jsx-compat/package.json
# packages/babel-plugin-transform-react-jsx/package.json
# packages/babel-plugin-transform-regenerator/package.json
# packages/babel-plugin-transform-regenerator/test/fixtures/regression/6733/expected.js
# packages/babel-plugin-transform-regenerator/test/fixtures/regression/T7041/expected.js
# packages/babel-plugin-transform-regenerator/test/fixtures/variable-renaming/retain-lines/expected.js
# packages/babel-plugin-transform-runtime/README.md
# packages/babel-plugin-transform-runtime/test/fixtures/runtime/custom-runtime/expected.js
# packages/babel-plugin-transform-runtime/test/fixtures/runtime/full/expected.js
# packages/babel-plugin-transform-runtime/test/fixtures/runtime/regenerator-runtime/expected.js
# packages/babel-plugin-transform-strict-mode/package.json
# packages/babel-polyfill/package.json
# packages/babel-preset-es2015/package.json
# packages/babel-preset-es2016/package.json
# packages/babel-preset-es2017/package.json
# packages/babel-preset-latest/package.json
# packages/babel-preset-react/package.json
# packages/babel-preset-stage-0/package.json
# packages/babel-preset-stage-1/package.json
# packages/babel-preset-stage-2/package.json
# packages/babel-preset-stage-3/package.json
# packages/babel-register/README.md
# packages/babel-register/package.json
# packages/babel-runtime/package.json
# packages/babel-template/package.json
# packages/babel-traverse/package.json
# packages/babel-traverse/src/scope/lib/renamer.js
# packages/babel-traverse/test/evaluation.js
# packages/babel-traverse/test/replacement.js
# packages/babel-types/README.md
# packages/babel-types/package.json
# packages/babel-types/src/converters.js
# packages/babel-types/src/definitions/core.js
# packages/babel-types/src/definitions/es2015.js
# packages/babel-types/src/definitions/flow.js
# packages/babel-types/test/converters.js
# packages/babel-types/test/validators.js
# scripts/generate-interfaces.js
# yarn.lock
2017-08-31 17:44:17 +02:00
Buu Nguyen
75861fac87
Fix bug replacement nodes not requeued ( #5743 )
2017-08-28 15:10:00 -06:00
Henry Zhu
827d84536a
Merge pull request #6156 from jridgewell/pr/5502
...
Fix overshadowing local binding
2017-08-28 13:38:21 -06:00