Sam Pepose
db85bdc3fc
Added flowCommaSeparator option for object types ( #3547 )
2016-11-15 14:43:42 -05:00
Shine Wang
5075f3cb6f
Bug fix for printing minified literals ( #4830 )
...
* Fixed minified literal generator: now prints the shorter of `raw` and `value`.
2016-11-15 10:50:57 -05:00
Sam Goldman
7bb430aeea
Add variance node type and generate property variance annotations ( #4697 )
...
* Add variance node type and generate property variance annotations
babel/babylon#161 adds parsing support for property variance
annotations. This PR adds the necessary node type for the new Variance
node and generate support for all the positions where variance can now
appear.
* Variance is no longer a separate node type
This diff also adds tests to class properties and to the
flow-strip-types transform.
* Add test + fix for edge case with variance and class proeprties
2016-10-21 16:05:36 -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
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
Henry Zhu
5ea57d5e9c
fix tests and add exec test
2016-09-27 17:37:21 -04:00
zenparsing
26e79c5433
Implement support for async generator functions and for-await statements
2016-09-27 17:37:21 -04:00
Henry Zhu
b2eb5eca6f
babel-core: add options for different parser/generator ( #3561 )
...
* babel-core: add options for different parser/generator
* test for experiemental plugins, other babylon options
* fix passing options into parser
* Fix when no code is provided
* fixup tests
* fix tests again
* use filename and fallback to cwd
2016-09-27 09:09:31 -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
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
a13bf6e0be
Drop the unhelpful 'keyword' helper.
2016-07-18 19:12:22 -07:00
Logan Smyth
1b527eb23c
Perform number decimal checks at the token level.
2016-07-18 19:12:21 -07:00
Logan Smyth
9f49c99774
Drop .getLast().
2016-07-18 19:12:21 -07:00
Logan Smyth
fdc5b7cb5d
Only set the source location when inserting the comment text.
2016-07-17 21:51:01 -07:00
Logan Smyth
4dcec860bd
Drop trailing whitespace after all newlines.
2016-07-17 21:51:01 -07:00
Logan Smyth
59fe72ee7d
Avoid recalculating the current line.
2016-07-17 21:51:01 -07:00
Logan Smyth
1bbf109e8e
Move aux comments entirely into printer.
2016-07-17 21:51:01 -07:00
Logan Smyth
11ee8642fd
Drop the 'after' callback from 'print'.
2016-07-17 21:51:01 -07:00
Logan Smyth
59c1945493
Move whitespace handling into statement list printing.
2016-07-17 21:51:01 -07:00
Logan Smyth
5de7433147
Avoid calls to isUserWhitespacable by explicitly marking statement lists.
2016-07-17 21:51:00 -07:00
Logan Smyth
38b91235cc
Print inter-node newlines before other node items.
2016-07-17 21:51:00 -07:00
Logan Smyth
6bf52b74c0
Include newline insertion in the call sites of rightBrace.
2016-07-17 12:39:22 -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
68bc3d7dfb
Standardize on the comment format function.
2016-07-17 12:39:22 -07:00
Logan Smyth
a3c99278ba
Move format definition into Printer.
2016-07-17 11:07:26 -07:00
Logan Smyth
0d5cbe6102
Move class static helpers off class.
2016-07-17 11:07:26 -07:00
Logan Smyth
5e730b18bb
Instantiate Whitespace in the printer.
2016-07-17 11:07:25 -07:00
Logan Smyth
ca1d601037
Move property definitions to class props.
2016-07-17 11:07:24 -07:00
Logan Smyth
1d0ff341fd
Skip mutating the 'ignore' flag when printing.
2016-07-17 11:06:31 -07:00
Logan Smyth
3cc38a0063
Merge pull request #3581 from loganfsmyth/generator-refactor-cleanup
...
babel-generator: Misc cleanup and stale code removal
2016-07-16 12:44:19 -07:00
Logan Smyth
44282e4579
Disable indent and inc/dec time.
2016-07-14 22:58:48 -07:00
Logan Smyth
9b8b5112df
Remove unneeded _compact assignment.
2016-07-14 22:58:48 -07:00
Logan Smyth
1bf76b0f33
Use .append to force-commit semicolons for empty statements.
2016-07-14 22:58:48 -07:00
Logan Smyth
bd9bb053c3
Flatten aux comment logic.
2016-07-14 22:58:48 -07:00
Logan Smyth
9483f4bd94
Drop old stale code.
2016-07-14 22:58:47 -07:00
Logan Smyth
b841d12c9e
Initialize inForStatementInitCounter as a public var.
2016-07-14 22:58:47 -07:00
Logan Smyth
e056c0b9d6
Use the presence of _whitespace to toggle its use.
2016-07-14 22:58:47 -07:00
Logan Smyth
6a74731c6b
Drop the private version of ._format
2016-07-14 22:58:47 -07:00
Logan Smyth
55a1ffd266
Mark a bunch of methods private.
2016-07-14 22:58:46 -07:00
Justin Ridgewell
a70755d0e6
Further optimize babel-generator Buffer
...
We can eek out a bit more speed from Babel generator by turning the
buffer into an array as well.
Re: #3565
```
Items: 2 , time: 4 length: 114
Items: 4 , time: 3 length: 218
Items: 8 , time: 3 length: 426
Items: 16 , time: 2 length: 861
Items: 32 , time: 5 length: 1741
Items: 64 , time: 2 length: 3501
Items: 128 , time: 4 length: 7106
Items: 256 , time: 8 length: 14530
Items: 512 , time: 12 length: 29378
Items: 1024 , time: 24 length: 59147
Items: 2048 , time: 38 length: 121611
Items: 4096 , time: 71 length: 246539
Items: 8192 , time: 131 length: 496395
Items: 16384 , time: 350 length: 1015260
Items: 32768 , time: 573 length: 2063836
Items: 65536 , time: 1263 length: 4160988
Items: 131072 , time: 2143 length: 8448509
Items: 262144 , time: 4859 length: 17230333
```
to
```
Items: 2 , time: 4 length: 114
Items: 4 , time: 3 length: 218
Items: 8 , time: 9 length: 426
Items: 16 , time: 1 length: 861
Items: 32 , time: 5 length: 1741
Items: 64 , time: 1 length: 3501
Items: 128 , time: 3 length: 7106
Items: 256 , time: 7 length: 14530
Items: 512 , time: 9 length: 29378
Items: 1024 , time: 17 length: 59147
Items: 2048 , time: 30 length: 121611
Items: 4096 , time: 61 length: 246539
Items: 8192 , time: 113 length: 496395
Items: 16384 , time: 307 length: 1015260
Items: 32768 , time: 443 length: 2063836
Items: 65536 , time: 1065 length: 4160988
Items: 131072 , time: 1799 length: 8448509
Items: 262144 , time: 4217 length: 17230333
```
2016-07-15 01:27:45 -04:00
Logan Smyth
6b7f3cc4cd
Inline comment generation function.
2016-07-14 21:55:08 -07:00
Logan Smyth
475581dc66
Ditch the tiny Position class.
2016-07-14 21:55:08 -07:00
Logan Smyth
8379c21939
Drop unneeded condition in SourceMap class.
2016-07-14 21:54:47 -07:00