532 Commits

Author SHA1 Message Date
Kevin Smith
f81c281fc4 Parse for-await statements when asyncGenerators plugin is active 2016-04-05 13:33:49 -04:00
Daniel Tschinder
bb6586d1e6 Enable deactivated tests, as it seems they work now 2016-04-04 18:22:10 +02:00
Daniel Tschinder
d15a2310cd Fix flow plugin when flow+arrow+spread used together
The fix includes creating a new method on the parser called `parseArrow`.
This new function by default only checks if current position matches an
arrow. If it does returns the `node` otherwise `undefined`.
The flow plugin can then extend this function and correctly parse the typeAnnotation
and add it to the node.

With this change, in the flow plugin there is no need anymore to extend
`parseParenAndDistinguishExpression` and the arrow handling in `parseParenItem`
could also be removed, because it is all handled now in `parseArrow`.

Some existing tests were failing, because `extra->parentesized` is now missing,
but this is correct as it is now inline with parsing without flow annotation. No extra
is added for arrow function without type annotations.

In the expression-parser `this.next()` was replaced by a more specific
`this.expect(tt.parenL)`.
2016-04-04 18:10:58 +02:00
Shuhei Kagawa
29a6578658 parse parameter decorators 2016-03-25 14:04:33 +09:00
Sebastian McKenzie
64ff4c3561 first commit 2016-03-10 06:24:44 +00:00
Amjad Masad
6b498d7e5a 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
bb4919500c Attach filename property to node.loc when provided. 2016-03-07 02:47:28 -08:00
Sam Goldman
b85d6c7e4a 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
Logan Smyth
40e5f505f4 Properly fail to parse >== and <== - fixes T2921 2016-02-13 10:08:05 -08:00
Henry Zhu
2e73358fcc Add class properties test with a generator method that results in a parse error 2016-02-11 13:03:36 -05:00
Logan Smyth
abd39d688e Add tests for class property ASI. 2016-02-06 23:01:38 -08:00
Logan Smyth
0c35bbfc07 Revert "babylon: throw parse error if class properties do not have a semicolon (fixes T6873)"
This reverts commit 976edfc06740e434d1d5b136e28996a77f909403.
2016-02-06 18:36:31 -08:00
Logan Smyth
d9ade8a63a Revert "babylon: fix error location for class properties with a missing semicolon"
This reverts commit f31099f383b52cf4fe1786188f6421529dea865b.
2016-02-06 18:36:22 -08:00
Amjad Masad
024cba6433 Merge pull request #3305 from jviereck/T7052
Fix: Arrow functions with trailing comma + return type are throwing an error when parsing
2016-02-05 13:50:57 -08:00
Jeff Morrison
acc946c09e Add support for leading pipes in Flow type alias RHS syntax 2016-02-05 13:23:55 -05:00
Julian Viereck
a121d1b7b5 Fix and tests 2016-01-31 01:22:31 +01:00
Henry Zhu
2f00b4c329 babylon: fix error location for class properties with a missing semicolon 2016-01-06 18:42:26 -05:00
Sebastian McKenzie
6c79639801 Merge pull request #3225 from hzoo/cp-semi
`babylon`: throw parse error if class properties do not have a semico…
2016-01-06 15:22:37 +00:00
Sam Goldman
a04948f70f 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
Sam Goldman
bd5c1a5b1b 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
0980819346 Add support for "declare type" Flow syntax
See facebook/flow#1105
2016-01-04 11:42:43 -08:00
Henry Zhu
e849c62144 babylon: throw parse error if class properties do not have a semicolon (fixes T6873) 2015-12-30 14:01:46 -05:00
Jesse McCarthy
c5a8d4c5b0 Add non-directive fixture.
(Failing.)
2015-12-28 11:04:33 -05:00
Sebastian McKenzie
326e157e5d Merge pull request #3203 from samwgoldman/flow-mixins-6.x
Add support for mixins to Babel 6.x
2015-12-27 21:04:40 +00:00
Sam Goldman
137abcaf7a Add support for mixins to Babel 6.x 2015-12-23 16:09:12 -05:00
Sam Goldman
f0fd729883 Add support for this type to Babel 6.x 2015-12-23 13:54:57 -05:00
Amjad Masad
1d82e48d36 Merge pull request #3190 from hzoo/remove-await-star
Remove await* from babel-generator, add parsing error to babylon - (fixes T6688)
2015-12-22 22:57:23 -08:00
Henry Zhu
c7bdf7fc63 remove all property, fixup tests 2015-12-23 00:02:02 -05:00
Henry Zhu
7bac3627fe Remove await* from babel-generator, add parsing error to babylon - (fixes T6688) 2015-12-19 23:15:09 -05:00
TSUYUSATO Kitsune
8d8f75a5b8 Fix ignoring previous strict mode after twice "use strict"
For example:

    var foo = function () {
      "use strict";
      "use strict";
      // there is inside of strict mode,
      // so `0123` (octal number) occurs a syntax error.
    };
    // there is outside of strict mode,
    0123; // so left is valid syntax.
    // however:
    //   SyntaxError: Invalid number (8:0)

I fixed it and add the test case.
2015-12-19 09:26:10 +09:00
Sebastian McKenzie
694ad8eb8a Merge pull request #3107 from MakeNowJust/fix/t6675-2
Fixed T6675
2015-12-12 01:30:05 +11:00
Amjad Masad
8716fb6f3f Test name, and remove todos 2015-12-04 00:12:37 -08:00
Amjad Masad
e3da84bcc3 Add support for null literal type 2015-12-03 23:58:25 -08:00
TSUYUSATO Kitsune
dc596d73d3 Fixed T6675
https://phabricator.babeljs.io/T6675.
2015-11-24 22:39:50 +09:00
Aliaksei Shytkin
5e987cd46e Make arrow functions to work with multiple args and flow return type (fixes T2422) 2015-11-23 15:20:16 +03:00
Sebastian McKenzie
d79d0cf73d add function.sent 2015-11-17 23:02:21 -08:00
Sebastian McKenzie
dfd9316e27 abstract out test runner into a module, move traceur and esnext tests to babel-preset-es2015, clean up and make existing tests more consistent 2015-11-08 21:58:01 -08:00
Sebastian McKenzie
779675610f fix defaults on type annotated arrow function params - fixes #2493 2015-11-05 09:49:03 +00:00
Sebastian McKenzie
2b6f78df83 fix existential type param parsing 2015-11-03 20:04:55 +00:00
Sebastian McKenzie
4016bae694 add ExistentialTypeParam - fixes #2587 2015-11-03 13:48:03 +00:00
Sebastian McKenzie
14ca4d1dc9 add lineBreak test to tt.name.updateContext - fixes #2591 2015-11-03 11:46:01 +00:00
Sebastian McKenzie
3b3c1897d0 add support for async generator concise methods - fixes #2603 2015-11-03 11:19:04 +00:00
Sebastian McKenzie
cbe94f4653 fix object rest/spread in arrow function params - fixes #2631 2015-11-03 11:14:12 +00:00
Sebastian McKenzie
ea40d0134f rename NumberLiteral to NumericLiteral and RegexLiteral to RegExpLiteral 2015-11-03 01:19:35 +00:00
Sebastian McKenzie
c2973d0c7a disallow invalid async function forms inside object literals - fixes #2629 2015-11-02 08:00:01 +00:00
Sebastian McKenzie
3d842df554 update exponentiation operator precedence - fixes #2431 2015-10-30 23:14:10 +00:00
Sebastian McKenzie
c224a7a370 fix parser bug where arrow functions have a higher precedence than they should - fixes #2118 2015-10-30 22:50:53 +00:00
Sebastian McKenzie
b909a81ab7 6.0.0
I'm extremely stupid and didn't commit as I go. To anyone reading this
I'm extremely sorry. A lot of these changes are very broad and I plan on
releasing Babel 6.0.0 today live on stage at Ember Camp London so I'm
afraid I couldn't wait. If you're ever in London I'll buy you a beer
(or assorted beverage!) to make up for it, also I'll kiss your feet and
give you a back massage, maybe.
2015-10-29 17:51:24 +00:00
Sebastian McKenzie
d0b584fd13 add filename to babylon test errors 2015-10-05 16:40:55 +01:00
Sebastian McKenzie
9908dc6f50 update babylon tests 2015-10-05 16:40:43 +01:00