221 Commits

Author SHA1 Message Date
Nicolò Ribaudo
d0f093e716
Update test262 whitelist 2019-09-25 02:03:58 +02:00
Gonzalo Rodríguez
490798a26d [parser] Disallow numeric separators in legacy octal like inte… (#10493)
* Disallow numeric separators in lols

* Update whitelist

* Rename test

* Better syntax when checking
2019-09-25 01:32:50 +02:00
Gonzalo Rodríguez
69d00dc5b0 [parser] Invalid NonOctal Decimal (#10467)
* Add test

* Add nonOctalDecimal verification

* Update regex and code style

* Refactor non octal detection

* Add numeric separator test

* Disallow numeric separators in non octals

* Update whitelist

* Better test naming

* Disallow numeric separators in non oct for all numbers

* Specific error above the general error

* Add test for invalid leading zero in num separator

* Add start position to error
2019-09-23 23:07:52 +02:00
Ivan Medina
f339d2d034 [parser] Disallow numeric separator in unicode scape sequences (#10468)
* [parser] Disallow numeric separator in unicode scape sequences (#10460)

* raise error only when numeric separator plugin is set

* Adds argument for checking numeric separator

* Fix condition for readability

* Add test for hex escape sequence and rephrase error message

* Remove exposure for allowNumSeparator in readHexChar method
2019-09-23 22:47:18 +02:00
Vivek Nayyar
b7333ea97a added check to disallow super.private variable access and test case added (#10472)
* 🚀 added check to disallow super.private variable access and test case added

* ♻️ change the other linting change back to how it was

* ♻️ change the other linting change back to how it was

* ♻️ added newline at the end test output.json file

* ♻️ changed the linting style to the way it was

* ♻️ updated error message, removed super private member access test cases from whitelist of flow and test 262 suite

* ♻️ added newline in output.json
2019-09-21 00:22:37 +02:00
Guy Waldman
9c1ad0a9f7 [parser] Disallow static fields named constructor (#10461)
* Disallow static fields named `constructor` in a class

    - Disallowed static fields named `constructor` in a class (previously only non-static were disallowed)
    - Updated the text for the error for one consolidated warning, for both static and non-static fields
    - Added a test
    - Updated an existing test in the `flow` test suite of the parser to reflect the parse error.
  Strangely, the test used to pass and started failing when inlining the `isNonstaticConstructor` method, without any changes.
  In that test, `constructor` was a field, so in theory it should never have passed.
  Would appreciate some feedback on this, as I'm not 100% sure if this is somehow related to Flow

* Update test262 whitelist

* Add comment and fix && operator
2019-09-18 01:19:45 +02:00
Nicolò Ribaudo
0ef4972295
Ignore regexp tests from test262 (#10458) 2019-09-18 00:14:27 +02:00
Nicolò Ribaudo
cb881e6b3f
[parser] Report escapes in kws only if they won't be used as i… (#10455)
We can do it by tokenizing escaped keywords as normal identifiers, so that they won't
be accidentally used as real keywords.
2019-09-18 00:13:51 +02:00
Nicolò Ribaudo
45a484f0a2 Enable optional chaining in test262 (#10457) 2019-09-17 12:10:57 -05:00
Nicolò Ribaudo
99f4f6c3b0
Update Test262 (#10448) 2019-09-17 02:14:14 +02:00
Huáng Jùnliàng
0ee2c42b55 chore: add lint-ts rule (#10427) 2019-09-11 20:24:08 +02:00
Vivek Nayyar
b02e35c19a Fix parenthesis for nullish coalescing (#10269)
* ♻️ added condition to check for left and right of nullish coalescing operator and if any is a logical expression without a paren then throw an error

* 🐛 bugs fixed and test cases updated for babel parser

* ♻️ code comments added

* 🐛 spell error rectified

* ♻️ failing test updated

* 🐛 push tests after make build

* Skip nullish-coalescing flow precedence tests

They're now incorrect

* ♻️ error message updated, binop priority of other logical operators +1 from ?? and

* ♻️ increaed the binOp for in and instanceOf, added logic to print the brackets in an ?? && || expression, test cases added

* 🐛 failing test fixed and comments updated

* ♻️ new lines added between tests

* ♻️ basic tests for checking the binOp of instanceOf, in and relational operators to be equal added

* ♻️ new lines added in between tests
2019-09-06 17:35:44 +02:00
Daniel Tschinder
4f0840ab88
Update dev dependencies and fix linting errors (#10228)
* chore: Uppate dev dependencies

* chore: Fix lint errors

* chore: Format options.json files

* chore: Fix stupid flow errors

* Update test262 whitelist

Seems test262-stream was updated and now these tests work.
2019-07-27 15:09:30 +02:00
Tan Li Hau
f588e4ec47 BigInt type for Flow (#10091)
* flow BigIntLiteralTypeAnnotation

* numericSeparator for flow test plugins

* fix flow tuple

* fix code review
2019-07-03 16:48:46 +02:00
Nicolò Ribaudo
8bf9714d69
[legacy decorators] Allow decorating generator methods (#9912)
* [legacy decorators] Allow decorating generator methods

The old proposal used LeftHandSideExpression (instead of
AssignmentExpression) to satisfy this usecase:
e240cbc91a

* Update flow whitelist
2019-06-30 11:32:16 +02:00
Tan Li Hau
fdbbb743b6 flow - allow type parameter defaults in function declarations (#10084)
* flow - allow type parameter defaults in function declarations

* fix flow test

* add intern_comments option

* fix flow parser test

* remove allowdefault from flowParseTypeParameterDeclaration

* rename test cases
2019-06-15 12:31:12 +02:00
Daniel Tschinder
491b0a8e33
Update test262 (#9806) 2019-04-01 21:47:07 -07:00
Daniel Tschinder
c7587c016e
Don't accept '\08' or '\09' in strict mode (#9769) 2019-04-01 19:41:50 -07:00
Daniel Tschinder
6bc9e7ebda
Correctly check for-in and for-of loop for invalid left-hand side (#9768)
* Correctly check for-in and for-of loop for invalid left-hand side

* Overwrite with env variable
2019-03-26 15:32:14 -07:00
Daniel Tschinder
7f4427432c
Parse right-hand-side of for/of as an assignment expression (#9767) 2019-03-25 18:14:56 -07:00
Daniel Tschinder
b2b96e0b15
Add WarningsToErrorsPlugin to webpack to avoid missing build problems on CI (#9647) 2019-03-07 15:44:36 -08:00
Daniel Tschinder
fb81e8f8b4
Make babel-standalone an ESModule and enable flow (#9025)
* Make babel-standalone an ESModule and enable flow

* autogenerate plugin list

* Make config an array
2019-03-06 14:30:43 -08:00
Daniel Tschinder
29999007f6
Disallow escape sequences in contextual keywords (#9618)
* Disallow escape sequences in async

* Disallow escape sequences in get, set and async in class

* invalid escape tests

* Update whitelist

* tests for async in parens

* Add test for invalid newline between params and arrow

* Move canInsertSemilcolon() into shouldPArseAsyncArrow
2019-03-05 17:20:36 -08:00
Daniel Tschinder
98ab1b6428
Refactor parsing object members (#9607)
* Refactor parsing object members

* Ensure decorators on rest don’t swallow decorators silently

* Use hasPrecedingLineBreak

* Add test for async with linebreak

* Update flow whitelist
2019-02-28 11:42:12 -08:00
Daniel Tschinder
208195f425
Disallow duplicate params in methods (#9599)
* Disallow duplicate params in methods

* Fix plugins
2019-02-27 15:54:07 -08:00
Daniel Tschinder
43eed1ac92
Check exported bindings are defined (#9589)
* Check exported bindings are defined

* Add tests

* Update flow whitelist

* Add tests for builtins
2019-02-26 13:28:10 -08:00
Daniel Tschinder
d0e196d210
Treat for loop body as part of loop scope (#9586) 2019-02-25 18:30:51 -08:00
Daniel Tschinder
45c96908e9
Update test262 (#9587)
* Update test262

* Also remove unrecognized tests from the whitelist
2019-02-25 15:10:48 -08:00
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
Nicolò Ribaudo
d86b831364
Add duplicate-package-checker-webpack-plugin (#9517)
We are duplicating semver. It's such a small package that I don't think that it is worth spending much time trying to understand why.
2019-02-15 12:28:00 +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
Galymzhan Abdugalimov
7e9029e337 Switched gutil.log to fancyLog due to deprecation (#9432) 2019-01-30 08:23:02 -06:00
Galymzhan Abdugalimov
00c3e3c8e0 Fixed link to @babel/parser's issues in README (#9427) 2019-01-30 08:18:43 -06:00
Nicolò Ribaudo
4c4c22a316 Run prettier 2019-01-30 11:30:31 +01:00
Rizky
56044c7851 install polyfill & runtime to dependency instead of devDependency [skip ci] (#9409) 2019-01-29 08:09:08 -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
4f69699b71 Fix parsing in non-declaration places 2019-01-22 13:12:03 -08:00
Daniel Tschinder
f4f5ca2aaa Parse class name in strict mode
The specification defines that the whole class declaration is parsed in strict mode
2019-01-22 13:12:03 -08:00
Daniel Tschinder
8071dca9ad Disallow const let or let let 2019-01-22 13:12:02 -08:00
Daniel Tschinder
96a7343142
Merge pull request #9348 from danez/perf
Parser Performance Collection
2019-01-21 02:27:42 -08:00
Nicolò Ribaudo
4ce37b7aca
Update test262 sha (#9365) 2019-01-19 18:10:28 +01:00
Daniel Tschinder
2d6231fd3d Update flow whitelist 2019-01-17 16:16:32 -08:00
Nicolò Ribaudo
0a88230ec4 Disallow async functions as loop bodies (#9314) 2019-01-17 17:07:48 -05: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
Cameron Martin
778a61a3c2 [@babel/types] Moved generators related to babel-types into the babel-types package directory. (#9245) 2019-01-09 00:14:31 +01:00
Brian Ng
a55382e4ad
Test262 update (#9288) 2019-01-07 08:52:36 -06:00
Cameron Martin
9e95da4eaa Added type-level mapping between aliases and nodes that have that alias. (#9110) 2018-12-19 10:57:27 +01:00