47 Commits

Author SHA1 Message Date
Kai Cataldo
4fc0a3839e Fix: Allow identifier async for default param in arrow expression (#165)
fixes #118
2016-10-12 10:46:40 +02:00
Henry Zhu
5bac6e8ad9 Temporary rollback for erroring on trailing comma with spread (#154) 2016-10-01 20:08:25 -04:00
Daniel Tschinder
7877829fcb Add static errors for object rest (#149)
* Fix parsing object rest

This makes object-rest-spread behave according to spec and only
allow one rest operator and enforces it to be the last
param in the object.

Also move all object-rest-spread tests to a own folder.

* Show nicer error messages
2016-09-30 11:37:55 -04:00
jezell
9cc0981c51 get / set are valid property names in default assignment (#142) 2016-09-27 23:29:16 +02:00
Moti Zilberman
774e6b446b Rephrase "assigning/binding to rvalue" errors to include context (#119) (#123)
* Rephrase "assigning/binding to rvalue" error messages with context (#119)

* Fix code style in parser/lval.js

* istanbul ignore some unused branches in parser/lval.js

* Fix code style again in parser/lval.js
2016-09-22 12:02:20 -04:00
Timothy Gu
643d3f37a4 Implement ES2016 check for simple parameter list in strict mode (#106)
* Slightly simplify logic

* Implement ES2016 check for simple parameter list in strict mode

See e.g. ECMA-262 7.0 14.1.2:

> It is a Syntax Error if ContainsUseStrict of FunctionBody is true and
> IsSimpleParameterList of FormalParameters is false.

Similar clauses cover arrow functions, generator functions, methods, and
generator methods, as well as async functions and async arrow functions.
2016-09-15 19:58:01 +02:00
Dan Harper
dc3036627b Fix Flow return types on arrow functions (#124)
* fix: arrow return type on next line is valid

https://github.com/babel/babel-eslint/issues/348

* fix: arrow on line after return type annotation is invalid

* lint
2016-09-15 19:27:11 +02:00
Daniel Tschinder
db0705bc51 Fix issues with flow-types and async function (#95)
the typeAnnotation was not correctly resolved in async
functions
2016-08-23 17:22:01 -04:00
Daniel Tschinder
2cfae60b15 Fix issues with default object params in async functions (#96)
This change allows async functions to have a spread argument which
defines a default value.
2016-08-23 17:19:49 -04:00
Daniel Tschinder
4506822180 Remove exponentiationOperator, asyncFunctions, trailingFunctionCommas (#98)
* This removes the exponentiationOperator as it is now in es2016

* Remove from tests

* Remove asyncFunctions and restructure test dirs

* Remove trailingFunctionCommas
2016-08-23 17:11:01 -04:00
Sebastian McKenzie
4af484b805 Merge pull request #65 from danez/fix-syntax-error-pos
Fixes SyntaxError position with flow optional type
2016-08-16 15:06:25 +01:00
Sebastian McKenzie
0b87d4c97c Add identifier name to node loc field (#90) 2016-08-16 09:41:10 -04:00
Daniel Tschinder
64ca55cfe0 Fixes Syntax error position with flow optional type 2016-07-28 23:09:40 +02:00
Daniel Tschinder
97325592fa Fix exponential operator to behave according to spec (#75) 2016-07-17 11:08:12 +02:00
Sebastian McKenzie
4ca3cd8d1a remove line terminator restriction after await keyword - fixes #38 2016-06-22 13:18:43 +01:00
Sebastian McKenzie
461261b181 Merge branch 'fix-flow-optional-type' of https://github.com/danez/babylon into danez-fix-flow-optional-type
# Conflicts:
#	src/plugins/flow.js
2016-06-22 12:52:42 +01:00
Daniel Tschinder
e6c11a0673 Fix support for flow optional parameters in arrow functions T7096
This overwrites the conditional handling in babylon for flow to support
optional parameters in arrow functions.
2016-04-10 13:06:48 +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
Amjad Masad
9a180797c0 Revert "Remove flow"
This reverts commit 2827ff6b01dcce69e9d3c0402e96b52b3a2a47ee.
2016-03-03 14:49:20 -08:00
Sam Goldman
d6ee428857 Remove flow 2016-03-01 22:33:30 -08:00
Sebastian McKenzie
c9f9435445 Switch to klint, fix some lint rules 2016-02-14 23:25:14 +00:00
Julian Viereck
a121d1b7b5 Fix and tests 2016-01-31 01:22:31 +01: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
Sebastian McKenzie
d79d0cf73d add function.sent 2015-11-17 23:02:21 -08:00
Daniel Lo Nigro
20a483cd58 Fix Flow.
Removed `@flow` annotation from files that don't actually pass Flow check at the moment. These will be added back file by file once the files are properly converted to use Flow.

Closes #3064
2015-11-15 21:30:22 -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
3b3c1897d0 add support for async generator concise methods - fixes #2603 2015-11-03 11:19:04 +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
6d6ddf0bcd type annotate babylon 2015-09-23 15:59:41 +01:00
Sebastian McKenzie
bf841c7e27 use extra.parenthesized rather than parenthesizedExpression 2015-09-15 06:19:26 +01:00
Sebastian McKenzie
54a4f16b08 add RestProperty node 2015-09-15 06:17:45 +01:00
Sebastian McKenzie
c5e2e4d39e loop over all directives to check for use strict 2015-09-15 06:16:57 +01:00
Sebastian McKenzie
c892cae6af use hasFeature rather than directly looking up options 2015-09-15 06:16:46 +01:00
Sebastian McKenzie
446b297465 unoverload Literal AST node 2015-09-01 04:49:16 +01:00
Sebastian McKenzie
8887444cf7 fix various bugs surfaced by the esprima test suite, remove some incorrect tests 2015-08-11 16:58:20 +01:00
Sebastian McKenzie
df021c7f23 add esprima tests and fix bugs picked up by it 2015-08-11 00:59:15 +01:00
Sebastian McKenzie
4fda34ce6f properly distinguish shorthand async keys that are the last property - fixes #2176 2015-08-06 19:33:48 +01:00
Sebastian McKenzie
5ec9f78493 fix patterns with async keys - fixes #2171 2015-08-05 23:22:31 +01:00
Sebastian McKenzie
226bf3f80d style nits 2015-08-05 21:45:22 +01:00
Sebastian McKenzie
c2c8b2db57 add token match method and remove more dead code 2015-07-26 04:48:42 +01:00
Sebastian McKenzie
23aa7b002d improve babylon test coverage and remove dead code 2015-07-25 19:54:19 +01:00
Sebastian McKenzie
2948108c90 finish reorganisation of babylon 2015-07-25 08:03:39 +01:00