Sosuke Suzuki
ae18f9c0d9
Throw a syntax error for a declare function with a body ( #12054 )
2020-09-19 00:35:37 +02:00
Sosuke Suzuki
7028a14c7f
fix: throw for constructors with type parameters ( #12065 )
...
* Throw a syntax error for a constructor with type parameters
* Modify to match error location with TypeScript
* Update typescript parser tests
Update allowlist.txt
2020-09-17 13:03:33 -04:00
Sosuke Suzuki
bbe0cf09fc
Throw a syntax error for a parameter properties in not constructor ( #12061 )
2020-09-14 16:28:06 -05:00
Huáng Jùnliàng
2c60595342
fix: ExpressionBody should respect [In] parameter ( #11931 )
2020-08-26 13:24:44 -04:00
Brian Ng
941f610275
Set generator to true during error recovery of accessor ( #11987 )
2020-08-21 14:37:52 -05:00
Brian Ng
84ea6e4501
Throw error on invalid flow async generic arrow syntax ( #11979 )
2020-08-19 16:11:17 -05:00
Brian Ng
96cc8292b7
Fix parsing type casted generic flow arrow exprs ( #11955 )
2020-08-19 14:15:01 -05:00
Huáng Jùnliàng
cdada5800d
fix: do not transform ClassPrivateMethods in estree ( #11973 )
...
* fix: do not transform ClassPrivateMethods in estree
* fix: use MethodDefinition as ClassPrivateMethod visitor keys
2020-08-18 11:18:38 -04:00
Huáng Jùnliàng
66c6b3b949
Add more parser test cases ( #11923 )
...
* remove unused codes
* refactor: remove unused parseAccessModifier
* refactor: remove redundant async function checks
* refactor: remove redundant class check in checkExport
* add more parser test cases
* Update packages/babel-parser/src/parser/statement.js
Co-authored-by: Brian Ng <bng412@gmail.com>
* chore: add sourceType: unambiguous test
Co-authored-by: Brian Ng <bng412@gmail.com>
2020-08-14 11:53:17 -04:00
Huáng Jùnliàng
3995160fc7
fix: push new token context when braceHashL is seen ( #11941 )
...
* fix: push new token context when braceHashL is seen
* Update packages/babel-parser/src/tokenizer/context.js
2020-08-11 09:55:13 -04:00
Huáng Jùnliàng
008fe25ae2
fix: reset EndLocation for catch param ( #11943 )
2020-08-10 17:06:34 -04:00
Huáng Jùnliàng
cd577eedfd
refactor: add recoverable error on accessorIsGenerator ( #11921 )
...
* refactor: add recoverable error on accessorIsGenerator
* Update packages/babel-parser/src/parser/error-message.js
Co-authored-by: Brian Ng <bng412@gmail.com>
* Apply suggestions from code review
Co-authored-by: Brian Ng <bng412@gmail.com>
2020-08-05 17:52:13 -04:00
Huáng Jùnliàng
92434269af
fix: do not eat get/set after async is parsed ( #11916 )
2020-08-05 08:19:59 -05:00
Huáng Jùnliàng
a1eabb84ea
rescan gt/lt token after TsAsExpression is parsed ( #11912 )
...
* refactor: move inType checks to flow plugin
* polish: replace hardcoded char codes
* fix: rescan greater/less token after asExpression is parsed
2020-08-04 17:00:21 -04:00
Huáng Jùnliàng
a4ebe29b3f
Parser refactoring ( #11871 )
...
* refactor: parseMaybeUnary => parseUnary
* refactor: extract shouldExitDescending method
* refactor: add parseUpdate
* refactor: avoid comparing with hardcoded token value
* refactor: add ParseNewOrNewTarget
* refactor: add parseCoverCallAndAsyncArrowHead
* add parseBind
* refactor: polish parseTaggedTemplateExpression interface
* refactor: add parseMember method
* refactor: add parseSuper method
* refactor: add parseAsyncArrowUnaryFunction method
* fix: disallow line break before async binding arrow
* refactor: simplify tt.name logic
* refactor: add parseDo method
* refactor: misc
* refactor: rename parseObjectMember by parsePropertyDefinition
* refactor: unify set/get/async keyword parsing in ObjectMethod
* refactor: misc
* refactor: add parseArrayLike method
* refactor: move fsharp epilogure and prologue inside parseObjectLike
* fixup
* refactor: rename parseFunctionExpression to parseFunctionOrFunctionSent
* refactor: remove redundant logic
* refactor: rename parseClassPropertyName by parseClassElementName
* refactor: avoid unecessary lookahead when parsing tt._export
* fix: export-default-from should support escaped async as export binding
* address review comments
* parseUnary -> parseMaybeUnary
2020-07-31 20:36:04 -04:00
Huáng Jùnliàng
01d4625412
Correctly check reserved word for PropertyDefinition: IdentifierReference ( #11862 )
...
* fix: check IdentifierReference in PropertyDefinition
* chore: add more test cases
* fix: incorrect test title
2020-07-29 19:40:52 -04:00
Vahagn Aharonian
b651a6f6ab
Enable logical assignment by default in @babel/parser ( #11860 ) ( #11869 )
2020-07-29 18:32:12 -04:00
Huáng Jùnliàng
0e985fb287
feat: enable numericSeparator parsing support ( #11863 )
2020-07-29 18:32:12 -04:00
Nicolò Ribaudo
eba4c3b6ed
TypeScript 4.0: Support labeled tuple elements ( #11754 )
...
* TypeScript 4.0: Support labeled tuple elements
* More tests
* Disallow mixing labeled and unlabeled elements
* Update AST shape
* Enable test after rebase
* Allow labeled spread types
* Fix flow
* Add types and generator suport
* Update packages/babel-parser/src/plugins/typescript/index.js
* Prettier
2020-07-29 16:51:48 -04:00
Huáng Jùnliàng
9e6663f125
Follow-up on initial TS4 catch param support ( #11767 )
...
* refactor: align with AST shape convention
* feat: print catch param type annotations
* test: add test case on transform
2020-07-29 16:51:48 -04:00
Brian Ng
8a1d7e41f2
Allow unknown/any in TS catch clause param ( #11755 )
2020-07-29 16:51:48 -04:00
Nicolò Ribaudo
5b4b3a3e4a
TypeScript 4.0: Allow spread in the middle of tuples ( #11753 )
2020-07-29 16:51:48 -04:00
Huáng Jùnliàng
d7347fb8bd
eslint-parser: ES2020 features ( #11815 )
...
* chore: update espree test on nullish coalescing
* feat: add optional chaining support
* fix: adapt to estree AST shape
* chore: update lockfile
* add estree optional-chaining test fixtures
* address review comments
* chore: simplify smoke test
* export * support
Co-authored-by: Brian Ng <bng412@gmail.com>
2020-07-29 16:46:29 -04:00
Huáng Jùnliàng
059e9124ff
Add decimal parsing support ( #11640 )
...
* docs: add DecimalLiteral to AST spec
* add decimal support
* fix: throw invalid decimal on start
* add DecimalLiteral type definitions
* update parser typings
* add generator support
* add syntax-decimal plugin
* Add syntax-decimal to babel-standalone
* add syntax-decimal to missing plugin helpers
* fix incorrect test macro
2020-07-29 16:43:15 -04:00
Huáng Jùnliàng
2bf38fb914
fix: disallow \8, \9 in strict mode string ( #11852 )
2020-07-21 09:44:56 -04:00
Huáng Jùnliàng
3680f019d7
fix: allow 09.1_1 and 09e1_1 in sloppy mode ( #11854 )
...
* fix: allow 09.1_1 and 09e1_1 in sloppy mode
* polish: avoid extra input source scanning
* chore: move comment [skip ci]
2020-07-21 09:44:28 -04:00
Huáng Jùnliàng
f4eeff947d
fix: correctly set innerEndPos in CoverParenthesizedExpressionAndArrowParameterList ( #11847 )
2020-07-16 17:11:06 -05:00
Huáng Jùnliàng
02c8fd92bd
fix: add optional: false to chained optional call expression ( #11814 )
2020-07-09 20:33:50 -04:00
Huáng Jùnliàng
d67629b114
fix: throw expect jsx plugin error when an idStart or > is seen ( #11774 )
...
* fix: throw expect jsx plugin error when an idStart or > is seen
* fix: avoid throwing undefined
* add test case
2020-07-01 15:17:05 -04:00
Kai Cataldo
75c2300c28
Add @babel/eslint-plugin-development-internal ( #11376 )
...
* Add @babel/eslint-plugin-internal
* Add dry-error-messages rule
* Address feedback
* Enable new rule
* fix author field
* Fix errors
* Add readme
* Add example configuration
* Handle directories
* run make bootstrap
* More updates!
* Fix errors
* Update tests
* Fix CI race condition
2020-06-22 19:43:29 -04:00
Jorge Henriquez
beca7e2d8e
Add better parser error when using jsx ( #11722 )
...
* Add "<" parser tests
* No {jsx,flow,typescript} plugin
* Type parameter
* Valid JS Code
* Add: better parser error when using jsx
Address #11499
* Add: babel parser test
Test parser with no plugins and when jsx is given with a js expression
* Add: no flow but with typescript test
* Add: type paramter test with no plugins (no flow)
* Add: unclosed jsx element test
2020-06-22 18:12:52 -04:00
Huáng Jùnliàng
30835f14db
fix: implement early errors for record and tuple ( #11652 )
2020-06-20 02:35:27 +02:00
骗你是小猫咪
e15a5c7509
Fix innercomments ( #11697 )
2020-06-12 20:22:47 -05:00
Bogdan Savluk
4108524856
Update prettier to v2 ( #11579 )
...
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-06-07 22:21:33 +02:00
Huáng Jùnliàng
71d3527ef5
Properly parse export default from when exportDefaultFrom is not enabled ( #11676 )
...
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-06-05 09:08:21 -05:00
Justin Ridgewell
bda759ac3d
Handle private access chained on an optional chain ( #11248 )
...
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Huáng Jùnliàng <jlhwung@gmail.com>
2020-05-26 22:18:17 +02:00
Justin Ridgewell
7459038db8
Add private-property-in-object support ( #11372 )
...
https://github.com/tc39/proposal-private-fields-in-in
Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-Authored-By: Huáng Jùnliàng <jlhwung@gmail.com>
2020-05-26 22:18:17 +02:00
Vivek Nayyar
66b86e088c
added basic support for module attributes and tests updated ( #10962 )
...
Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
2020-05-25 01:26:28 +02:00
Kiko Estrada
5dd7f438c9
Enable import.meta by default in @babel/parser ( #11406 )
2020-05-24 22:57:34 +02:00
Huáng Jùnliàng
2f31ecf85d
fix: allow bigInt in method name and TSLiteralType ( #11547 )
...
* refactor: add isLiteralPropertyName to parser utils
* address review comments [skip-ci]
* refactor: keyword is valid identifierName
* fix: allow bigint in TSLiteralType
* update typescript test whitelist
2020-05-14 18:40:52 -04:00
Huáng Jùnliàng
2e4f18ac92
Add some parser missing plugins errors ( #11478 )
...
* fix: do not throw invalid hash in tokenizer
* refactor: bigint has been enabled by default
* polish: add numeric separator missing plugin error
* fix: forward expectPlugin declaration
2020-04-25 10:26:39 +02:00
Brian Ng
40c517ed84
Set exprAllowed to false for star token ( #11449 )
2020-04-21 14:22:40 -05:00
Huáng Jùnliàng
fba64d439d
fix: disallow expression after binding identifier of ( #11355 )
2020-04-21 15:12:23 -04:00
Huáng Jùnliàng
a466f9c310
fix: report missing plugins on type exports ( #11417 )
...
* fix: report missing plugins on type exports
* nit refactors
* Update packages/babel-parser/src/parser/statement.js [skip ci]
2020-04-14 15:23:54 +02:00
Huáng Jùnliàng
8b976b0670
fix: do not push new token context when function is following dot/questionDot ( #11388 )
...
* fix: do not push new token context when function is following dot/questionDot
* more cautiously poping context
2020-04-08 10:10:36 -04:00
Kai Cataldo
4e6c9c52ef
fix: token after strict mode block is evaluated in strict mode ( #11186 )
2020-03-24 08:38:02 +01:00
Huáng Jùnliàng
dc7c5640e9
Compact parser fixture loc info ( #11322 )
...
* chore: compact loc information in parser fixtures
* chore: update test fixtures
2020-03-23 20:10:29 -04:00
Vedant Roy
0e5c1da659
fix: async arrow functions should not be allowed after binary… ( #11284 )
...
* Forbid async arrow functions after binary operator.
This commit makes Babel throw an error when parsing
code like "3 + async() => 2".
* Make atPossibleAsync more accurate
* Change atPossibleAsync to atPossibleAsyncArrow
Add an extra test to atPossibleAsync and refactor it to
atPossibleAsyncArrow. This also fixes a bug in the Typescript plugin,
so a new test has been added.
* Add test for async arrow after unary operator
2020-03-21 19:38:36 +01:00
Kai Cataldo
7ca814489a
fix: parse value imports named type as values ( #11296 )
...
* fix: parse value imports named type as values
* Address feedback
* Add plugin tests
* Add isContextual() check
* Remove importKind: value from extraneous nodes
* Ensure importKind is correct for more nodes
* Add additional test
* Address feedback
* Revert formatting
* Fix tests
2020-03-21 01:38:07 +01:00
Huáng Jùnliàng
841f4428e8
Rephrase parser error message ( #11208 )
...
* refactor: rephrase some parser error messages
* update test fixtures
* Update packages/babel-parser/src/parser/location.js
Co-Authored-By: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
* address review comments
* Update packages/babel-parser/src/parser/location.js
Co-Authored-By: Brian Ng <bng412@gmail.com>
* update test fixtures
Co-authored-by: Nicolò Ribaudo <nicolo.ribaudo@gmail.com>
Co-authored-by: Brian Ng <bng412@gmail.com>
2020-03-16 21:48:32 -04:00