288 Commits

Author SHA1 Message Date
sugargreenbean
c57e0e88a5 changed bool to boolean as well as updated tests (#4646) 2016-10-03 19:31:56 -04:00
Bruno Jouhier
f9ccee9d83 fixed babel/babel#4632 - missing parentheses around yield expression … (#4633)
* fixed babel/babel#4632 - missing parentheses around yield expression in conditional test

* babel/babel#4632 - added test
2016-10-01 12:58:59 -04:00
Juriy Zaytsev
1d728750c9 Add retainFunctionParens option (#4621)
* Add retainParens option

* Add doc, remove option

* Add negation test

* Make sure parens are not added

* Change name

* Change dir name
2016-09-30 18:05:33 -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
Kai Cataldo
f3a6e4b0ae Fix tests with duplicate named exports (#4538)
* Fix babel-plugin-transform-flow-strip-types tests

* Fix babel-plugin-transform-es2015-modules-umd tests

* Fix babel-generator tests

* Fix babel-plugin-transform-es2015-modules-systemjs tests

* Fix babel-plugin-transform-es2015-modules-commonjs tests

* Fix babel-plugin-transform-es2015-modules-amd tests
2016-09-21 10:52:59 +02:00
Basil Hosmer
cb4b2b0744 flow plugin: generate exact object type annotations (#3702) 2016-09-20 11:10:55 +02:00
Dan Harper
41f2bbc104 Flow: Fix generating arrow functions with param (#4504)
* transform-flow-comments, single arrow param support #4503

* further tests for printing single arrow func param flow code

* cleanup
2016-09-12 08:27:49 -04:00
Mathias Bynens
b9919bdc48 babel-generator: Ensure ASCII-safe output for string literals (#4478)
Ref. #4477.
2016-09-08 18:04:52 -04:00
Paul O’Shannessy
55f37a1b1e Use arrow syntax for ObjectTypeProperty FunctionTypeAnnotations (#3663)
This fixes an issue where optional properties would get transformed to
an invalid syntax. The easiest solution was to make all FunctionTypes
get transformed to the arrow syntax (previously everything went the
other way).
2016-08-20 10:37:56 -04:00
Sebastian McKenzie
4a19661346 Generate names field for identifiers to get correct names mappings (#3658) 2016-08-16 13:43:55 -04:00
Daniel Tschinder
308de41992 Add support for the new declare module.exports of flow. (#3570) 2016-08-16 16:54:00 +02:00
Logan Smyth
4dcec860bd Drop trailing whitespace after all newlines. 2016-07-17 21:51:01 -07:00
Logan Smyth
0e05e9f216 Rely on .space and .newline behavior instead of explicit format checks. 2016-07-17 12:39:22 -07:00
Logan Smyth
d6b1e36d49 Make the 'catchUp' call implicit to source location updates. 2016-07-04 22:49:58 -07:00
Sam Pepose
3ee06187d5 Fixed incorrect newlines with Flow object types (#3548) 2016-06-23 20:38:05 -04:00
Sam Pepose
7d83147e16 Added semicolon 2016-06-22 21:21:53 -07:00
Sam Pepose
199a612131 Fixed incorrect printing of array of nullable flow type 2016-06-22 20:33:43 -07:00
Logan Smyth
df2c3f3d25 Use the common space helper everywhere to ensure we get the smallest output possible. 2016-06-16 22:00:24 -07:00
Logan Smyth
5c74ebb87e Remove unneeded space check. 2016-06-16 22:00:24 -07:00
Logan Smyth
3e1a661eb6 Use the general list handlers and the default separator. 2016-06-16 20:31:19 -07:00
Logan Smyth
d042ddfdda Clarify that the code generator class is not public. 2016-06-16 20:31:19 -07:00
Logan Smyth
efea2c19f2 Add more tests for minified output. 2016-06-16 20:31:19 -07:00
Henry Zhu
b567c02413 generator tests 2016-06-10 18:05:54 -04: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
Logan Smyth
256c0100cb Wrap parens around default exports starting with function/class - fixes T7136 2016-03-12 15:31:16 -08:00
Amjad Masad
4b2a660ee0 Merge pull request #3323 from divmain/master
Source-map support for multiple input source files
2016-03-07 11:57:59 -08:00
Dale Bustad
26dcd6400f When generating sourcemaps, use per-node source filename if present. 2016-03-07 02:47:27 -08:00
Sam Goldman
a38a58bad8 Add support for Flow def-site variance syntax
This syntax allows you to specify whether a type variable can appear in
a covariant or contravariant position, and is super useful for, say,
Promise.

Right now this is hacked in jankily, but in the next major release we
should stop using Identifier nodes for type parameters.
2016-03-06 14:44:09 -08:00
Henry Zhu
1271d2cd52 Merge pull request #3380 from babel/unary-arrow
Fix: Add parens for unary arrow function
2016-02-29 12:18:12 -05:00
Henry Zhu
ec3c183668 Fix: Add parens for unary arrow function
Fixes T7157
2016-02-28 21:56:22 -05:00
Henry Zhu
35ed18f628 Fix invalid codegen for non decimal numeric literals in MemberExpression
Fixes T7156
2016-02-28 20:34:45 -05: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
Henry Zhu
4e619db873 Merge pull request #3324 from zjmiller/master
Parenthize "in" in for-loop init, even when init has nested for-loop
2016-02-05 15:50:11 -05:00
Zachary Miller
33b4ef5d52 Parenthize "in" in for-loop init, even when init has nested for-loop 2016-02-05 14:28:01 -06:00
Jeff Morrison
e6951e99f0 Add support for leading pipes in Flow type alias RHS syntax 2016-02-05 13:23:55 -05:00
Henry Zhu
f8036c7230 Merge pull request #3311 from babel/object-body
[T7047] Consider arrow functions when parenthesizing object expressions
2016-02-04 14:44:22 -05:00
Amjad Masad
3d3b30eb45 [T7047]Consider arrow functions when parenthesizing object expressions 2016-02-02 16:26:31 -08:00
Rob Colburn
7b1b876dc2 Ensure that we do not break mutli-byte handling 2016-01-22 12:13:18 -08:00
Amjad Masad
0d9459dbb6 Fix minified labeledStatement printing
Unary expressions with alphabetic operators like 'void' were being
squished next to the statement.
2016-01-12 17:28:46 -08:00
Amjad Masad
17ea5cd916 Fix failing test 2016-01-06 17:50:17 -08:00
Amjad Masad
139503e86f Parenthesize await/yield expression in binary expr 2016-01-06 17:35:39 -08:00
Amjad Masad
ec983b276e add assignment expression parentheses test 2016-01-06 16:03:45 -08:00
Amjad Masad
e79c625091 Merge pull request #3229 from hzoo/T6913
Add a check for parentheses for AwaitExpressions (fixes T6913)
2016-01-06 14:22:54 -06:00
Sam Goldman
17d19a0056 Add export interface Flow syntax support
An interface export is just like a type export. In fact, it's a syntax affordance which makes the following equivalent:

```javascript
interface I_ { ... }
export type I = I_;
```

```javascript
export interface I { ... }
```

See facebook/flow#1145
2016-01-05 15:57:45 -08:00
Henry Zhu
cf41c321af Don't overparenthesize, add yield tests 2016-01-05 18:12:25 -05:00
Sam Goldman
26c97c4069 Add support for "declare interface" Flow syntax
This has been a feature in Flow for a long time (couldn't easily find a
specific commit adding this). Interfaces are basically undocumented, though, so
it's easy to see how this was missed.
2016-01-04 11:50:12 -08:00
Sam Goldman
e764346d5f Add support for "declare type" Flow syntax
See facebook/flow#1105
2016-01-04 11:42:43 -08:00
Henry Zhu
ab2135bc9f Add a check for parentheses for AwaitExpressions (fixes T6913) 2016-01-04 08:31:07 -05:00
Amjad Masad
570b50c895 Merge pull request #3213 from babel/print-bugs
Fix various print inefficiencies/bugs
2015-12-27 18:28:27 -06:00