362 Commits

Author SHA1 Message Date
Erik Arvidsson
dd8b700a2c Parenthesized expressions (#8025)
* Add parser createParenthesizedExpressions option  …

When set to `true` we create `ParenthesizedExpression` nodes instead of
setting `extra.parenthesized`.

* Also update babel-parser.d.ts
2019-02-23 02:45:25 -05:00
Daniel Tschinder
a1ea765b95
Make tests spec compliant and avoid duplicate declarations in input files (#9522) 2019-02-18 16:14:35 -08:00
Daniel Tschinder
058f057426
Also check AssignmentPatterns for export name (#9521) 2019-02-15 22:55:03 -08:00
Daniel Tschinder
d349b74a4f
Better error output in parser tests (#9491) 2019-02-11 02:13:24 -08:00
Daniel Tschinder
2817844e89
Fix regression with let (#9477)
* Fix corner cases with let

* Handle generators correctly

* Fix flow plugin

* Fix typescript plugin
2019-02-08 13:36:37 -08:00
Downpooooour
d1514f57bd Typescript function destructured params (#9431)
* fix typescript funtion destructured params for array

* update type name
2019-02-07 22:59:50 +01:00
Brian Ng
07b0f22a3f
Fix range for TypeScript optional parameter in arrow function (#9463) 2019-02-06 08:17:32 -06:00
Daniel Tschinder
344d35bbe9 Simplify await and yield tracking in params (#9405) 2019-02-04 22:01:17 +01:00
Daniel Tschinder
9eb010da50
Unify reserved word checking and update error messages (#9402)
* Unify reserved word checking and update error messages

* Fix test
2019-01-31 19:02:32 -08:00
Nicolò Ribaudo
4c4c22a316 Run prettier 2019-01-30 11:30:31 +01:00
Daniel Tschinder
828169e611
Fix line continuation with Unicode line terminators (#9403) 2019-01-28 13:35:35 -08:00
Brian Ng
7dc157f9be
Fix location/range on TypeScript ExportNamedDeclarations (#9406) 2019-01-24 19:44:22 -06:00
Daniel Tschinder
46ba5940c2
Make yield a contextual keyword (#9400) 2019-01-23 14:33:23 -08:00
Daniel Tschinder
42c5d3fc4b
Correctly fail for invalid yield in for (#9398) 2019-01-23 13:39:30 -08:00
Daniel Tschinder
8bc9f9a05f
fix: Allow toplevel await when option true and correctly mark await keyword as unexpected (#9371) 2019-01-22 14:56:30 -08:00
Daniel Tschinder
4f69699b71 Fix parsing in non-declaration places 2019-01-22 13:12:03 -08:00
Daniel Tschinder
178f2d7949 Make let a contextual keyword 2019-01-22 13:12:02 -08:00
Nicolò Ribaudo
65febdd13a
Refactor import and export parsing (#9326)
* [parser] Refactor import parsing

* [parser] Refactor export parsing

* Fix types
2019-01-22 19:52:56 +01:00
Brian Ng
f77c450cda
Bump prettier (#9373) 2019-01-22 09:16:32 -06:00
Daniel Tschinder
af88e63dff
fix new keyword broken by recent refactoring (#9377) 2019-01-21 22:25:37 -08:00
Daniel Tschinder
96a7343142
Merge pull request #9348 from danez/perf
Parser Performance Collection
2019-01-21 02:27:42 -08:00
Armano
a2e6d8e968 Disallow usage of invalid keyword after export abstract statement in Typescript (#9336) 2019-01-19 15:48:05 -06:00
Daniel Tschinder
b66d921053 perf: Use === or Set.has instead of array.indexOf for keyword checks 2019-01-17 16:16:30 -08:00
Daniel Tschinder
0370af58f1 perf: Use strict equals 2019-01-17 16:15:03 -08:00
Daniel Tschinder
2dc1c91955 perf: Move input to state and precalculate length
This also fixes a bug with async functions
2019-01-17 16:14:54 -08:00
Nicolò Ribaudo
0a88230ec4 Disallow async functions as loop bodies (#9314) 2019-01-17 17:07:48 -05:00
Brian Ng
aaec2cd51d
Fix handling newline with TypeScript declare and abstract classes (#9328) 2019-01-15 06:56:52 -06:00
Brian Ng
34c9890f41
Fix range on TypeScript index signature parameters (#9335) 2019-01-15 06:52:33 -06:00
Armano
e8038863c3 Fix range on TypeScript this type predicate (#9339) 2019-01-15 10:35:49 +01:00
Nicolò Ribaudo
3e4b608a80
Parse class heritage as strict mode code (#9315) 2019-01-12 14:54:23 +01:00
Nicolò Ribaudo
5889620a6a
Disallow new import(x) and import(x,) (#9313)
* Disallow "new import(...)"

* Disallow trailing comma inside dynamic import

* Rename test

* Update error message
2019-01-11 18:59:51 +01:00
Nicolò Ribaudo
9764718c32
Disallow trailing comma after rest (#9311)
* Add new tests

* Use state instead of param and disallow comma in [...a,]=[]

* Unify error messages

* Object destructuring

* Update whitelist
2019-01-11 13:08:38 +01:00
Armano
2cc0376756 @babel/parser(ts): Add parsing of type import (#9302) 2019-01-10 11:14:48 -05:00
Armano
46e3f6df1f @babel/parser: include leading character into range of generic ArrowFunctionExpression (#9295) 2019-01-08 07:19:55 -06:00
Brian Ng
03022d169e
Throw error if TypeScript class has empty implements (#9292) 2019-01-07 15:27:27 -06:00
Daniel Tschinder
e43777bb5f
Fix location for typescript type assertions in AST (#9284) 2019-01-06 16:39:14 -08:00
Brian Ng
a58893d1e3
Ensure modifiers are included in TSParameterProperty ranges (#9276) 2019-01-04 10:02:09 -06:00
J. S. Choi
c586d4e8ca parser, smart pipes: Add support for yield in pipeline bodies
Fixes #9178.
2018-12-23 17:09:18 +01:00
J. S. Choi
60ffe1d103 parser, smart pipes: Add test for async–await 2018-12-23 17:09:18 +01:00
Armano
b5177ce290 babel-parser: typescript: add missing bigint keyword (#9230) 2018-12-22 17:18:32 -06:00
Daniel Tschinder
5cb38995c0
Allow keywords to be used in type annotations (#9184) 2018-12-15 12:51:24 -08:00
Vikram Rangaraj
72471aff63 Handle flow comments with leading spaces (#9168)
* check for spaces and tabs before a flow comment

* fix issue with using string index and shift interchangably

* update tests

* Use update charcodes version

* Disallow flow-comments in flow-comments and check for unterminated comments
2018-12-13 22:10:01 -08:00
Sven Sauleau
fdc869ce16
Merge pull request #8289 from valtech-nyc/implement-smart-pipeline-in-parser
Implement Smart Pipeline proposal in @babel/parser
2018-12-03 19:28:45 +01:00
Daniel Tschinder
fa9df678ac
Move tests from babylon to babel-parser and enable one test that works now 2018-12-03 00:46:54 -08:00
Daniel Tschinder
3932830535
Parse non-octals with leading zeros in non strict mode correctly (#9114)
* Parse non-octals with leading zeros in non strict mode correctly

* Better error message
2018-12-03 00:04:37 -08:00
Daniel Tschinder
07eaa3c63f
Ignore empty fixture directories and fix fixtures in the parser (#9113)
* Ignore fixture directories that do not contain input or exec

* Fix parser test fixtures structures for some imported esprima tests.

* Warn on test folders that are not empty and do not contain testfiles
2018-12-02 22:55:06 -08:00
Nicolò Ribaudo
61f2aed5b0
Disallow await inside arrow functions (#9074)
* Disallow await inside arrow functions

* Update test262 whitelist
2018-11-26 12:43:04 +01:00
Nicolò Ribaudo
856edbf95f
[flow] Allow type casts in array patterns inside arrow parameters (#9069) 2018-11-24 12:23:49 +01:00
Daniel Tschinder
d2971a1959
Fix compatibility between typescript and jsx plugins in interface declarations (#9058) 2018-11-21 15:58:50 -08:00
Brian Ng
4f16a12c03
Fix bug with parsing TS generic async arrow function (#9055) 2018-11-21 15:34:09 -06:00