362 Commits

Author SHA1 Message Date
Brian Ng
e7f0c065cf
Bump some deps (#9056) 2018-11-21 15:21:36 -06:00
mAAdhaTTah
70318c9413 s/may/should 2018-11-21 16:02:34 -05:00
mAAdhaTTah
6e84352b51 PrimaryTopicReference -> PipelinePrimaryTopicReference 2018-11-21 15:54:56 -05:00
Grigory Moroz
445b14148e Better error for disallowed trailing commas/parameters after rest elements (#9046)
* handle disordered rest parameter in function expressions

* remove spaces [lint]

* polish function parameters validation

* add test with arrow function and comma after rest parameter [babel-parser]
2018-11-21 07:49:36 +01:00
Daniel Tschinder
a2afb974be
Fix parsing typescript function types with destructuring (#9035)
* Fix parsing typescript function types with destructuring

* Use integer instead of actual stack
2018-11-19 13:55:58 -08:00
Brian Ng
4f206b2416
prettier@1.15.1 (#9001) 2018-11-09 15:25:13 -06:00
Daniel Tschinder
343f776ca5 Rename primitive types to reserved types (#8984) 2018-11-07 16:50:36 -06:00
Daniel Tschinder
5d5cd8612f
Fix several edge cases with context expression state (#8972)
* Fix several edge cases with context expression state

* Fix review comments

* Remove unused field
2018-11-06 19:37:24 -08:00
Retsam
2194842d11 Typescript: Validate tuple type element positions (#8828)
* feat: validate the positions of rest elements and optional elements in tuple types

Adds a validation step to the parser which raises syntax errors if a rest param is not at the end of a tuple, or if a mandatory param follows an optional parameter

* Fix spread after optional case; add test case
2018-11-05 23:19:34 -08:00
Daniel Tschinder
e3b2c1afff
fix: Do not allow TypeCastExpressions w/o parens (#8956) 2018-11-05 15:34:24 -08:00
Nicolò Ribaudo
24c4901ff5
Remove Babylon plugins for features already merged to the ECMAScript spec (#8448)
These are now enabled by default:
- objectRestSpread (2018)
- asyncGenerators (2018)
- optionalCatchBInding (2019)
- jsonStrings (2019)

TODO (after this commit):
- [ ] Deprecate the `@babel/plugin-syntax-*` packages.
- [ ] Deprecate the `@babel/plugin-proposal-*` packages.
- [ ] Create the `@babel/plugin-transform-*` packages.
2018-11-05 23:48:06 +01:00
Jordan Brown
f216a7b06f [flow] Add support for parsing _ as implicit instantiation in call/new (#8883)
* [flow] Add support for parsing  as implicit instantiation in call/new

* Update flow tests and fix underscore being a reserved type

* Rebase onto flow-test

* Fix flow commit hash
2018-11-05 10:45:40 -08:00
mAAdhaTTah
4521204ea0 Merge branch 'master' into implement-smart-pipeline-in-parser
* master: (222 commits)
  Set correct methods name
  Use toPropertyKey in the "decorate" helper
  Allow function types in type params within arrow return types (#8954)
  Fix message when plugin of a wrong type is passed (#8950)
  rename colliding let bindings with for loop init (#8937)
  edge incomplete support for arrow destructuring (babel #8349) (#8926)
  fix single-arg async arrows when retainLines=true (#8868)
  [flow] Explicit inexact objects with `...` (#8884)
  Update preset-env data (#8898)
  Treat break inside block inside loop (#8914)
  fixed "source map" formatting in comment (#8878) [skip ci]
  fix typo in contributing guidelines (#8901) [skip ci]
  fix: Expression x === 'y' && '' should not evaluate to undefined. (#8880)
  fixed an extra word
  Fixes #8865 (#8866)
  v7.1.4
  v7.1.3
  Bump Babel deps (#8770)
  flow-bin@0.82.0 (#8832)
  Insertafter jsx fix (#8833)
  ...

# Conflicts:
#	packages/babel-parser/src/tokenizer/index.js
#	packages/babel-parser/test/fixtures/experimental/class-private-properties/failure-numeric-literal/options.json
#	packages/babel-parser/test/fixtures/experimental/pipeline-operator/invalid-proposal/options.json
2018-11-03 14:00:12 -04:00
Daniel Tschinder
cd81b079ee Allow function types in type params within arrow return types (#8954) 2018-11-01 09:10:46 -05:00
Jordan Brown
e4929e11f6 [flow] Explicit inexact objects with ... (#8884) 2018-10-29 15:09:17 -05:00
Byron Luk
929567523c Fixes #8865 (#8866) 2018-10-12 09:28:15 -05:00
Retsam
d2c75c2d38 fix: corrects handling of newline after async with paren-less arrow function (#8830)
If async is followed by a newline, then a paren-less arrow function should be parsed as two expressions
2018-10-09 23:25:31 +02:00
Retsam
08454ece46 Typescript - Tuples can include rest elements (#8805) 2018-10-08 11:32:31 -05:00
Bruno Macabeus
850bc1d3dd class private methods and properties: should not allow spaces between # and identifier (#8756) 2018-10-02 19:31:06 -07:00
Brian Ng
2575312d1f
Fix parsing of slash after class expression (#8804) 2018-10-02 20:45:53 -05:00
Retsam
a5b5ed928d Typescript - Tuple elements can be optional (#8720) 2018-10-02 11:29:51 -05:00
Nicolò Ribaudo
3c87401714
[decorators] [typescript] Parse type parameters (#8767)
* [decorators] [typescript] Parse type parameters

* Add test for invalid code
2018-10-01 22:04:19 +02:00
Pig Fang
f38be13113 TypeScript: reserve unknown as TSUnknownKeyword (#8755) 2018-09-25 12:19:32 -05:00
Brian Ng
38cf318f61
Bump lint-related deps (#8765) 2018-09-24 18:09:54 -05:00
Brian Ng
9b4b436e1f
Fix parsing of newline between 'async' and 'function' (#8698) 2018-09-16 22:09:23 -05:00
Brian Ng
380f2a0297
Fix typescript parsing typed object shorthand methods (#8677) 2018-09-14 10:20:59 -05:00
Logan Smyth
79b2af5997
Format fixture JSON with Prettier. (#8658) 2018-09-09 17:57:52 -07:00
Nicolò Ribaudo
9d244ae66b More helpful error message for missing decoratorsBeforeExport in parser (#8576) 2018-08-29 09:02:18 -05:00
Yi Li
b439013cd4 Fix trailingComments for FunctionExpression that is CallExpression arguments (#8488) 2018-08-21 12:29:11 -05:00
Nicolò Ribaudo
d79b5eeeff
Require decoratorsBeforeExport option for decorators (#8465)
* Require decoratorsBeforeExport option for syntax-decorators

* Also babylon

* Enable test
2018-08-15 09:04:52 +02:00
James DiGioia
122906d525 Verify if MemberExpression is computed
If a property access is computed, e.g. a[b], then it's in topic style. Currently,
this isn't accounted for. Test & change ensures this doesn't parse.
2018-08-10 08:06:38 -04:00
James DiGioia
25d01460fd Fix error message for #4 case
This impact private fields as well as smart pipeline, providing a clearer
error message for both.
2018-08-10 07:52:55 -04:00
James DiGioia
ba5642d4ee Add test for computer properties
This seems to parse fine. Should it?
2018-08-09 22:08:39 -04:00
James DiGioia
15e6d844ae Remove additional parser logic
These are parsable only in follow-on proposals, not in the base proposal,
so we'll introduce that in a separate PR.
2018-08-09 22:08:23 -04:00
kalenikalexander
5c728ea609 Fix private property parsing in Flow (#8340)
* Fix private property parsing in Flow

* Flow tests updated

* Fix type error

* Appropriate name was given to test folder

* Fix

* Empty

* Correct type annotation

* Add required changes in generator package

* Add required changes in flow-strip-types
2018-08-02 08:38:58 +02:00
Brian Ng
55ca90b3fc
Allow TSInterfaceDeclaration to be default export (#8408)
<!--
Before making a PR, please read our contributing guidelines
https://github.com/babel/babel/blob/master/CONTRIBUTING.md

For issue references: Add a comma-separated list of a [closing word](https://help.github.com/articles/closing-issues-via-commit-messages/) followed by the ticket number fixed by the PR. (it should be underlined in the preview if done correctly)

If you are making a change that should have a docs update: submit another PR to https://github.com/babel/website
-->

| Q                        | A <!--(Can use an emoji 👍) -->
| ------------------------ | ---
| Fixed Issues?            | Fixes #7118
| Patch: Bug Fix?          | Y
| Major: Breaking Change?  | N
| Minor: New Feature?      | N
| Tests Added + Pass?      | Yes
| Documentation PR Link    | 
| Any Dependency Changes?  |
| License                  | MIT
2018-07-31 12:57:57 -05:00
Andy
8ee24fdfc0 TypeScript: Support type arguments on tagged templates (#7754)
| Q                        | A
| ------------------------ | ---
| Fixed Issues?            | #7747 (partly)
| Patch: Bug Fix?          | 
| Major: Breaking Change?  | 
| Minor: New Feature?      | Yes
| Tests Added + Pass?      | Yes
| Documentation PR         |
| Any Dependency Changes?  |
| License                  | MIT

@JamesHenry This changes the AST format. CC @DanielRosenwasser for review.
Supports parsing type arguments on tagged template calls.
Should wait on Microsoft/TypeScript#23430 to be merged so we're sure we have the final syntax.
2018-07-26 10:44:43 -05:00
Kevin Gibbons
a811cf78e1 Correctly parse interface methods named 'static' (#8374) 2018-07-24 09:25:55 +02:00
James DiGioia
afd0638b74 Reuse hash token instead of new primaryTopicToken
Set whether we're in a pipeline in order to determine how to parse the
hash. The error message changes as a result, since the `hash` never
enters the block.
2018-07-22 18:46:31 -04:00
dnalborczyk
8b10a44fe1 remove .then from dynamic import parser exception message (#8355) 2018-07-21 08:26:17 +02:00
James DiGioia
cc526940ee Quote proposals in error message 2018-07-12 23:07:09 -04:00
Andy
301db1b921 TypeScript: Support type arguments on JSX opening and self-closing tags (#7799) 2018-07-10 17:19:42 -05:00
J. S. Choi
fbf62b4830 Implement Smart Pipeline proposal in @babel/parser 2018-07-09 22:44:27 -04:00
James DiGioia
19a1705293 Support pipeline proposal flag in @babel/parser (#8291) 2018-07-09 16:59:56 -04:00
Ger Hobbelt
e86d1e0d6a babel/parser: test helpers: write expected throw message to options.json ~ complete jest -u functionality (#8178) [skip ci]
* babel/parser: test helpers: when test fails with an exception and both reference output file and options.json file do not exist, write a simple options.json with the error message to expect when such a file doesn't exist yet. This completes the `jest -u` capability for new tests which are expected to *fail*.
2018-06-15 10:27:19 -04:00
Brian Ng
b6455c611b
Allow ts modifier names to be used as function argument names (#8030) 2018-06-12 08:38:38 -05:00
hassanAli321
bd44902024 update fixture 2018-06-07 13:22:45 -05:00
Nicolò Ribaudo
6349118bed
Change decoratorsBeforeExport default to false (#8113) 2018-06-04 21:12:01 +02:00
Nicolò Ribaudo
b8dcd6f593
Remove parser support for decorators optional parentheses (#8037)
* Remove parser support for decorators optional parentheses

* Update fixtures
2018-06-02 13:07:15 +02:00
dnalborczyk
fe556c502d fix folder name (#8074) 2018-06-01 17:58:37 +02:00