532 Commits

Author SHA1 Message Date
Kai Cataldo
650e33376a Disallow duplicate named exports (#107)
fixes #69
2016-09-22 10:20:47 -04:00
Moti Zilberman
4e1fbd48d5 Add support for computed class property names (#120) (#121) 2016-09-21 21:24:59 -04:00
Dan Harper
b68918e377 fix static falling through in declare class Flow AST (#135) 2016-09-21 00:17:55 -04:00
Daniel Tschinder
f91da191a1 Include typeParameter location in the arrow function expression (#126) 2016-09-15 19:08:33 -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
64145b07e3 error on invalid flow type annotation with default assignment (#122) 2016-09-15 19:35:03 +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
abf6ca8e5e Add tests for export extensions (#127)
The case which includes a namespaced and default import was not tested yet
2016-09-15 19:24:11 +02:00
Basil Hosmer
ddbda7dd04 exact object type annotations for Flow plugin (#104)
* exact object type annotations for Flow plugin

* Couple tweaks per suggestions

* s/==/===/

* add test for unexpected token in flowObjectType Semicolon
2016-09-13 10:07:23 -04:00
Daniel Tschinder
27ad69d43f Fix declare class with qualified type identifier (#97)
This makes declare class extends behave the same way as in flow
The ast-token after the extends keyword, might be either Identifier or
QualifiedTypeIdentifier

To do that this commits splits the parseGenericType into two functions,
one for parsing genericType and on for qualifiedTypeIdentifier
2016-08-23 17:29:23 -04:00
Dan Harper
efab40154e Fix arrow functions with destructuring, types & default value (#94)
Flow's "toAssignable" override wasn't calling the inner function,
resulting in the destructuring in an AssignmentPattern not having the
node type changed from ObjectExpression to ObjectPattern, resulting in
"Binding rvalue" thrown from "checkLVal()"
2016-08-23 17:27:39 -04: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
43cdd2f5b0 Merge pull request #57 from danez/fix-arrow-location
Fix arrow param locations with flow types
2016-08-16 15:06:19 +01:00
Sebastian McKenzie
0b87d4c97c Add identifier name to node loc field (#90) 2016-08-16 09:41:10 -04:00
Sebastian McKenzie
c9a7bed6d0 Merge pull request #83 from gabelevi/flow
Small fix for parsing type parameter declarations
2016-08-04 00:37:37 +10:00
Daniel Tschinder
eb691425b6 Only allow declares inside declare module (#73)
* Only allow declares inside declare module

* Better error message
2016-07-29 20:22:49 +02:00
Gabe Levi
859ed04be9 Small fix for parsing type parameter declarations 2016-07-29 12:45:20 -04:00
Dale Bustad
4811d617ce If supplied, attach filename property to comment node loc. (#80) 2016-07-28 23:12:41 +02:00
Daniel Tschinder
64ca55cfe0 Fixes Syntax error position with flow optional type 2016-07-28 23:09:40 +02:00
Daniel Tschinder
cd987cd8e4 Fix arrow param locations with flow types
This patch corrects the end locations for params in arrow functions
which use type params.
2016-07-28 23:09:19 +02:00
Daniel Tschinder
f576865ce9 Add support for declare module.exports (#72)
* Add support for declare module.exports

* Use doublequotes

* Use expect instead of eat
2016-07-28 22:16:58 +02:00
Max Schaefer
fd18d89d8e Fix accidental fall-through in Flow type parsing. (#82)
When parsing a primary type, `>` would erroneously be treated like `(`.
2016-07-28 22:12:47 +02:00
Daniel Tschinder
97325592fa Fix exponential operator to behave according to spec (#75) 2016-07-17 11:08:12 +02:00
Sebastian McKenzie
3fad8cc9a7 Merge pull request #42 from calebmer/feat/jsx-spread-children
Add JSX spread children
2016-07-13 01:32:09 +01:00
Daniel Tschinder
15a391d305
Fix tests to not save expected output if we expect the test to fail 2016-07-11 13:35:50 +02:00
Daniel Tschinder
34a82f716e Fix the location of params, when flow and default value used (#68)
Fixes #67
2016-07-06 17:48:47 -04:00
Daniel Tschinder
4e2072def8
Fix performance regression introduced in 6.8.2
This commit e6c11a0 (#19) made a big performance regression.
The reason was that parseConditional was always cloning the current state
even if no question mark (potential conditional or flow-optional
token) was at the current position.
Simply checking if questionmark matches the current token solves the problem.

Fixes #62
2016-07-03 11:52:01 +02:00
Sebastian McKenzie
d976b56bbe Merge pull request #54 from gabelevi/arrow
[Flow] Arrow function type parameter declarations
2016-06-24 18:36:07 +01:00
Gabe Levi
22374b6bec [Flow] Arrow function type parameter declarations 2016-06-24 10:34:09 -07:00
Vladimir Kurchatkin
d5f75cb2f0 flow: allow generic method with name get or set 2016-06-24 19:47:30 +03:00
Sebastian McKenzie
cf6e0d365e rename parser context types 2016-06-22 14:06:58 +01:00
Sebastian McKenzie
3524ad510f remove grouped type arrow restriction as it seems flow no longer has it - fixes #44 2016-06-22 13:43:32 +01:00
Sebastian McKenzie
ec0a349ec8 support negative numeric type literals - fixes T7450 2016-06-22 13:17:27 +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
Sebastian McKenzie
78597290ec Merge pull request #23 from danez/fix-comments
Fix leading comments added from previous node
2016-06-22 12:44:12 +01:00
Sebastian McKenzie
4d2e1dddfb Merge pull request #10 from danez/fix-flow-arrow-spread
Fix flow plugin when flow+arrow+spread used together
2016-06-22 12:36:52 +01:00
Daniel Tschinder
f11a82c96c Adjust cloning of nodes in import/export-specifiers and obj-destructuring (#24)
The cloning caused comments that where added to the original node to be persisted into
the cloned node.
Espree/Acorn does not have any cloning, that's why it is working there.
This change omits comments when cloning, as removing the cloning
causes tests in babel to fail.
2016-06-21 09:55:15 -04:00
Sebastian McKenzie
92d45c3f6c Merge pull request #16 from danez/enable-tests
Enable deactivated tests
2016-06-21 00:03:38 +01:00
Sebastian McKenzie
8977d8c75a Merge pull request #31 from eldereal/master
Allow use react elements after yield statement
2016-06-20 22:50:36 +01:00
calebmer
a25a4ffdc1 Add JSX spread children 2016-06-19 10:48:20 -04:00
Sebastian McKenzie
1c48c4c9db Merge pull request #25 from gabelevi/default
Support defaults in Flow's type parameter declarations
2016-05-17 01:00:49 +01:00
Yiyuan Bai
de56e12c68 Allow use react elements after yield statement 2016-05-12 18:41:41 +08:00
Henry Zhu
d4cd0bf7b7 Actually remove it.. 2016-05-02 22:44:50 -04:00
Henry Zhu
c81db57b03 Remove unused file
Ref f81c281fc4 (commitcomment-17331315)
2016-05-02 22:43:47 -04:00
Gabe Levi
fe5193a40a Support defaults in Flow's type parameter declarations
The primary goal of this commit is to add the ability to parse type parameter
declarations with defaults, like `type Foo<T = string> = T`. While I was in the
code, I fixed a few small things, like

* Type parameter declarations need 1 or more type parameters.
* The existential type `*` is not a valid type parameter.
* The existential type `*` is a primary type
* The param list for type parameter declarations now consists of
  `TypeParameter` nodes
2016-04-27 16:12:10 -04:00
Daniel Tschinder
4bfececdad Fix leading comments added from previous node
This fixes an issue that comments were added as leading comments
to expressions, which are not immediately folowing the comment.
This was also reported and fixed in espree, and is basically a port to
babylon. eslint/espree#256

this also fixes an issue in babel-eslint with certain rules babel/babel-eslint#289
2016-04-23 12:24:20 +02: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