23 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
a40f54f847 Add support for explicit type arguments in new and call expressions (#7934)
* Add all option to babel-plugin-syntax-flow

The Flow parser has some conditional logic based on whether types should
be parsed or not, which is based on either (a) the @flow pragma in the
docblock of the file of (b) the `all` configuration, provided via
command line or .flowconfig.

This commit adds the ability to provide the `all` configuration to
Babel as well, via the syntax-flow plugin. This should be set to `true`
if the project uses all=true.

* Parse @flow pragma

The Flow parser has some conditional logic based on whether types should
be parsed or not, which is based on either (a) the @flow pragma in the
docblock of the file of (b) the `all` configuration, provided via
command line or .flowconfig.

This commit parses the @flow (or @noflow) pragma from the first comment
in the source file. Directives are allowed to appear before the comment.

* WIP: add tests for explicit type arguments

This commit includes tests which have unexpected output, but will change
to the expected output as later commits add parsing support for various
features.

* Parse type arguments in new expressions

* Parse type arguments in call expressions

* Parse optional call expressions with explicit type args

* Add explicit type arguments to babel-types

Flow calls these typeArguments instead of typeParameters, which clearly
separates formal/actual parameters, and mirrors the existing arguments
key.

The existing definitions to support TypeScript also included Flow's
TypeParameterInstantiation node type, which I've moved to the the new
field.

* Add support for explicit type arguments to babel-generator

* Add test for explicit type args to transform-flow-strip-types plugin

* Oops. Forgot to regenerate the babel-types README.

* Fix Flow parser shouldParseTypes() function

I was looking at `options.all`, but the correct property ws
`options.flowAll`. Oops!

* Remove typeapp_call from whitelist of expected failures

Now that Babylon parses this syntax extension, we can remove the
typeapp_call tests from the list of expected differences.

Note that I am using the `flowAll` option, mirroring the behavior of the
Flow tests, which assume types without requiring the `@flow` pragma.

* Use Babylon plugin options instead of parser options

* Parse optional call expressions type arguments unambiguously
2018-05-18 08:05:16 -05: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
Nicolò Ribaudo
ba11d9fa7c Update test262 and flow tests (#7925) 2018-05-14 12:26:28 -05:00
Nicolò Ribaudo
0a8367c979
Use the correct Babylon plugins for Test262 tests (#7916) 2018-05-13 10:52:19 +02:00
Nicolò Ribaudo
25c3f0d689
Rename decorators&decorators2 plugins to decorators-legacy&decorators. (#7821)
Reasons:
1) Naming consistency with Babel plugins
2) Sooner or later the decorators2 plugin should become decorators anyway
2018-05-10 20:01:35 +02:00
Brian Ng
0353ce9ed5 Disallow flow type parameter defaults in some cases 2018-05-02 08:56:54 -05:00
Brian Ng
65ca968f8b Allow static? as identifier in ObjectTypeProperty 2018-05-02 08:56:54 -05:00
Brian Ng
77445cb044 Enable dynamicImport plugin for flow tests 2018-05-02 08:56:54 -05:00
Brian Ng
7c4509e280 Retry flow tests in script mode only if it is supposed to succeed 2018-05-02 08:56:54 -05:00
Brian Ng
3299086955
Add support for flow implements (#7741) 2018-04-18 08:54:30 -05:00
Brian Ng
840ba187a7
Prevent duplicate regex flags (#7617) 2018-03-22 10:25:26 -05:00
Brian Ng
f97d4313c9
Update test262 test script and a few keyword escape fixes (#7503)
* Update test262 and whitelist

* Use test262-stream

* Check escapes in contextual keywords

* Check escapes when parsing new.target

* Check escapes for getters/setters

* Check escapes for static class methods

* Check escapes on async arrow and functions
2018-03-08 09:10:00 -06:00
K Sashi Kumar
d187c26748 Spec Violation: Fix var initializer in for-in loop (#7392) 2018-03-04 16:18:32 -08:00
Daniel Tschinder
007f8d19b3 Remove unused dependencies (#7454)
Replace util.promisify with node internal version
2018-02-28 10:59:28 -05:00
Peri Nikhil
c3352ad2e0 Fix: unicode characters not allowed in regexes (#7179)
Issue #6691
2018-01-10 15:33:21 +01:00
Raja Sekar
f3410e761c Flow comment parsing (#7007) 2017-12-30 23:53:08 +01:00
Brian Ng
2b065350b5 Treat import type * as a parser error (#7061) 2017-12-19 10:54:20 -05:00
Brian Ng
f5ef928586
Add method property to ObjectTypeProperty (#7005) 2017-12-11 09:32:16 -06:00
K Sashi Kumar
ac745ded0d Fix destructuring assignment spec violation (#6986) 2017-12-07 09:14:03 -06:00
Brian Ng
d8bbaaae0a Split exportExtensions into exportDefault and exportNamespace plugins… (#6920)
* Split exportExtensions into two plugins in babylon
* rename proposal-export-default to proposal-export-default-from
* rename proposal-export-namespace to proposal-export-namespace-from
2017-11-30 17:46:36 -05:00
Brian Ng
0f2ab2fe20
Fix some reserved type handling and declare class with multiple extends (#6725) 2017-11-15 16:16:15 -06:00
Daniel Tschinder
3b540e3f5a
Integrate babylon into babel workflow 2017-11-01 23:26:51 +01:00