43 Commits

Author SHA1 Message Date
Chaitanya Kumar Kamatham
daf0ca8680 Rename "babylon" to "@babel/parser" (#7937) 🎉 2018-05-19 00:03:05 -04:00
Sam Goldman
b396cdcbe5 Internal slot properties (#7947)
* Support internalSlots to babel-types and babel-generator

* Parsing support for internal slot properties

* Print internal slots in babel-generator

* Add whitespace before first internal slot property
2018-05-16 22:48:12 -05:00
Deven Bansod
95894397eb Migrate babel-cli and babel-generator tests to use jest-expect (#7549) 2018-04-11 13:12:56 -05:00
Will Monk
0389035e15 Add exact Param To ObjectTypeAnnotations (#7535) 2018-03-09 19:22:01 +01:00
Boris Cherny
4208099f5b Add validators for Flow AST node fields (#7107) 2017-12-30 15:26:01 -06:00
Henry Zhu
691f90a774 Scoped: change test imports to @babel/ [skip ci] 2017-10-16 22:49:56 -04:00
Andy
c1d07fd6db babel-generator: Add TypeScript support (#5896)
* babel-generator: Add TypeScript support

* Remove type declarations; not published from babylon

* Remove TODOs

* Consistently use `this.word` for tokens that are words
2017-07-28 16:07:05 -04:00
Andy
b242e0d946 babel-generator: Make plugins list explicit for test cases (#6018) 2017-07-26 15:46:47 -04:00
Andy
248743e6c5 babel-types: Add TypeScript definitions (#5856)
* babel-types: Add TypeScript definitions

* Add missing builders

* Allow arrow function to have "generator"

* Replace link to resolved issue with comment

* Re-add 'generator' to functionCommon
2017-07-25 11:42:25 -04:00
MarckK
9fc910d8c0 Add optionality to catch bindings (#5956) 2017-07-25 09:38:48 -05:00
Ryan Gaus
0b890ced19 Code generator tests (#5847) 2017-07-20 18:22:18 -04:00
Daniel Tschinder
b3372a572d Remove whitespace generation (#5833)
* Remove whitespace generation and rely on default printing

Changes to printing:
* Add newline after last empty SwitchCase
* Add newlines around block comments if they are non-flow comments or contain newlines

* Fix a few more fixtures
2017-06-27 21:57:02 -05:00
Brian Ng
e4b35f680d
Run prettier 2017-06-27 12:15:00 -05:00
Justin Ridgewell
f537fc7da7 Add babel-generator tests 2017-06-07 03:22:52 -04:00
Brian Ng
8a82cc060a Run new lint rules (#5413) 2017-03-04 10:46:01 -05:00
Henry Zhu
9083bd6283 Merge branch 'master' into 7.0 2017-02-09 18:36:02 -05:00
Logan Smyth
b845f2b69d Re-enable the max-len ESLint rule. (#5265) 2017-02-04 11:07:15 -05:00
Brian Ng
e530e3c025 [7.0] List babylon plugins instead of * in babel-generator tests (#5231) 2017-01-28 09:35:21 -05:00
Chau Nguyen
d710e6dd5b [7.0] Drop flowUsesCommas option from babel-generator (#5123) 2017-01-19 22:24:13 -05:00
Sergey Rubanov
292c3ca206 Refactor test packages to use ES modules instead of CJS (#5138) 2017-01-16 11:25:04 -05:00
Andres Suarez
85b3aec747 Use native or lodash util module where full "lodash" is required 2017-01-15 13:35:00 -08:00
Henry Zhu
672adba9a1 enable prefer const (#5113) 2017-01-14 09:48:52 -05:00
Brian Ng
01bc43464e Ensure directives get printed in block statements (#4873) 2016-12-16 15:30:14 -05:00
David Aurelio
7ea283eb82 babel-generator: Expose raw mappings
Exposes raw mappings when source map generation is enabled. To avoid the cost of source map generation for consumers of the raw mappings only, `.map` is changed to a getter that generates the source map lazily on first access.
2016-12-09 09:55:42 +00:00
Brian Ng
3a27f49c57 Fix identation with empty leading ObjectTypeProperty (#4862) 2016-11-19 10:47:41 -05:00
Henry Zhu
19bb830c50 use *, add test for assign-expression in parameter (#4865) 2016-11-19 10:45:00 -05:00
Henry Zhu
cd041541b8 Fix bug + Generate test fixtures if no expected.js (#4858) 2016-11-17 17:53:46 -05:00
Andrew Levine
9f8ab29213 Change usage of "suite"/"test" in unit-tests to "describe"/"it" (#4734)
Fixes #4733
2016-10-15 18:45:35 -04:00
Andrew Levine
c0038221d7 Run ESLint on test files, and fix lint errors in test files (#4732) 2016-10-15 18:27:48 -04:00
Moti Zilberman
03d772c2ec Computed class properties (#4500)
* Support computed class property names (#4499)

** Depends on babel/babylon#121 **

* `babel-types`: Add `computed` field to `ClassProperty`

* `babel-plugin-transform-class-properties`: handle computed property names correctly

* `babel-generator`: add tests for class properties (computed/literal, static/instance)

* doc: Update babel-types with ClassProperty.computed

* chore(package): update babylon to v6.11.0

* babel-types: move ClassProperty.computed to be last builder arg
2016-09-26 17:46:00 +02:00
Sebastian McKenzie
4a19661346 Generate names field for identifiers to get correct names mappings (#3658) 2016-08-16 13:43:55 -04:00
Sam Pepose
3ee06187d5 Fixed incorrect newlines with Flow object types (#3548) 2016-06-23 20:38:05 -04:00
Logan Smyth
d042ddfdda Clarify that the code generator class is not public. 2016-06-16 20:31:19 -07:00
Logan Smyth
81e6d4147d Map the end of block statement nodes to the end of their original location - fixes T7258 2016-04-11 01:54:41 -07:00
Logan Smyth
76bb1dffaa Track sourcemap location on a stack - fixes T7255 2016-04-11 01:54:40 -07:00
Dale Bustad
26dcd6400f When generating sourcemaps, use per-node source filename if present. 2016-03-07 02:47:27 -08:00
Jason
28ca3f7f3a [generator] bug fix
- Fix Whitespace with empty token list
- Force a newline for line comments in concise mode
2016-02-17 13:01:54 +08:00
Amjad Masad
47b686b6fa Handle nested if statements with alternates in printer
Previously we saw a bug that when we have nested if statements
and an alternate then the generated code may confuse which
if statement the alternate belongs to.

e.g.

```
if (foo) if (bar) bar(); else baz();
```

But this was handled by looking at the consequent
and if it's an if we add a block. However we didn't
handle situations where it's not an if but the last
recursive statement is an if:

```
if (foo) while (bar) if (baz) baz(); else shoosh()
```

This handles it by recurring until we get the last
statement.
2015-12-17 22:41:55 -08:00
Amjad Masad
178da2f59b var 2015-12-16 12:20:49 -08:00
Amjad Masad
320cede9be Fix invalid codegen for number member expr 2015-12-15 17:47:46 -08:00
Sebastian McKenzie
5f40b53dee abstract out test runner into a module, move traceur and esnext tests to babel-preset-es2015, clean up and make existing tests more consistent 2015-11-08 21:58:01 -08:00
Sebastian McKenzie
ae7d5367f1 6.0.0
I'm extremely stupid and didn't commit as I go. To anyone reading this
I'm extremely sorry. A lot of these changes are very broad and I plan on
releasing Babel 6.0.0 today live on stage at Ember Camp London so I'm
afraid I couldn't wait. If you're ever in London I'll buy you a beer
(or assorted beverage!) to make up for it, also I'll kiss your feet and
give you a back massage, maybe.
2015-10-29 17:51:24 +00:00
Sebastian McKenzie
f88cc9d509 clean up babel-generator - closes #2210 2015-10-05 16:37:37 +01:00