337 Commits

Author SHA1 Message Date
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
Nicolò Ribaudo
d83d141e00 Move tests from babylon/ to babel-parserr/ 2018-05-30 22:12:33 +02:00
Erik Arvidsson
2a8ebbe7ae Remove parenthesizedArgument (#7981)
The extra field parenthesizedArgument was never set to true. It was
always set to false and the code that read this was incorrectly
checking if extra was present.

Fixes #7957
2018-05-29 13:58:21 -07:00
Sam Goldman
f0283572a5 Support Flow's proto modifier syntax for declared classes (#7978)
<!--
Before making a PR please make sure to 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.
-->

| Q                        | A <!--(Can use an emoji 👍) -->
| ------------------------ | ---
| Fixed Issues?            | <!-- remove the (`) quotes to link the issues -->
| Patch: Bug Fix?          |
| Major: Breaking Change?  | No
| Minor: New Feature?      | Yes
| Tests Added + Pass?      | Yes
| Documentation PR         | <!-- If so, add `[skip ci]` to your commit message to skip CI -->
| Any Dependency Changes?  |
| License                  | MIT

See eb815be907 for more information about this feature.
    
The proto modifier indicates that a property declared using `x: T` syntax is actually present on the prototype object of the class, rather than an own property.
    
The proto and static modifiers are mutually exclusive, as class declarations don't simultaneously define the static prototype object, as they do the instance prototype.
    
This syntax is only supported on declared classes, not object types, interfaces, or runtime class declarations, and as such should only appear in library definitions.
2018-05-25 15:40:56 -05:00
Nicolò Ribaudo
6eab6f5863 [Babylon] Take the first set of options for plugins (#7994)
* [Babylon] Take the first set of options for plugins

* Fix test

* Docs
2018-05-24 08:54:32 -07:00
Brian Ng
555ee80f43
Fix some ts test fixtures 2018-05-24 10:03:03 -05:00
Brian Ng
a94cbf760a
Set exprAllowed to false when parsing TSNonNullExpression (#7968) 2018-05-24 09:31:08 -05:00
Nicolò Ribaudo
c992f5b61e Remove duplicated test (in the old babylon folder) 2018-05-24 00:30:57 +02:00
Nicolò Ribaudo
b33823e7f8 Better error message for invalid decorators syntax (#7986) 2018-05-23 15:26:35 -04:00
Logan Smyth
2058e0686e Add support for an InterpreterDirective AST node. 2018-05-21 18:19:58 -07:00
Logan Smyth
442ead701c Fix a few out-of-order test results. 2018-05-21 18:08:31 -07:00
Justin Ridgewell
0879a6d608
Subsume json (#7985)
* Add Subsume JSON transform

https://github.com/tc39/proposal-json-superset is at stage 3.

This allows U+2028 LINE SEPARATOR and U+2029 PARAGRAPH SEPARATOR to appear unescaped inside strings and directives.

* Move to Stage 3

* Break diretive parsing

* Update README

* Handle multi-escape sequences

* Remove babylon files after rename
2018-05-19 15:32:05 -04:00
Chaitanya Kumar Kamatham
daf0ca8680 Rename "babylon" to "@babel/parser" (#7937) 🎉 2018-05-19 00:03:05 -04:00