Daniel Tschinder
a7391144b3
Introduce scope tracking in the parser ( #9493 )
...
* Introduce scope tracking
* Fix tests
* Add new tests
* Remove constructor-super check from transform as it is now in parser
* Correctly handle class properties and class scope
* Fix duplicate name check
* Convert scope identifier storage to array
* Enter a new scope in typescript module blocks
* Add test for duplicate declaration
* Rename error for duplicate exports
* Treat class declarations as lexical declaration
* Update whitelist
* Add tests
* Fix scope tracking for function declarations
* Migrate try-catch duplicate error
* Fix test
* More tests
* One more test
* Make scope a separate class and fix review comments
* Do not allow new.target in top scope arrow function
* Correctly enter new scope for declare module and treat type aliases as lexical declarations
* Tests for typescript scope tracking to not mark type aliases as duplicate
* Fix flow scope tracking
* Remove ident from test names as redundant
* Add test case for var and function
* Improve error messages
* Improve literal regex
2019-02-25 11:04:52 -08:00
Barthélémy Ledoux
9f3457797f
Fix TypeScript parsers missing token check ( #9571 ) ( #9572 )
...
* Fix TypeScript parsers missing token check (#9571 )
* fix unit test
2019-02-24 13:34:38 +01: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
Brian Ng
7dc157f9be
Fix location/range on TypeScript ExportNamedDeclarations ( #9406 )
2019-01-24 19:44:22 -06:00
Daniel Tschinder
8071dca9ad
Disallow const let or let let
2019-01-22 13:12:02 -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
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
4e5e319d5b
perf: remove double check for keywords in readWord
...
Instead of calling isKeyword we simple check directly if the keyword token is available
2019-01-17 16:16:31 -08:00
Daniel Tschinder
f216975378
perf: call isLineTerminator as last check
2019-01-17 16:16:28 -08:00
Daniel Tschinder
58768072ef
perf: Ensure canInsertSemicolon is always called last
...
It does a lot of checks and a regex test
2019-01-17 16:16:26 -08:00
Daniel Tschinder
49f7bcf271
perf: Remove unnecessary check for flow plugin inside of flow plugin
2019-01-17 16:15:07 -08:00
Daniel Tschinder
c2e41588aa
perf: run flow code in flow plugin
2019-01-17 16:15:05 -08:00
Daniel Tschinder
0370af58f1
perf: Use strict equals
2019-01-17 16:15:03 -08:00
Daniel Tschinder
8df0500f55
perf: Simplify reading of tokens.
...
This avoids checking isIdentifierStart for every single token
2019-01-17 16:15:01 -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
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
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
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
Daniel Tschinder
4ca35ef8b9
Fix running flow on travis and update flow ( #9128 )
...
* Fix running flow on travis and update flow
- ensure bootstrap is run before running flow as we need some generated files for correctly doing typechecks
- ensure that we only ignore the build directory inside the babel folder as currently we ignore everything because travis checks out into ‘/home/travis/build/’
* Fix all flow errors
2018-12-05 12:30:30 -08: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
Daniel Tschinder
a2afb974be
Fix parsing typescript function types with destructuring ( #9035 )
...
* Fix parsing typescript function types with destructuring
* Use integer instead of actual stack
2018-11-19 13:55:58 -08:00
Brian Ng
4f206b2416
prettier@1.15.1 ( #9001 )
2018-11-09 15:25:13 -06:00
Daniel Tschinder
343f776ca5
Rename primitive types to reserved types ( #8984 )
2018-11-07 16:50:36 -06:00
Daniel Tschinder
5d5cd8612f
Fix several edge cases with context expression state ( #8972 )
...
* Fix several edge cases with context expression state
* Fix review comments
* Remove unused field
2018-11-06 19:37:24 -08:00
Retsam
2194842d11
Typescript: Validate tuple type element positions ( #8828 )
...
* feat: validate the positions of rest elements and optional elements in tuple types
Adds a validation step to the parser which raises syntax errors if a rest param is not at the end of a tuple, or if a mandatory param follows an optional parameter
* Fix spread after optional case; add test case
2018-11-05 23:19:34 -08:00
Daniel Tschinder
e3b2c1afff
fix: Do not allow TypeCastExpressions w/o parens ( #8956 )
2018-11-05 15:34:24 -08:00
Jordan Brown
f216a7b06f
[flow] Add support for parsing _ as implicit instantiation in call/new ( #8883 )
...
* [flow] Add support for parsing as implicit instantiation in call/new
* Update flow tests and fix underscore being a reserved type
* Rebase onto flow-test
* Fix flow commit hash
2018-11-05 10:45:40 -08:00
Daniel Tschinder
cd81b079ee
Allow function types in type params within arrow return types ( #8954 )
2018-11-01 09:10:46 -05:00
Jordan Brown
e4929e11f6
[flow] Explicit inexact objects with ... ( #8884 )
2018-10-29 15:09:17 -05:00
Retsam
08454ece46
Typescript - Tuples can include rest elements ( #8805 )
2018-10-08 11:32:31 -05:00
Retsam
a5b5ed928d
Typescript - Tuple elements can be optional ( #8720 )
2018-10-02 11:29:51 -05:00
Nicolò Ribaudo
3c87401714
[decorators] [typescript] Parse type parameters ( #8767 )
...
* [decorators] [typescript] Parse type parameters
* Add test for invalid code
2018-10-01 22:04:19 +02:00
Matthew Robertson
07862e7272
Fix perf issue in typescript parser plugin ( #8792 )
2018-10-01 12:59:16 -05:00
Pig Fang
f38be13113
TypeScript: reserve unknown as TSUnknownKeyword ( #8755 )
2018-09-25 12:19:32 -05:00
Brian Ng
380f2a0297
Fix typescript parsing typed object shorthand methods ( #8677 )
2018-09-14 10:20:59 -05:00